Пример #1
0
 public Run(ProtoRun protoRun, ProtoChromosome protoChrom, string symbol, DateTime startDate, DateTime endDate, double validationPct)
     : base(protoRun.Database)
 {
     ProtoChromosome = protoChrom;
     ProtoRun        = protoRun;
     Symbol          = symbol;
     StartDate       = startDate;
     EndDate         = endDate;
     ValidationPct   = validationPct;
     Database.Store(this);
 }
Пример #2
0
        public static Run Evolve(ProtoRun protoRun, IGenTrainer trainer, DataSet trainingSet, DataSet validationSet,
                                 string symbol = null, DateTime startDate = default(DateTime), DateTime endDate = default(DateTime), double validationPct = 0,
                                 Action <int, int, int> onGenerationProgress = null,
                                 Action <Generation> onGenerationComplete    = null)
        {
            var run = new Run(protoRun, protoRun.ProtoChromosome, null, startDate, endDate, validationPct);
            var gen = Initialization.MakeInitialGeneration(trainingSet, run, trainer);

            while (true)
            {
                var evaluated = Evaluate(gen, validationSet);
                onGenerationComplete(gen);
                if (gen.Order == protoRun.NumGenerations - 1)
                {
                    return(run);
                }

                gen = Train(trainer, trainingSet, run, gen.Order + 1, onGenerationProgress,
                            Mutate(run,
                                   Combine(protoRun.MixturesPerGeneration,
                                           Select(protoRun.SelectionSize,
                                                  evaluated))));
            }
        }
Пример #3
0
 public Run(ProtoRun protoRun, ProtoChromosome protoChrom)
     : this(protoRun, protoChrom, null, DateTime.MinValue, DateTime.MinValue, 0)
 {
 }