Example #1
0
        public void Train(DataSet data, Generation gen, IEnumerable <MixtureInfo> population, Action <TrainProgress> progress)
        {
            var total      = population.Count() * population.First().Chromosomes.Length;
            var numTrained = 0;
            var q          = population.SelectMany(mixture => mixture.Chromosomes.Select(chrom => new { mixture, chrom })).ToList();

            Parallel.ForEach(q, GetParallelOptions(), z => {
                TrainerCommon.Train(gen.Database, z.mixture.MixtureId, data, z.chrom);
                numTrained++;
                progress(new TrainProgress(numTrained, total));
            });
        }
Example #2
0
        public void Train(DataSet data, Generation gen, IEnumerable <MixtureInfo> population, Action <TrainProgress> progress)
        {
            var total      = population.Count() * population.First().Chromosomes.Length;
            var numTrained = 0;

            foreach (var mi in population)
            {
                foreach (var chrom in mi.Chromosomes)
                {
                    TrainerCommon.Train(gen.Database, mi.MixtureId, data, chrom);
                    numTrained++;
                    progress(new TrainProgress(numTrained, total));
                }
            }
        }
Example #3
0
 void Train(TrainRequest req, Func <bool> cancelled)
 {
     TrainerCommon.Train(Database, new ObjectId(req.MixtureId), TrainingSet, req.Chromosome, cancelled);
 }
Example #4
0
 void Handle(TrainRequest req)
 {
     TrainerCommon.Train(Database, new ObjectId(req.MixtureId), TrainingSet, req.Chromosome);
 }