Пример #1
0
        public static string MakeUntilDoneGradientTrainer(
            [ExcelArgument(Description = "Name of trainer object to create.")] string name,
            [ExcelArgument(Description = "Maximum number of backpropagation steps to run. " +
                                         "Each step may be on-line or a batch step.")] int numEpochs,
            [ExcelArgument(Description = "Impact of each backpropagation step on weight adjustment.")] double learningRate,
            [ExcelArgument(Description = "Impact of previous backpropagation stepts each step's adjustment.")] double momentum,
            [ExcelArgument(Description = "Higher numbers help with keeping weights from becoming too large.")] double quadraticRegularization,
            [ExcelArgument(Description = "Number of training samples to evaluate for each backpropagation step.")] int batchSize,
            [ExcelArgument(Description = "Portion of the training set to use as validation set to check whether " +
                                         "training has improved performance of the neural network. " +
                                         "Must be between 0 and 1.")] double validationSetFraction,
            [ExcelArgument(Description = "Training will abort after there is no error improvement on validation set after " +
                                         "this number of backpropagation steps.")] int maxEpochsWithoutImprovement,
            [ExcelArgument(Description = "Number of backpropagation steps before checking for error improvement on " +
                                         "validation set.")] int epochsBetweenValidations,
            [ExcelArgument(Description = "Seed for random number generation.")] int seed)
        {
            var config = new UntilDoneGradientTrainer
            {
                NumEpochs                   = numEpochs,
                LearningRate                = learningRate,
                Momentum                    = momentum,
                QuadraticRegularization     = quadraticRegularization,
                BatchSize                   = batchSize,
                ValidationSetFraction       = validationSetFraction,
                MaxEpochsWithoutImprovement = maxEpochsWithoutImprovement,
                EpochsBetweenValidations    = epochsBetweenValidations,
                Seed = seed,
            };

            config.Validate();

            ObjectStore.Add(name, config);
            return(name);
        }
Пример #2
0
        public void ShouldReturnValidationSetFraction()
        {
            var trainer = new UntilDoneGradientTrainer {
                ValidationSetFraction = 0.3
            };

            trainer.GetValidationSetFraction().Should().Be(0.3);
        }
Пример #3
0
 public ValidateTests()
 {
     _trainer = new UntilDoneGradientTrainer
     {
         LearningRate                = 0.1,
         NumEpochs                   = 100,
         ValidationSetFraction       = 0.3,
         MaxEpochsWithoutImprovement = 10,
     };
 }
Пример #4
0
        private static UntilDoneGradientTrainer GetTrainer()
        {
            var trainer = new UntilDoneGradientTrainer
            {
                LearningRate                = 0.5,
                Momentum                    = 2,
                NumEpochs                   = 1,
                QuadraticRegularization     = 0.1,
                ShouldInitializeWeights     = false,
                MaxEpochsWithoutImprovement = 100,
                ValidationSetFraction       = 0.5
            };

            return(trainer);
        }