[mlpack-git] [mlpack/mlpack] NeuralEvolution - implemented gene, genome (#686)

Marcus Edel notifications at github.com
Wed Jun 29 17:53:28 EDT 2016


> +
> +  // Mutate: add new link to genome.
> +  // TODO: what if created looped link? It will influence the depth calculation in genome class!!
> +  // TODO: make innovation a class and pass as parameter? Also for other similar functions.
> +  void MutateAddLink(Genome& genome, double mutateAddLinkProb) {
> +    // Whether mutate or not.
> +    double p = mlpack::math::Random();
> +    if (p > mutateAddLinkProb) return;
> +
> +    // Select from neuron
> +    ssize_t fromNeuronIdx = mlpack::math::RandInt(0, genome.aNeuronGenes.size());
> +    ssize_t fromNeuronId = genome.aNeuronGenes[fromNeuronIdx].Id();
> +
> +    // Select to neuron which cannot be input.
> +    ssize_t toNeuronIdx = mlpack::math::RandInt(genome.NumInput(), genome.aNeuronGenes.size());
> +    ssize_t toNeuronId = genome.aNeuronGenes[toNeuronIdx].Id();

I think we have to make sure, that `fromNeuronIdx != toNeuronIdx`.

---
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/3c109959da112cebba341ac1e5f0143a4d5a85f2#r69035530
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160629/6849e860/attachment.html>


More information about the mlpack-git mailing list