public void OnToggleTrainPressed() { _isTraining = !_isTraining; if (!_isTraining) { return; } // Train thread. Thread thread = new Thread(new ThreadStart(() => { while (_isTraining) { TrainingDecisionModel currTraining = _trainingModels[_trainingsCount % _trainingModels.Count]; float currSpeed = 0.0005f; //*currTraining.RewardPercent*0.01f; _decider.Train(currTraining.Inputs, currTraining.Output, currTraining.Options, currSpeed); _trainingsCount++; CompositionRoot.Instance.ExecuteInMainThread(() => { _performedTrainingsCount.text = _trainingsCount.ToString(); }); } })); thread.Start(); // Calc success thread. Thread thread2 = new Thread(new ThreadStart(() => { while (_isTraining) { float error = GetError(); System.Threading.Thread.Sleep(300); CompositionRoot.Instance.ExecuteInMainThread(() => { _error.text = error.ToString("00.0000"); Debug.Log("success updated, success = " + error.ToString()); }); } })); thread2.Start(); }
public GameDecizionEvent(TrainingDecisionModel decisionTraining, PlayerModelTrainingDump stateBefore, PlayerModelTrainingDump stateAfter, ModelChangeType type) : base(stateBefore, stateAfter, type) { this.DecisionTraining = decisionTraining; }