class_docstr: Attacks a model with word substiutitions using a genetic algorithm.
  
  Args:
      pop_size (int): The population size. Defaults to 20.
      max_iters (int): The maximum number of iterations to use. Defaults to 50.
      temp (float): Temperature for softmax function used to normalize probability dist when sampling parents.
          Higher temperature increases the sensitivity to lower probability candidates.
      give_up_if_no_improvement (bool): If True, stop the search early if no candidate that improves the score is found.
      post_crossover_check (bool): If True, check if child produced from crossover step passes the constraints.
      max_crossover_retries (int): Maximum number of crossover retries if resulting child fails to pass the constraints.
          Applied only when `post_crossover_check` is set to `True`.
          Setting it to 0 means we immediately take one of the parents at random as the child upon failure.
      max_replace_times_per_index (int):  The maximum times words at the same index can be replaced in improved genetic algorithm.
code: def __init__(
      self,
      pop_size=60,
      max_iters=20,
      temp=0.3,
      give_up_if_no_improvement=False,
      post_crossover_check=True,
      max_crossover_retries=20,
      max_replace_times_per_index=5,
  ):
      super().__init__(
          pop_size=pop_size,
          max_iters=max_iters,
          temp=temp,
          give_up_if_no_improvement=give_up_if_no_improvement,
          post_crossover_check=post_crossover_check,
          max_crossover_retries=max_crossover_retries,
      )
  
      self.max_replace_times_per_index = max_replace_times_per_index
  
file_path: TextAttack/textattack/search_methods/improved_genetic_algorithm.py
imports: import numpy
  from textattack.search_methods import GeneticAlgorithm, PopulationMember
label_desc: Use image node_id 1 to create a new ImprovedGeneticAlgorithm object from inherited base classes: GeneticAlgorithm with example: obj = ImprovedGeneticAlgorithm(pop_size, max_iters, temp, give_up_if_no_improvement, post_crossover_check, max_crossover_retries, max_replace_times_per_index)