<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'>> + // Construct neuron id: index dictionary.
> + std::map<unsigned int, unsigned int> neuronIdToIndex;
> + for (unsigned int i=0; i<NumNeuron(); ++i) {
> + neuronIdToIndex.insert(std::pair<unsigned int, unsigned int>(aNeuronGenes[i].Id(), i));
> + }
> +
> + // Activate layer by layer.
> + for (unsigned int i=0; i<aDepth; ++i) {
> + // Loop links to calculate neurons' input sum.
> + for (unsigned int j=0; j<aLinkGenes.size(); ++j) {
> + aNeuronGenes[neuronIdToIndex.at(aLinkGenes[j].ToNeuronId())].aInput +=
> + aLinkGenes[j].Weight() * aNeuronGenes[neuronIdToIndex.at(aLinkGenes[j].FromNeuronId())].aActivation;
> + }
> +
> + // Loop neurons to calculate neurons' activation.
> + for (unsigned in j=aNumInput; j<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;">—<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>