<p>In <a href="https://github.com/mlpack/mlpack/pull/686#discussion_r66129966">src/mlpack/methods/ne/genome.hpp</a>:</p>
<pre style='color:#555'>&gt; +    // Construct neuron id: index dictionary.
&gt; +    std::map&lt;unsigned int, unsigned int&gt; neuronIdToIndex;
&gt; +    for (unsigned int i=0; i&lt;NumNeuron(); ++i) {
&gt; +      neuronIdToIndex.insert(std::pair&lt;unsigned int, unsigned int&gt;(aNeuronGenes[i].Id(), i));
&gt; +    }
&gt; +
&gt; +    // Activate layer by layer.
&gt; +    for (unsigned int i=0; i&lt;aDepth; ++i) {
&gt; +      // Loop links to calculate neurons&#39; input sum.
&gt; +      for (unsigned int j=0; j&lt;aLinkGenes.size(); ++j) {
&gt; +        aNeuronGenes[neuronIdToIndex.at(aLinkGenes[j].ToNeuronId())].aInput +=
&gt; +          aLinkGenes[j].Weight() * aNeuronGenes[neuronIdToIndex.at(aLinkGenes[j].FromNeuronId())].aActivation;
&gt; +      }
&gt; +
&gt; +      // Loop neurons to calculate neurons&#39; activation.
&gt; +      for (unsigned in j=aNumInput; j&lt;aNeuronGenes.size(); ++j) {
</pre>
<p>maybe using same strategies used in <a href="https://github.com/mlpack/mlpack/blob/637809fec8d341829e4cd122cf5a385e5e219c9b/src/mlpack/methods/sparse_autoencoder/sparse_autoencoder_function.hpp#L74">sigmoid function in sparse_autoencoder</a> is faster?</p>

<p>Unrelated to this, I think activation functions like relu, sigmoid , etc are implemented many times. I think we can put it in core?<br>
It is also implemented in <a href="https://github.com/mlpack/mlpack/blob/d2e353468b8fce9fc1ee46799860f3860c4c8db9/src/mlpack/methods/ann/layer/base_layer.hpp">artificial neural net</a></p>

<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/3c8aa62b951f029b3883e9baef1ea556ef5af2d3#r66129966">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe/AJ4bFMpnJ_xE7w2ikSGALg29FG5aQDIcks5qJby_gaJpZM4IwJa6">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFKZRj_9SsjGMC1f99xV84sAKk826ks5qJby_gaJpZM4IwJa6.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/3c8aa62b951f029b3883e9baef1ea556ef5af2d3#r66129966"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>