class_docstr: Evolutionary optimization of Neural Networks.
  
  Parameters:
  -----------
  n_individuals: int
      The number of neural networks that are allowed in the population at a time.
  mutation_rate: float
      The probability that a weight will be mutated.
  model_builder: method
      A method which returns a user specified NeuralNetwork instance. 
class_docstr_tok: ["Evolutionary","optimization","of","Neural","Networks",".","Parameters",":","--","--","--","--","--","-","n_individuals",":","int","The","number","of","neural","networks","that","are","allowed","in","the","population","at","a","time",".","mutation_rate",":","float","The","probability","that","a","weight","will","be","mutated",".","model_builder",":","method","A","method","which","returns","a","user","specified","NeuralNetwork","instance","."]
docstr: Add zero mean gaussian noise to the layer weights with probability mutation_rate 
docstr_tok: ["Add","zero","mean","gaussian","noise","to","the","layer","weights","with","probability","mutation_rate"]
code: def _mutate(self, individual, var=1):
      """Add zero mean gaussian noise to the layer weights with probability mutation_rate"""
      for layer in individual.layers:
          if hasattr(layer, "W"):
              # Mutation of weight with probability self.mutation_rate
              mutation_mask = np.random.binomial(
                  1, p=self.mutation_rate, size=layer.W.shape
              )
              layer.W += (
                  np.random.normal(loc=0, scale=var, size=layer.W.shape)
                  * mutation_mask
              )
              mutation_mask = np.random.binomial(
                  1, p=self.mutation_rate, size=layer.w0.shape
              )
              layer.w0 += (
                  np.random.normal(
                      loc=0, scale=var, size=layer.w0.shape
                  )
                  * mutation_mask
              )
  
      return individual
  
file_path: ML-From-Scratch/mlfromscratch/supervised_learning/neuroevolution.py
imports: from __future__ import print_function, division
  import numpy
  import copy
label_desc: Use image node_id 4 for calling the Neuroevolution obj's underlying member method code with example usage: obj._mutate(individual, var) and returns: individual