void Update() { PerceptronInterface PI = gameObject.GetComponent <PerceptronInterface>(); // check if this GO have perceptron interface if (Learn && PCT != null && Answer != null) { if (Task == null) { PLBBP.Learn(PCT, Answer[0]); // perceptron's learn } else { PLBBP.Learn(PCT, Task, Answer); // perceptron's learn } Learn = !PLBBP.Learned; if (PI != null && PI.PV != null) { PI.PV.DisplayPerceptronModel(null); // display perceptron model } } if (PI != null) { if (PI.Reload) { PLBBP.LearnIteration = 0; PLBBP.ModificateStartWeights(PCT, ModificateStartWeights); if (PI != null && PI.PV != null) { PI.PV.DisplayPerceptronModel(null); // display perceptron model } } } }
void Update() { if (PCT != null && Learn) { PLBRG.Learn(PCT); } PerceptronInterface PI = gameObject.GetComponent <PerceptronInterface>(); if (PI != null) { if (PI.Reload) { PLBRG.Reset(); } } }
private PerceptronInterface PI; //Perceptron interface void Start() { //Find cow control ENC = gameObject.GetComponent <EnemyController>(); //Hiden layers and neurons int[] Layers = new int[2]; Layers[0] = 9; Layers[1] = 9; //Create perceptron EnemyPCT.CreatePerceptron(1, false, true, 5, Layers, 2); //Add perceptron interface to game object & add perceptron to interface PI = gameObject.AddComponent <PerceptronInterface>(); PI.PCT = EnemyPCT; }
private PerceptronInterface PI; //Perceptron interface void Start() { //Find cow control THC = gameObject.GetComponent <TutorialCowControl>(); //Hiden layers and neurons int[] Layers = new int[2]; Layers[0] = 9; Layers[1] = 9; //Create perceptron PCT.CreatePerceptron(1, false, true, 4, Layers, 3); //Add perceptron interface to game object & add perceptron to interface PI = gameObject.AddComponent <PerceptronInterface>(); PI.PCT = PCT; }
void Window(int ID) // interface window { if (WindowRect.height == 80) // small window { if (GUI.Button(new Rect(WindowRect.width - 20, 0, 20, 20), "+")) // change window scale { WindowRect.width = 400; WindowRect.height = 230; WindowRect.x = WindowRect.x - 200; } Learn = IGUI.Button(1, 2, "Learn OFF", "Learn ON", Learn); // start learn } else // big window { if (GUI.Button(new Rect(WindowRect.width - 20, 0, 20, 20), "-")) // change window scale { WindowRect.width = 200; WindowRect.height = 80; WindowRect.x = WindowRect.x + 200; } if (Learn) { GUI.enabled = false; } bool Temp = false; ModificateStartWeights = IGUI.Button(1, 2, "Weights from -0.5 to 0.5", "Mod Weights", ModificateStartWeights, ref Temp); if (Temp) { PLBBP.ModificateStartWeights(PCT, ModificateStartWeights); PerceptronInterface PI = gameObject.GetComponent <PerceptronInterface>(); if (PI != null) { if (PI.ShowVisualization) { PI.PV.DisplayPerceptronModel(null); } } } PLBBP.ShuffleSamples = IGUI.Button(1, 3, "Samples one by one", "Shuffle samples", PLBBP.ShuffleSamples); GUI.enabled = true; if (Learn && Task == null) { GUI.enabled = false; } PLBBP.LearningSpeed = (int)IGUI.HorizontalSlider(1, 4, "Learning speed", PLBBP.LearningSpeed, 1, 1800); GUI.enabled = true; PLBBP.LearningRate = IGUI.HorizontalSlider(1, 5, "Learning rate", PLBBP.LearningRate, 0, 1); if (Learn && Task == null) { GUI.enabled = false; } PLBBP.DesiredMaxError = IGUI.HorizontalSlider(1, 6, "Desired max error", PLBBP.DesiredMaxError, 0, 1); GUI.enabled = true; Learn = IGUI.Button(1, 7, "Learn OFF", "Learn ON", Learn); // start learn IGUI.Info(2, 2, "Iteration", PLBBP.LearnIteration); if (Task != null) { IGUI.Info(2, 3, "Max error", PLBBP.MaxError); } } if (WindowRect.x < 0) //window restriction on the screen { WindowRect.x = 0; } else if (WindowRect.x + WindowRect.width > Screen.width) { WindowRect.x = Screen.width - WindowRect.width; } if (WindowRect.y < 0) { WindowRect.y = 0; } else if (WindowRect.y + WindowRect.height > Screen.height) { WindowRect.y = Screen.height - WindowRect.height; } GUI.DragWindow(new Rect(0, 0, WindowRect.width, 20)); }