private List <Chromosome> GetBestModelsInList(int numberOfBestChromosomes) { EvaluateModels(); return(Chromosomes.OrderByDescending(chromosome => chromosome.Metrics.MicroAccuracy) .ThenByDescending(chromosome => chromosome.Metrics.MacroAccuracy) .Take(numberOfBestChromosomes).ToList()); }
/// <summary> /// Ends the generation. /// </summary> /// <param name="chromosomesNumber">Chromosomes number to keep on generation.</param> public void End(int chromosomesNumber) { Chromosomes = Chromosomes.OrderByDescending(c => c.Fitness.Value).ToList(); if (Chromosomes.Count > chromosomesNumber) { Chromosomes = Chromosomes.Take(chromosomesNumber).ToList(); } ElectBestChromosome(); }
// TODO -> This should not be like this public void SortByFitness() { Chromosomes = Chromosomes.OrderByDescending(c => c.Fitness).ToArray(); }
private Chromosome GetBestModelInList() { EvaluateModels(); return(Chromosomes.OrderByDescending(chromosome => chromosome.Metrics.MicroAccuracy).ThenByDescending(chromosome => chromosome.Metrics.MicroAccuracy).ToList().First()); }