public virtual double[] Compute(double[] input, SigmoidFunction function) { for (int i = 0; i < neurons.Length; i++) { this.output[i] = neurons[i].Compute(input, function); } return(output); }
public ActivationNetwork(SigmoidFunction function, int inputsCount, params int[] neuronsCount) { ActivationFunction = function; InputsCount = Math.Max(1, inputsCount); Layers = new ActivationLayer[neuronsCount.Length]; // create each layer for (int i = 0; i < Layers.Length; i++) { Layers[i] = new ActivationLayer(neuronsCount[i], (i == 0) ? inputsCount : neuronsCount[i - 1]); } }
public double Compute(double[] input, SigmoidFunction function) { if (input.Length != inputsCount) { throw new ArgumentException("Wrong length of the input vector."); } double sum = 0.0; for (int i = 0; i < weights.Length; i++) { sum += weights[i] * input[i]; } sum += threshold; double output = function.Function(sum); this.output = output; return(output); }