class_docstr: Class for optimisation based on Genetic algorithms. 
class_docstr_tok: ["Class","for","optimisation","based","on","Genetic","algorithms","."]
docstr: Returns the candidates to mutate from. 
docstr_tok: ["Returns","the","candidates","to","mutate","from","."]
code: def _get_candidates_to_mutate_from(
      self, num_mutations, num_candidates_to_mutate_from
  ):
      """Returns the candidates to mutate from."""
      all_prev_eval_points = (
          self.prev_eval_points + self.history.query_points
      )
      all_prev_eval_vals = self.prev_eval_vals + self.history.query_vals
      if num_candidates_to_mutate_from <= 0:
          idxs_to_mutate_from = sample_according_to_exp_probs(
              all_prev_eval_vals,
              num_mutations,
              replace=True,
              scaling_const=self.options.fitness_sampler_scaling_const,
              sample_uniformly_if_fail=True,
          )
          num_mutations_arg_to_mutation_op = [
              (idxs_to_mutate_from == i).sum()
              for i in range(len(all_prev_eval_points))
          ]
          candidates_to_mutate_from = all_prev_eval_points
      else:
          cand_idxs_to_mutate_from = sample_according_to_exp_probs(
              all_prev_eval_vals,
              num_candidates_to_mutate_from,
              replace=False,
              scaling_const=self.options.fitness_sampler_scaling_const,
          )
          candidates_to_mutate_from = [
              all_prev_eval_points[i] for i in cand_idxs_to_mutate_from
          ]
          num_mutations_arg_to_mutation_op = num_mutations
      return candidates_to_mutate_from, num_mutations_arg_to_mutation_op
  
imports: from argparse import Namespace
  from numpy.random import choice
  from .blackbox_optimiser import BlackboxOptimiser, blackbox_opt_args
  from ..utils.general_utils import sample_according_to_exp_probs
  from ..utils.option_handler import get_option_specs, load_options
label_desc: Use image node_id 6 for calling the GAOptimiser obj's underlying member method code with example usage: obj._get_candidates_to_mutate_from(num_mutations, num_candidates_to_mutate_from) and returns: candidates_to_mutate_from,  num_mutations_arg_to_mutation_op