Esempio n. 1
0
        /// <summary>
        /// Calculate output value of the neuron.
        /// </summary>
        /// <returns>
        /// Output of the neuron.
        /// </returns>
        public double CalculateOutput()
        {
            double inputSum = 0;

            foreach (var synapse in this.Inputs)
            {
                inputSum += synapse.Weight * synapse.Output;
            }

            // Scale the output
            return(_activationFunction.CalculateOutput(inputSum));
        }
Esempio n. 2
0
        public override double Compute()
        {
            double sum = 0;

            if ((Inputs == null) || (Inputs.Count == 0))
            {
                throw new ArgumentException();
            }
            Inputs.ForEach(Synapse => {
                sum += Synapse.Weight * Synapse.InputValue;
            });
            OutputValue = ActFunction.CalculateOutput(sum);
            return(OutputValue);
        }
Esempio n. 3
0
    /// <summary>
    /// Connect two neurons.
    /// This neuron is the input neuron of the connection.
    /// </summary>
    /// <param name="outputNeuron">Neuron that will be output neuron of the newly created connection.
    /// </param>
    //public void AddOutputNeuron(INeuron outputNeuron)
    //{
    //    var synapse = new Synapse(this, outputNeuron, _weight);
    //    Outputs.Add(synapse);
    //    outputNeuron.Inputs.Add(synapse);
    //}

    /// <summary>
    /// Calculate output value of the neuron.
    /// </summary>
    /// <returns>
    /// Output of the neuron.
    /// </returns>
    public double CalculateOutput()
    {
        return(_activationFunction.CalculateOutput(_inputFunction.CalculateInput(this.Inputs)));
    }
Esempio n. 4
0
 public virtual double CalculateOutput()
 {
     //apply activation
     return(activationFunction.CalculateOutput(inputFunction.CalculateInput(Inputs)));
 }