[mlpack-git] [mlpack/mlpack] Neural evolution algorithms implementation (CNE, NEAT, HyperNEAT) (#686)

Marcus Edel notifications at github.com
Sun Jul 17 17:25:43 EDT 2016


> +  // Sort genomes by fitness. Smaller fitness is better and put first.
> +  void SortGenomes(std::vector<Genome>& genomes) {
> +    std::sort(genomes.begin(), genomes.end(), Species::CompareGenome);
> +  }
> +
> +  // Get genome index in a genomes vector.
> +  ssize_t GetGenomeIndex(std::vector<Genome>& genomes, ssize_t id) {
> +    for (ssize_t i=0; i<genomes.size(); ++i) {
> +      if (genomes[i].Id() == id)
> +        return i;
> +    }
> +    return -1;
> +  }
> +
> +  // Calculate species' average rank in population by fitness. Bigger is better.
> +  void CalcSpeciesAverageRank(Population& population, std::vector<double>& speciesAverageRank) {

I thought it would be easier to rank the genomes, directly by the fitness value instead of checking at which position the genome is after sorting.

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/mlpack/mlpack/pull/686/files/fc982b9406838eb9697000481e816165702e8ba9#r71089856
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160717/49a4f2d4/attachment-0001.html>


More information about the mlpack-git mailing list