///<summary> /// Process data ///</summary> public List <double> Run(List <double> input) { if (input.Count != this.Layers[0].Neurons.Count) { throw new ArgumentOutOfRangeException("Number of inputs must match the number of neurons on in the input layer"); } for (int l = 0; l < Layers.Count; l++) { Layer layer = Layers[l]; for (int n = 0; n < layer.Neurons.Count; n++) { Neuron neuron = layer.Neurons[n]; if (l == 0) { neuron.Value = input[n]; } else { neuron.Value = 0; for (int np = 0; np < this.Layers[l - 1].Neurons.Count; np++) { neuron.Value = neuron.Value + Layers[l - 1].Neurons[np].Value * neuron.Dendrites[np].Weight; } neuron.Value = SigmoidFunction.logistic(neuron.Value + neuron.Bias); } } } Layer outputLayer = Layers[Layers.Count - 1]; int numOfOutputs = outputLayer.Neurons.Count; List <double> output = new List <double>(numOfOutputs); foreach (Neuron neuron in outputLayer.Neurons) { output.Add(neuron.Value); } return(output); }