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

 &gt; +  // Sort genomes by fitness. Smaller fitness is better and put first.
 &gt; +  void SortGenomes(std::vector&lt;Genome&gt;&amp; genomes) {
 &gt; +    std::sort(genomes.begin(), genomes.end(), Species::CompareGenome);
 &gt; +  }
 &gt; +
 &gt; +  // Get genome index in a genomes vector.
 &gt; +  ssize_t GetGenomeIndex(std::vector&lt;Genome&gt;&amp; genomes, ssize_t id) {
 &gt; +    for (ssize_t i=0; i&lt;genomes.size(); ++i) {
 &gt; +      if (genomes[i].Id() == id)
 &gt; +        return i;
 &gt; +    }
 &gt; +    return -1;
 &gt; +  }
 &gt; +
 &gt; +  // Calculate species' average rank in population by fitness. Bigger is better.
 &gt; +  void CalcSpeciesAverageRank(Population&amp; population, std::vector&lt;double&gt;&amp; 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
 &lt;<a href="https://github.com/mlpack/mlpack/pull/686/files/fc982b9406838eb9697000481e816165702e8ba9#r71089856">https://github.com/mlpack/mlpack/pull/686/files/fc982b9406838eb9697000481e816165702e8ba9#r71089856</a>&gt;,
 or mute the thread
 &lt;<a href="https://github.com/notifications/unsubscribe-auth/AD9tIW74f1sPpqVfwNsFlmqZzVJ1A1Niks5qWp3VgaJpZM4IwJa6">https://github.com/notifications/unsubscribe-auth/AD9tIW74f1sPpqVfwNsFlmqZzVJ1A1Niks5qWp3VgaJpZM4IwJa6</a>&gt;
 .
</div>
<div class="email-fragment"></div>
</div>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<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>