Exemplo n.º 1
0
        public void SetUp()
        {
            _network = new NetworkBuilder().Setup();

            _outputErrorCalculatorMock = new Mock <IOutputUnitErrorCalculator>();
            _outputErrorCalculatorMock.Setup(c => c.CalculateOutputError(IdealValue1, _network.Output1Activation, _network.Output1Derivative)).Returns(Output1ExpectedError);
            _outputErrorCalculatorMock.Setup(c => c.CalculateOutputError(IdealValue2, _network.Output2Activation, _network.Output2Derivative)).Returns(Output2ExpectedError);

            _hiddenErrorCalculatorMock = new Mock <IHiddenUnitErrorCalculator>();
            _hiddenErrorCalculatorMock.Setup(c => c.CalculateHiddenError(It.IsAny <IEnumerable <double> >(), It.IsAny <IEnumerable <double> >(), _network.Hidden1Activation, _network.Hidden1Derivative)).Returns(Hidden1ExpectedError);
            _hiddenErrorCalculatorMock.Setup(c => c.CalculateHiddenError(It.IsAny <IEnumerable <double> >(), It.IsAny <IEnumerable <double> >(), _network.Hidden2Activation, _network.Hidden2Derivative)).Returns(Hidden2ExpectedError);

            _backPropagator = new ErrorValueBackPropagator(_network.GetNetwork(), _outputErrorCalculatorMock.Object, _hiddenErrorCalculatorMock.Object);

            _outputUnits = _network.GetOutputs();
            _hiddenUnits = _network.GetHidden();

            _idealValues = new List <double> {
                IdealValue1, IdealValue2
            };
        }
Exemplo n.º 2
0
 public void SetUp()
 {
     _network = new NetworkBuilder().Setup();
     _weightChangeApplierMock = new Mock <IWeightChangeApplier>();
     _calculator = new WeightChangeCalculator(0.1);
     _weightChangeBackPropagator = new WeightChangeBackPropagator(_weightChangeApplierMock.Object, _network.GetNetwork(), learningRate: 0.1);
 }
Exemplo n.º 3
0
 public void SetUp()
 {
     _weightSetterMock  = new Mock <IWeightSetter>();
     _network           = new NetworkBuilder().Setup();
     _weightInitializer = new WeightInitializer(_network.GetNetwork(), weightSetter: _weightSetterMock.Object);
 }
Exemplo n.º 4
0
 public void SetUp()
 {
     _networkBuilder = new NetworkBuilder().Setup();
     _network        = _networkBuilder.GetNetwork();
 }