[mlpack-git] [mlpack/mlpack] NeuralEvolution - implemented gene, genome (#686)

Marcus Edel notifications at github.com
Sat Jul 2 19:34:59 EDT 2016


> +    double totalAverageRank = std::accumulate(speciesAverageRank.begin(), speciesAverageRank.end(), 0);
> +
> +    for (ssize_t i=0; i<population.aSpecies.size(); ++i) {
> +      double weak = (std::floor(speciesAverageRank[i] * population.PopulationSize() / totalAverageRank)
> +                    > 1);
> +      if (weak) {
> +        population.RemoveSpecies(i);
> +      }
> +    }
> +  }
> +
> +  // Remove empty species.
> +  void RemoveEmptySpecies(Population& population) {
> +    for (ssize_t i=0; i<population.aSpecies.size(); ++i) {
> +      if (population.aSpecies[i].aGenomes.size() == 0) {
> +        population.aSpecies.erase(population.aSpecies.begin() + i);

I would go with the extra ``RemoveSpecies``function.

---
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/554a279b0089e4385dfb40077e578d6ae2a42ece#r69383738
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160702/752f48d4/attachment.html>


More information about the mlpack-git mailing list