Пример #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 IfValid_ShouldDoNothing()
 {
     _trainer.Validate();
 }