public void LoadGenome(Genome genome) { this.genome = genome; for (var i = 0; i < genome.NumInputNeurons; i++) { InputNeurons.Add(new Neuron("input" + i)); } var weightIndex = 0; var previousLayer = new List <Neuron>(); for (var layerId = 0; layerId < genome.NumHiddenLayers; layerId++) { var hiddenLayer = new List <Neuron>(); previousLayer = GetPreviousLayer(layerId); SetupLayer(hiddenLayer, genome.NumNeuronsPerHiddenLayer, previousLayer, "hl" + layerId + "n", ref weightIndex, genome); hiddenLayers.Add(hiddenLayer); } previousLayer = hiddenLayers[hiddenLayers.Count - 1]; SetupLayer(OutputNeurons, genome.NumOutputNeurons, previousLayer, "output", ref weightIndex, genome); }
public void AddInputNeuronAndMesh(InputNeuron neuron) { InputNeurons.Add(neuron); foreach (WorkingNeuron wn in FirstHiddenLayer) { wn.AddNeuronConnection(new Connection(neuron, 0)); } }
private void Initialize(int inputs, int outputs) { var random = new Random(); for (int i = 0; i < inputs; i++) { InputNeurons.Add(new Neuron()); } for (int i = 0; i < outputs; i++) { var dentrites = new List <Synapse>(); foreach (var input in InputNeurons) { dentrites.Add(new Synapse() { Neuron = input, Weight = (random.NextDouble() - 0.5) * 0.01 }); } OutputNeurons.Add(new Neuron() { Dendrites = dentrites }); } }
public void AddInputNeuron(InputNeuron neuron) { InputNeurons.Add(neuron); }