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: Performs crossover between the neurons in parent1 and parent2 to form offspring 
docstr_tok: ["Performs","crossover","between","the","neurons","in","parent1","and","parent2","to","form","offspring"]
code: def _crossover(self, parent1, parent2):
      """Performs crossover between the neurons in parent1 and parent2 to form offspring"""
      child1 = self._build_model(id=parent1.id + 1)
      self._inherit_weights(child1, parent1)
      child2 = self._build_model(id=parent2.id + 1)
      self._inherit_weights(child2, parent2)
  
      # Perform crossover
      for i in range(len(child1.layers)):
          if hasattr(child1.layers[i], "W"):
              n_neurons = child1.layers[i].W.shape[1]
              # Perform crossover between the individuals' neuron weights
              cutoff = np.random.randint(0, n_neurons)
              child1.layers[i].W[:, cutoff:] = (
                  parent2.layers[i].W[:, cutoff:].copy()
              )
              child1.layers[i].w0[:, cutoff:] = (
                  parent2.layers[i].w0[:, cutoff:].copy()
              )
              child2.layers[i].W[:, cutoff:] = (
                  parent1.layers[i].W[:, cutoff:].copy()
              )
              child2.layers[i].w0[:, cutoff:] = (
                  parent1.layers[i].w0[:, cutoff:].copy()
              )
  
      return child1, child2
  
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 6 for calling the Neuroevolution obj's underlying member method code with example usage: obj._crossover(parent1, parent2) and returns: child1,  child2