void CalcSuccess() { int[] inputs = new int[_network.InputLength]; int output; double error = 0; int expCount = 5000; for (int i = 0; i < expCount; i++) { for (int j = 1; j < inputs.Length; j++) { inputs [j] = _rand.Next() % 100; } inputs[0] = 1; output = _network.Think(inputs, null); if (output != 0) { error += 1; } } error /= expCount; CompositionRoot.Instance.ExecuteInMainThread(() => { _errorLabel.text = error.ToString("00.000"); }); }
private float GetError() { NeuralDecisionNetwork decider = _decider.Clone(); int successes = 0; for (int i = 0; i < _trainingModels.Count; i++) { if (_trainingModels [i].Output == decider.Think(_trainingModels [i].Inputs, _trainingModels [i].Options)) { successes++; } } return((_trainingModels.Count - successes) / (float)_trainingModels.Count); }
private int GetDecisionInd(DecisionType type, Game game, PlayerModel player, List <int> randoms, int points, Resource receivedRecource, WhereToGo whereToGo) { List <int> optionInds = AINeuralPlayer.GetOptionInds(type, game, _model, randoms, points, receivedRecource, whereToGo); int[] inputs = AINeuralPlayer.GetInputs(type, game, _model, receivedRecource, whereToGo); double[] inputsDouble = new double[inputs.Length]; for (int i = 0; i < inputs.Length; i++) { inputsDouble [i] = inputs [i]; } NeuralDecisionNetwork chooser = GetChooserDecider(type); int decisionInd = chooser.Think(inputs, optionInds); return(decisionInd); }