public static Network CopyNetwork(Network original) { Network ret = new Network(original.Transform); original.UpdateIndices(); //Creating Neurons for (int i = 0; i < original.Inputs.Count; i++) { ret.CreatePerceptron(original.Inputs[i].Transform); } for (int i = 0; i < original.Body.Count; i++) { ret.CreateNeuron(original.Body[i].Threshhold, original.Body[i].Transform); } for (int i = 0; i < original.Outputs.Count; i++) { ret.CreateConsolidator(original.Outputs[i].Transform); } //Creating connections for(int i = 0; i < ret.Neurons.Count; i++) { Neuron orig = original.Neurons[i]; Neuron inp = ret.Neurons[i]; for(int j = 0; j < orig.Outputs.Count; j++) { Neuron outp = ret.Neurons[orig.Outputs[j].Output.GlobIndex]; ret.CreateDendron(inp, outp, orig.Outputs[j].Factor); } } return ret; }
private static Network DefaultNetwork(Network n, int numInputs, int numOutputs) { for (int i = 0; i < numInputs; i++) { n.CreatePerceptron(); } for (int i = 0; i < numOutputs; i++) { n.CreateConsolidator(); } for (int i = 0; i < numInputs; i++) { for (int j = 0; j < numOutputs; j++) { n.CreateDendron(n.Inputs[i], n.Outputs[j], 1); } } return n; }