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

Marcus Edel notifications at github.com
Tue Jul 12 07:28:22 EDT 2016


> +    double p = mlpack::math::Random();
> +    if (p<mutateProb && linkIndexs.size()>0) {
> +      ssize_t idx = linkIndexs[mlpack::math::RandInt(0, linkIndexs.size())];
> +      genome.aLinkGenes[idx].Enabled(!enabled);  // Reverse enabled status to opposite.
> +    }
> +  }
> +
> +  // Mutate: change single weight. Combine both biased and unbiased mutation.
> +  void MutateWeight(Genome& genome, double mutateProb, double perturbProb, double mutateSize) {
> +    double p = mlpack::math::Random();  // rand 0~1
> +    if (p > mutateProb) return;
> +    
> +    for (ssize_t i=0; i<genome.aLinkGenes.size(); ++i) {  
> +      double p2 = mlpack::math::Random();
> +      if (p2 < perturbProb) {  // Biased weight mutation.
> +        double deltaW = mlpack::math::RandNormal(0, mutateSize);

Right, I was thinking about randu.

---
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/554a279b0089e4385dfb40077e578d6ae2a42ece#r70420703
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160712/ff248309/attachment-0001.html>


More information about the mlpack-git mailing list