class_docstr: Object which carries out genetic search and returns top performing model
  upon completion.
docstr: Run genetic search on dataset given number of generations and
  population size
  
  Args:
      dataset : tuple or list of numpy arrays in form ((train_data,
              train_labels), (validation_data, validation_labels))
      num_generations (int): number of generations to search
      pop_size (int): initial population size
      epochs (int): epochs for each model eval, passed to keras model.fit
      fitness (None, optional): scoring function to be applied to
              population scores, will be called on a numpy array which is
              a min/max scaled version of evaluated model metrics, so It
              should accept a real number including 0. If left as default
              just the min/max scaled values will be used.
      metric (str, optional): must be "accuracy" or "loss" , defines what
              to optimize during search
  
  Returns:
      keras model: best model found with weights
docstr_tok: ["Run","genetic","search","on","dataset","given","number","of","generations","and","population","size","Args",":","dataset",":","tuple","or","list","of","numpy","arrays","in","form","(","(","train_data",",","train_labels",")",",","(","validation_data",",","validation_labels",")",")","num_generations","(","int",")",":","number","of","generations","to","search","pop_size","(","int",")",":","initial","population","size","epochs","(","int",")",":","epochs","for","each","model","eval",",","passed","to","keras","model.fit","fitness","(","None",",","optional",")",":","scoring","function","to","be","applied","to","population","scores",",","will","be","called","on","a","numpy","array","which","is","a","min\/max","scaled","version","of","evaluated","model","metrics",",","so","It","should","accept","a","real","number","including","0",".","If","left","as","default","just","the","min\/max","scaled","values","will","be","used",".","metric","(","str",",","optional",")",":","must","be","``","accuracy","''","or","``","loss","''",",","defines","what","to","optimize","during","search","Returns",":","keras","model",":","best","model","found","with","weights"]
code: def run(
      self,
      dataset,
      num_generations,
      pop_size,
      epochs,
      fitness=None,
      metric="accuracy",
  ):
      """
      Run genetic search on dataset given number of generations and
      population size
  
      Args:
          dataset : tuple or list of numpy arrays in form ((train_data,
                  train_labels), (validation_data, validation_labels))
          num_generations (int): number of generations to search
          pop_size (int): initial population size
          epochs (int): epochs for each model eval, passed to keras model.fit
          fitness (None, optional): scoring function to be applied to
                  population scores, will be called on a numpy array which is
                  a min/max scaled version of evaluated model metrics, so It
                  should accept a real number including 0. If left as default
                  just the min/max scaled values will be used.
          metric (str, optional): must be "accuracy" or "loss" , defines what
                  to optimize during search
  
      Returns:
          keras model: best model found with weights
      """
      self.set_objective(metric)
  
      # If no validation data is given set it to None
      if len(dataset) == 2:
          (self.x_train, self.y_train), (
              self.x_test,
              self.y_test,
          ) = dataset
          self.x_val = None
          self.y_val = None
      else:
          (
              (self.x_train, self.y_train),
              (self.x_test, self.y_test),
              (self.x_val, self.y_val),
          ) = dataset
  
      # generate and evaluate initial population
      members = self._generate_random_population(pop_size)
      pop = self._evaluate_population(
          members, epochs, fitness, 0, num_generations
      )
  
      # evolve
      for gen in range(1, num_generations):
          members = self._reproduce(pop, gen)
          pop = self._evaluate_population(
              members, epochs, fitness, gen, num_generations
          )
  
      return load_model("best-model.h5")
  
imports: from __future__ import print_function
  import random
  import csv
  import operator
  import gc
  import os
  from datetime import datetime
  from keras.callbacks import EarlyStopping
  from keras.models import load_model
  import keras.backend
  from sklearn.metrics import log_loss
  import numpy
label_desc: Use image node_id 3 for calling the DEvol obj's underlying member method code with example usage: obj.run(dataset, num_generations, pop_size, epochs, fitness, metric) and returns: load_model