示例#1
0
        public void return_0_as_error_if_it_is_between_the_acceptance_matcher_limits()
        {
            var neuralNetwork = new NeuralNetworkBuilder(new ConnectionProperties(_weightGenerator),
                                                         new PerceptronProperties(_thresholdGenerator),
                                                         new AcceptanceMatcher(-0.049, 0.049))
                                                        .WithLayer(1).From(1).To(1)
                                                        .Build();

            neuralNetwork.ExitValues = new ValueList<double> { 2.049 };
            neuralNetwork.ExpectedExitValues = new ValueList<double> { 2 };

            neuralNetwork.GetErrorForExit(1).Should().Be(0.0);
        }
示例#2
0
        public void return_correct_error_value_for_an_exit_with_an_associated_expected_value()
        {
            var neuralNetwork = new NeuralNetworkBuilder(new ConnectionProperties(_weightGenerator),
                                                         new PerceptronProperties(_thresholdGenerator),
                                                         new AcceptanceMatcher(0.0, 0.0))
                                                        .WithLayer(1).From(1).To(1)
                                                        .Build();

            neuralNetwork.EntryValues = new ValueList<double> { 1.0 };
            neuralNetwork.ExitValues = new ValueList<double> { 0.5 };
            neuralNetwork.ExpectedExitValues = new ValueList<double> { 0.8 };

            neuralNetwork.GetErrorForExit(1).Should().BeApproximately(-0.30000000, 0.00000001);
        }