public void AddLayer(NeuralLayer layer) { var dendriteCount = 1; if (Layers.Count > 0) { dendriteCount = Layers.Last().Neurons.Count; } foreach (var neuron in layer.Neurons) { for (var i = 0; i < dendriteCount; i++) { neuron.Dendrites.Add(new Dendrite()); } } }
public void CreateNetwork(NeuralLayer connectingFrom, NeuralLayer connectingTo) { foreach (var from in connectingTo.Neurons) { from.Dendrites.Add(new Dendrite()); } foreach (var to in connectingTo.Neurons) { foreach (var from in connectingFrom.Neurons) { to.Dendrites.Add(new Dendrite() { InputPulse = from.OutputPulse, SynapticWeight = connectingTo.Weight }); } } }