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)); }); }
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)); } } }
void Train(TrainRequest req, Func <bool> cancelled) { TrainerCommon.Train(Database, new ObjectId(req.MixtureId), TrainingSet, req.Chromosome, cancelled); }
void Handle(TrainRequest req) { TrainerCommon.Train(Database, new ObjectId(req.MixtureId), TrainingSet, req.Chromosome); }