Validate() public method

public Validate ( ) : void
return void
コード例 #1
0
 public void Validate_IfQuadraticRegularizationNegative_Throw()
 {
     const double bad = -0.1;
     var trainer = new SimpleGradientTrainer { LearningRate = 0.1, NumEpochs = 100, QuadraticRegularization = bad };
     Action action = () => trainer.Validate();
     action.ShouldThrow<NeuralNetworkException>()
         .WithMessage($"*Property QuadraticRegularization cannot be negative; was {bad}*");
 }
コード例 #2
0
 public void Validate_IfNumEpochsIsNotPositive_Throw(int badNumEpochs)
 {
     var trainer = new SimpleGradientTrainer { LearningRate = 0.1, NumEpochs = badNumEpochs };
     Action action = () => trainer.Validate();
     action.ShouldThrow<NeuralNetworkException>()
         .WithMessage($"*Property NumEpochs must be positive; was {badNumEpochs}*");
 }
コード例 #3
0
 public void Validate_IfLearningRateNotPositive_Throw(double badLearnignRate)
 {
     var trainer = new SimpleGradientTrainer { LearningRate = badLearnignRate, NumEpochs = 100 };
     Action action = () => trainer.Validate();
     action.ShouldThrow<NeuralNetworkException>()
         .WithMessage($"*Property LearningRate must be positive; was {badLearnignRate}*");
 }
コード例 #4
0
 public void Validate_IfMomentumNegative_Throw()
 {
     const double badMomentum = -0.2;
     var trainer = new SimpleGradientTrainer { LearningRate = 0.1, NumEpochs = 100, Momentum = badMomentum };
     Action action = () => trainer.Validate();
     action.ShouldThrow<NeuralNetworkException>()
         .WithMessage($"*Property Momentum cannot be negative; was {badMomentum}*");
 }
コード例 #5
0
 public void Validate_IfValid_ShouldDoNothing()
 {
     var config = new SimpleGradientTrainer { LearningRate = 0.1, NumEpochs = 100 };
     config.Validate();
 }