<p>In <a href="https://github.com/mlpack/mlpack/pull/686#discussion_r71100611">src/mlpack/methods/ne/neat.hpp</a>:</p>
<pre style='color:#555'>> + // 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) {
</pre>
<div class="email-fragment">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@github.com>:</div>
<span class="email-hidden-toggle"><a href="#">…</a></span><div class="email-hidden-reply" style="display:none">
<div class="email-quoted-reply"> In src/mlpack/methods/ne/neat.hpp
<<a href="https://github.com/mlpack/mlpack/pull/686#discussion_r71089856" class="issue-link js-issue-link" data-url="https://github.com/mlpack/mlpack/issues/686" data-id="158975273" data-error-text="Failed to load issue title" data-permission-text="Issue title is private">#686 (comment)</a>>:
> + // 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
<<a href="https://github.com/mlpack/mlpack/pull/686/files/fc982b9406838eb9697000481e816165702e8ba9#r71089856">https://github.com/mlpack/mlpack/pull/686/files/fc982b9406838eb9697000481e816165702e8ba9#r71089856</a>>,
or mute the thread
<<a href="https://github.com/notifications/unsubscribe-auth/AD9tIW74f1sPpqVfwNsFlmqZzVJ1A1Niks5qWp3VgaJpZM4IwJa6">https://github.com/notifications/unsubscribe-auth/AD9tIW74f1sPpqVfwNsFlmqZzVJ1A1Niks5qWp3VgaJpZM4IwJa6</a>>
.
</div>
<div class="email-fragment"></div>
</div>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/mlpack/mlpack/pull/686/files/fc982b9406838eb9697000481e816165702e8ba9#r71100611">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AJ4bFO2-eGFrDYL3th_tEn-SPKJWdV12ks5qWwh7gaJpZM4IwJa6">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFAPwl9PCAns-rEeECEcCmyiaDxIQks5qWwh7gaJpZM4IwJa6.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
<link itemprop="url" href="https://github.com/mlpack/mlpack/pull/686/files/fc982b9406838eb9697000481e816165702e8ba9#r71100611"></link>
<meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>