Пример #1
0
        public void SetUp()
        {
            _trainingPatterns = new List <TrainingPattern>
            {
                new TrainingPattern(new [] { -1d, -1d }, new [] { -1d }),
                new TrainingPattern(new [] { -1d, 1d }, new [] { 1d }),
                new TrainingPattern(new [] { 1d, -1d }, new [] { 1d }),
                new TrainingPattern(new [] { 1d, 1d }, new [] { -1d }),
            };

            _errorBackPropagationTraining = XOrSetUp.SetUpXOrTrainingSingleFold <HyperbolicTangentUnitActivationTraining>(bias: Math.E, learningRate: 0.1d);
        }
        public void SetUp()
        {
            _trainingPatterns = new List <TrainingPattern>
            {
                new TrainingPattern(new [] { 0d, 0d }, new [] { 0d }),
                new TrainingPattern(new [] { 1d, 0d }, new [] { 1d }),
                new TrainingPattern(new [] { 0d, 1d }, new [] { 1d }),
                new TrainingPattern(new [] { 1d, 1d }, new [] { 0d }),
            };

            _errorBackPropagationTraining = XOrSetUp.SetUpXOrTrainingSingleFold <SigmoidUnitActivationTraining>(bias: 0.5d, batch: true);
        }
        public void SetUp()
        {
            _trainingPatterns = new List <TrainingPattern>
            {
                new TrainingPattern(new [] { -1d, -1d }, new [] { -1d }),
                new TrainingPattern(new [] { -1d, 1d }, new [] { 1d }),
                new TrainingPattern(new [] { 1d, -1d }, new [] { 1d }),
                new TrainingPattern(new [] { 1d, 1d }, new [] { -1d }),
            };

            _errorBackPropagationTraining = XOrSetUp.SetUpXOrTrainingSingleFold <BipolarUnitActivationTraining>(bias: 1d);
        }
Пример #4
0
        public async Task SolvesXOrWithSolvesXOrWithSlopedMultiplier()
        {
            var errorBackPropagationTraining = XOrSetUp.SetUpXOrTrainingSingleFold <SigmoidUnitActivationTraining>(learningRate: 0.5d, bias: 0.5d, slopeMultiplier: 2d);

            var perceptron = await errorBackPropagationTraining.TrainAsync(_trainingPatterns, errorMax : 0.1d, maxEpochs : 50000);

            foreach (var trainingPattern in _trainingPatterns)
            {
                var xorResult = await perceptron.FireAsync(trainingPattern.InputValues);

                xorResult.First().Should().BeApproximately(trainingPattern.IdealActivations.First(), 0.1d);
            }
        }
        public void SetUp()
        {
            _trainingPatterns = new List <TrainingPattern>
            {
                new TrainingPattern(new [] { 0d, 0d }, new [] { 0d }),
                new TrainingPattern(new [] { 1d, 0d }, new [] { 1d }),
                new TrainingPattern(new [] { 0d, 1d }, new [] { 1d }),
                new TrainingPattern(new [] { 1d, 1d }, new [] { 0d }),
            };

            var inventoryAndChaining = new ErrorBackPropagationBuilder()
                                       .With.ANewLayerOfInputUnits(2)
                                       .ConnectedTo.ANewLayerOfHiddenUnits(3).With.UnitActivation <SigmoidUnitActivationTraining>()
                                       .ConnectedTo.ANewLayerOfOutputUnits(1).With.OutputUnitActivation <ReluUnitActivationTraining>();

            _errorBackPropagationTraining = XOrSetUp.SetUpXOrTraining(inventoryAndChaining, learningRate: 0.8d);
        }