public static NeuronLayer Make(XmlNode layerNode) { var layer = new NeuronLayer(); foreach (XmlNode neuronNode in layerNode.SelectNodes("Neuron")) { layer.AddSingleNeuron(new Neuron(Convert.ToInt32(neuronNode.Attributes["id"].Value))); } XmlNode tresholdNeuron = layerNode.SelectSingleNode("TresholdNeuron"); layer.AddSingleNeuron(new TresholdNeuron(Convert.ToInt32(tresholdNeuron.Attributes["id"].Value))); return layer; }
public static NeuronLayer Make(int count) { var layer = new NeuronLayer(); layer.AddNeurons(count); return layer; }
private void AssignLayers(XmlDocument doc) { _layers.Clear(); _inputLayer = null; _outputLayer = null; foreach (XmlNode layerNode in doc.SelectNodes("/NeuronNetwork/Layers/NeuronLayer")) { var layer = NeuronLayer.Make(layerNode); if (null == _inputLayer) _inputLayer = layer; _layers.Add(layer); } }
private void LoadFromXmlFile(XmlDocument doc) { _layers.Clear(); _inputLayer = null; _outputLayer = null; try { InitializeFromXml(doc); AssignLayers(doc); AssignOutputLayer(doc); AssignSynapses(doc); } catch { Filename = ""; _layers.Clear(); _inputLayer = null; _outputLayer = null; throw; } }
public void Connect(NeuronLayer neuronLayer) { neuronLayer.Neurons.ToList().ForEach(n => _synapses.Add(new Synapse(this, n))); }