[mlpack-git] [mlpack/mlpack] Neural evolution algorithms implementation (CNE, NEAT, HyperNEAT) (#686)
Excalibur
notifications at github.com
Mon Jul 18 01:00: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 am not sure, but after we sort with fitness, isn't the position is
exactly the rank of genomes?
2016-07-17 15:25 GMT-06:00 Marcus Edel <notifications at github.com>:
> In src/mlpack/methods/ne/neat.hpp
> <https://github.com/mlpack/mlpack/pull/686#discussion_r71089856>:
>
> > + // 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 commented.
> Reply to this email directly, view it on GitHub
> <https://github.com/mlpack/mlpack/pull/686/files/fc982b9406838eb9697000481e816165702e8ba9#r71089856>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AD9tIW74f1sPpqVfwNsFlmqZzVJ1A1Niks5qWp3VgaJpZM4IwJa6>
> .
>
---
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#r71100611
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160717/69beb5a9/attachment.html>
More information about the mlpack-git
mailing list