// Start is called before the first frame update void Start() { int[] hiddens = { 100, 100, 100, 100, 100, 100, 100 }; nn = new MutatableNeuralNetwork(2, hiddens, 1, 0.2f, NeuralNetwork.NetworkType.Supervised); float[] input1 = { 0, 0 }; float[] target1 = { 0.1f }; float[] input2 = { 1, 1 }; float[] target2 = { 0.1f }; float[] input3 = { 1, 0 }; float[] target3 = { 0.9f }; float[] input4 = { 0, 1 }; float[] target4 = { 0.9f }; float[][] inputs = { input1, input2, input3, input4 }; float[][] targets = { target1, target2, target3, target4 }; //int[] hiddens = { 2 }; //nn = new NeuralNetwork(2, hiddens, 1); //print(nn.WriteString()); //NeuralNetwork nn2 = new NeuralNetwork(nn.WriteString()); //print(nn2.WriteString()); //for (int i = 0; i < 10000; i++) //{ // int data = (int)Random.Range(0, 3.99999f); // nn.Train(inputs[data], targets[data]); // Random.InitState((int)System.DateTime.Now.Ticks); //} //StartCoroutine(train(60000)); }
public new MutatableNeuralNetwork Duplicate() { MutatableNeuralNetwork output = new MutatableNeuralNetwork(inputs, hiddens, outputs, LearningRate, type); for (int i = 0; i < layers.Length; i++) { output.layers[i] = layers[i].duplicate(); } for (int i = 0; i < biases.Length; i++) { output.biases[i] = biases[i].duplicate(); } output.aFunctions = (int[][])aFunctions.Clone(); return(output); }
public void updateNN(MutatableNeuralNetwork m) { nn = m; }