class_docstr: Local Search Algorithm.
  
  This algorithm expects to start with a very good hyperparameter
  configuration. It changes one hyperparameter at a time to see if better
  results can be obtained.
  
  Args:
      seed_configuration (dict): hyperparameter configuration to start with.
      perturbation_factors (Union[tuple,list]): continuous parameters will be
          multiplied by these.
      repeat_trials (int): number of times that identical configurations are
          repeated to test for random fluctuations.
class_docstr_tok: ["Local","Search","Algorithm",".","This","algorithm","expects","to","start","with","a","very","good","hyperparameter","configuration",".","It","changes","one","hyperparameter","at","a","time","to","see","if","better","results","can","be","obtained",".","Args",":","seed_configuration","(","dict",")",":","hyperparameter","configuration","to","start","with",".","perturbation_factors","(","Union","[","tuple",",","list","]",")",":","continuous","parameters","will","be","multiplied","by","these",".","repeat_trials","(","int",")",":","number","of","times","that","identical","configurations","are","repeated","to","test","for","random","fluctuations","."]
docstr: Randomly choose one parameter and perturb it.
  
  For Ordinal this is increased/decreased, for continuous/discrete this is
  times 0.8/1.2.
  
  Args:
      parameters (list[sherpa.core.Parameter]): parameter ranges.
      configuration (dict): a parameter configuration to be perturbed.
      param_name (str): the name of the parameter to perturb.
      increase (bool): whether to increase or decrease the parameter.
  
  Returns:
      dict: perturbed configuration
docstr_tok: ["Randomly","choose","one","parameter","and","perturb","it",".","For","Ordinal","this","is","increased\/decreased",",","for","continuous\/discrete","this","is","times","0.8\/1.2",".","Args",":","parameters","(","list","[","sherpa.core.Parameter","]",")",":","parameter","ranges",".","configuration","(","dict",")",":","a","parameter","configuration","to","be","perturbed",".","param_name","(","str",")",":","the","name","of","the","parameter","to","perturb",".","increase","(","bool",")",":","whether","to","increase","or","decrease","the","parameter",".","Returns",":","dict",":","perturbed","configuration"]
code: def _perturb(self, candidate, parameter, increase):
      """
      Randomly choose one parameter and perturb it.
  
      For Ordinal this is increased/decreased, for continuous/discrete this is
      times 0.8/1.2.
  
      Args:
          parameters (list[sherpa.core.Parameter]): parameter ranges.
          configuration (dict): a parameter configuration to be perturbed.
          param_name (str): the name of the parameter to perturb.
          increase (bool): whether to increase or decrease the parameter.
  
      Returns:
          dict: perturbed configuration
      """
      if isinstance(parameter, Ordinal):
          shift = +1 if increase else -1
          values = parameter.range
          newidx = values.index(candidate[parameter.name]) + shift
          newidx = numpy.clip(newidx, 0, len(values) - 1)
          candidate[parameter.name] = values[newidx]
  
      else:
          factor = self.perturbation_factors[1 if increase else 0]
          candidate[parameter.name] *= factor
  
          if isinstance(parameter, Discrete):
              candidate[parameter.name] = int(candidate[parameter.name])
  
          candidate[parameter.name] = numpy.clip(
              candidate[parameter.name],
              min(parameter.range),
              max(parameter.range),
          )
      return candidate
  
imports: import os
  import random
  import numpy
  import logging
  import sherpa
  import pandas
  import sklearn.gaussian_process
  from sherpa.core import Choice, Continuous, Discrete, Ordinal, AlgorithmState
  from sherpa.core import rng
  import sklearn.model_selection
  import collections
label_desc: Use image node_id 4 for calling the LocalSearch obj's underlying member method code with example usage: obj._perturb(candidate, parameter, increase) and returns: candidate