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

Excalibur notifications at github.com
Sat Jul 16 13:09:42 EDT 2016


> +          return;
> +        }
> +      }
> +    }
> +
> +    Species newSpecies = Species();
> +    newSpecies.AddGenome(genome);
> +    newSpecies.StaleAge(0);
> +    population.AddSpecies(newSpecies);
> +  }
> +
> +  // Remove stale species.
> +  void RemoveStaleSpecies(Population& population) {
> +    for (ssize_t i=0; i<population.aSpecies.size(); ++i) {
> +      if (population.aSpecies[i].StaleAge() > aStaleAgeThreshold) {
> +        population.RemoveSpecies(i);

Good point! thanks, I revised it.

2016-07-16 10:37 GMT-06:00 Marcus Edel <notifications at github.com>:

> In src/mlpack/methods/ne/neat.hpp
> <https://github.com/mlpack/mlpack/pull/686#discussion_r71068544>:
>
> > +          return;
> > +        }
> > +      }
> > +    }
> > +
> > +    Species newSpecies = Species();
> > +    newSpecies.AddGenome(genome);
> > +    newSpecies.StaleAge(0);
> > +    population.AddSpecies(newSpecies);
> > +  }
> > +
> > +  // Remove stale species.
> > +  void RemoveStaleSpecies(Population& population) {
> > +    for (ssize_t i=0; i<population.aSpecies.size(); ++i) {
> > +      if (population.aSpecies[i].StaleAge() > aStaleAgeThreshold) {
> > +        population.RemoveSpecies(i);
>
> This function could cause an error, because we can't increase i if we
> remove a species:
>
>   void RemoveStaleSpecies(Population& population)
>   {
>     for (std::vector<Species>::iterator it = population.aSpecies.begin();
>          it != population.aSpecies.end();  /*it++*/)
>     {
>       if(it->StaleAge() > aStaleAgeThreshold)
>       {
>         it = population.aSpecies.erase(it);
>       }
>       else
>       {
>         ++it;
>       }
>     }
>   }
>
>> 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#r71068544>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AD9tIQHO4X-7mxkbwLr5WVcK7vE870Wqks5qWQjdgaJpZM4IwJa6>
> .
>


---
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#r71068967
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160716/a2704f5c/attachment.html>


More information about the mlpack-git mailing list