/// <summary>
        /// Calculates the Outputs for all Neurons in the Layer given the Input.
        /// Notes:
        ///     -float[Neuron Output]
        /// </summary>
        /// <param name="passedInput">The Input for all Neurons in the Layer.</param>
        /// <returns>The Outputs of all Neurons in the Layer.</returns>
        public INeuronOutputs CalculateLayerOutput(INeuronInputs passedInput)
        {
            IList <INeuronOutput> outputs = new List <INeuronOutput>((int)this.NumberOfNeurons);

            for (int i = 0; i < this._Neurons.Count; i++)
            {
                INeuron       neuron       = this._Neurons[i];
                INeuronOutput neuronOutput = neuron.CalculateOutput(passedInput);
                outputs.Add(neuronOutput);
            }
            INeuronOutputs result = new NeuronOutputs(outputs);

            return(result);
        }
Exemplo n.º 2
0
        public INeuronOutput CalculateOutput(INeuronInputs passedInputs)
        {
            float total = 0.0f;

            IEnumerator <INeuronWeight> neuronWeightsEnumerator = this.Weights.Values;
            IEnumerator <INeuronInput>  neuronInputsEnumerator  = passedInputs.Values;

            while (neuronWeightsEnumerator.MoveNext() && neuronInputsEnumerator.MoveNext())
            {
                INeuronWeight currentWeight = neuronWeightsEnumerator.Current;
                INeuronInput  currentInput  = neuronInputsEnumerator.Current;
                float         tempValue     = currentWeight.Value * currentInput.Value;
                total += tempValue;
            }

            INeuronActivationFunctionInput neuronActivationInput = new NeuronActivationFunctionInput(total);
            INeuronOutput result = this.ActivationFunction.CalculateOutput(neuronActivationInput, this.Threshold);

            return(result);
        }