Exemplo n.º 1
0
        public async void Execute(MasterRequest masterRequest)
        {
            if (masterRequest.type == 0)
            {
                Master master = new Master(masterRequest.Label, masterRequest.DesignScore, masterRequest.MathScore,
                                           masterRequest.AlgoScore, masterRequest.CodingScore, masterRequest.CliScore, masterRequest.NetworkingScore,
                                           masterRequest.HardwareScore);
                var model = await TrainAsync();

                Evaluate(model);
                string evalresult = "";
                var    prediction = model.Predict(master);
                evalresult = Evaluate($"{prediction.Score[0]:0.####}", $"{prediction.Score[1]:0.####}",
                                      $"{prediction.Score[2]:0.####}", $"{prediction.Score[3]:0.####}");
                result = new OutputHelper(evalresult, $"{prediction.Score[0]:0.####}", $"{prediction.Score[1]:0.####}",
                                          $"{prediction.Score[2]:0.####}", $"{prediction.Score[3]:0.####}");
            }
            else
            {
                Console.WriteLine(Directory.GetCurrentDirectory() + @"\datasets\iris-train.txt");
                using (StreamWriter writer = System.IO.File.AppendText(@"c:\temp\MyTest.txt"))
                {
                    writer.WriteLine(masterRequest.Label + "\t" + Beautify(masterRequest.DesignScore.ToString()) + "\t" +
                                     Beautify(masterRequest.MathScore.ToString()) + "\t" +
                                     Beautify(masterRequest.AlgoScore.ToString()) + "\t" +
                                     Beautify(masterRequest.CodingScore.ToString()) + "\t" +
                                     Beautify(masterRequest.CliScore.ToString()) + "\t" +
                                     Beautify(masterRequest.NetworkingScore.ToString()) + "\t" +
                                     Beautify(masterRequest.HardwareScore.ToString()));
                }
            }
        }
Exemplo n.º 2
0
        public Slave(MasterRequest masterReq)
        {
            Database = Database.GetProductionDatabase(ConfigurationManager.AppSettings["MongoHost"]);
            var dataSets = DataPreprocessing.MakeTrainingAndValidationSets(masterReq.Symbol, masterReq.StartDate,
                                                                           masterReq.EndDate, masterReq.ValidationPct, DataPreprocessing.GetSignalFunc(masterReq.SignalType));

            TrainingSet = dataSets.Item1;
        }
Exemplo n.º 3
0
        public void AddMasterRequest(WorldClient pClient, string target)
        {
            MasterRequest         Request  = new MasterRequest(target, pClient);
            MasterRequestResponse response = new MasterRequestResponse(Request);

            if (response.responseAnswer)
            {
                response.SendMasterRequest();
                pMasterRequests.Add(Request);
            }
        }
Exemplo n.º 4
0
        public MasterResponse Post([FromBody] MasterRequest req)
        {
            string json = "";

            MasterResponse resp = new MasterResponse(req);

            //json = JsonConvert.SerializeObject(resp);


            return(resp);
        }
Exemplo n.º 5
0
        public void AddMasterRequest(WorldClient pClient, string target)
        {
            var request  = new MasterRequest(target, pClient);
            var response = new MasterRequestResponse(request);

            if (!response.ResponseAnswer)
            {
                return;
            }
            response.SendMasterRequest();
            _pMasterRequests.Add(request);
        }
Exemplo n.º 6
0
        public Supervisor(int slaveCount, MasterRequest masterRequest)
        {
            Console.WriteLine("Supervisor created");
            SlaveCount    = slaveCount;
            MasterRequest = masterRequest;

            MyThread = new Thread(Supervise)
            {
                Name = "Supervisor"
            };
            MyThread.Start();
        }
Exemplo n.º 7
0
 // unsuesd/... just code refernce
 protected string  OriginalProcessChange()
 {
     if (this.templateNode.Name.ToLower() == "srai")
     {
         if (this.templateNode.InnerText.Length > 0)
         {
             Request subRequest = new MasterRequest(this.templateNode.InnerText, (AIMLbot.User) this.user, (AIMLbot.Bot) this.Proc);
             subRequest.StartedOn = this.request.StartedOn; // make sure we don't keep adding time to the request
             Result subQuery = this.Proc.Chat(subRequest);
             this.request.hasTimedOut = subRequest.hasTimedOut;
             return(subQuery.Output);
         }
     }
     return(string.Empty);
 }
Exemplo n.º 8
0
        public void MasterRequestAccept(string requestername, string TargetName)
        {
            WorldClient           target    = ClientManager.Instance.GetClientByCharname(TargetName);
            WorldClient           requester = ClientManager.Instance.GetClientByCharname(requestername);
            MasterRequestResponse Reponse   = new MasterRequestResponse(target, requester);

            if (Reponse.responseAnswer)
            {
                MasterMember ReqMember = new MasterMember(requester, target.Character.ID);
                MasterMember TargetM   = new MasterMember(target, requester.Character.ID);
                target.Character.MasterList.Add(ReqMember);
                requester.Character.MasterList.Add(TargetM);
                ReqMember.AddToDatabase();
                TargetM.IsMaster = true;
                TargetM.AddToDatabase();
                SendMasterRequestAccept(requester, TargetName);
            }
            else
            {
                MasterRequest rRequest = pMasterRequests.Find(d => d.InvitedClient == requester);
                this.pMasterRequests.Remove(rRequest);
            }
        }
Exemplo n.º 9
0
 public OutputHelper Post([FromBody] MasterRequest master)
 {
     Execute(master);
     return(result);
 }
Exemplo n.º 10
0
        public void RemoveMasterRequest(WorldClient pClient)
        {
            MasterRequest Request = pMasterRequests.Find(d => d.InvitedClient == pClient);

            pMasterRequests.Remove(Request);
        }
Exemplo n.º 11
0
 public MasterResponse(MasterRequest req)
 {
     Master = User.GetMasterInfo(req.Sessionid);
 }