public Vector Run(Vector input)
 {
     CheckInput(input, InputNeurons);
     InputNeurons  = input;
     OutputNeurons = Activation.Func(Weights * InputNeurons + Bias);
     return(OutputNeurons);
 }
        public (Vector output, Vector error) Learn(Vector input, Vector ideal)
        {
            CheckIdealVector(ideal, OutputNeurons);
            var actual = Run(input);
            var error  = new Vector(actual.Length);

            for (var i = 0; i < ideal.Length; i++)
            {
                ideal[i] = Activation.Func(ideal[i]);
                error[i] = GetError(actual[i], ideal[i]);
            }
            LearnWithBackPropagationError(actual, ideal);
            SetNextEpoch();
            return(actual, error);
        }
예제 #3
0
 /// <summary>
 /// Calculates the output vector of the neural network
 /// </summary>
 public Vector Run(Vector input)
 {
     InitializeNeuronsWithInput(input);
     for (var i = 0; i < Neurons.Length - 1; i++)
     {
         for (int j = 0; j < Neurons[i + 1].Length; j++)
         {
             for (int k = 0; k < Neurons[i].Length; k++)
             {
                 Neurons[i + 1][j] += Weights[i][j][k] * Neurons[i][k];
             }
             Neurons[i + 1][j] = Activation.Func(Neurons[i + 1][j]);
         }
     }
     return(Neurons.Last());
 }