コード例 #1
0
        public void ComputeOutput(double[] inputs, IActivationFunction activationFunction)
        {
            if (inputs.Length != this.Inputs.Length)
            {
                throw new Exception("Les données d'entrées de taille " + inputs.Length + " est différent du nombre d'entrée du neurone (" + this.Inputs.Length + ")");
            }

            this.Inputs = inputs;

            // Dotproduct = inputs[] * weights[]
            double dotProduct = 0;

            foreach (double input in inputs)
            {
                foreach (double weight in Weights)
                {
                    dotProduct += input * weight;
                }
            }

            // Output = ActivationFunction(dotproduct + bias)
            Output = activationFunction.F(dotProduct + Bias);
        }