Accord.Neuro.Neurons.StochasticNeuron.Generate C# (CSharp) Method

Generate() public method

Samples the neuron output considering the stochastic activation function.
public Generate ( double input ) : double
input double An input vector.
return double
        public double Generate(double[] input)
        {
            double sum = threshold;
            for (int i = 0; i < weights.Length; i++)
                sum += weights[i] * input[i];

            double output = function.Function(sum);
            double sample = function.Generate2(output);

            this.output = output;
            this.sample = sample;

            return sample;
        }