Exemple #1
0
        public double[] Predict(double[] input)
        {
            // Making matrix from input
            var inputs = Matrix <double> .Build.Dense(input.Length, 1, (i, j) => input[i]);

            // Adding Weights between Input and Hidden layer
            var hidden = _weightsInHidden.Multiply(inputs);

            // Adding Hidden layer Bias
            hidden.Add(_biasHidden, hidden);
            // Activation Function
            hidden.MapInplace(val => _activation.Activasion(val));

            // Adding Weights between Hidden and Output layer
            var output = _weightsHiddenOut.Multiply(hidden);

            // Adding Output layer Bias
            output.Add(_biasOut, output);
            // Activation Function
            output.MapInplace(val => _activation.Activasion(val));

            return(output.ToRowMajorArray());
        }