class_docstr: A general minimizer for curve fitting and optimization.
class_docstr_tok: ["A","general","minimizer","for","curve","fitting","and","optimization","."]
docstr: Perform the minimization.
  
  Parameters
  ----------
  method : str, optional
      Name of the fitting method to use. Valid values are:
  
      - `'leastsq'`: Levenberg-Marquardt (default)
      - `'least_squares'`: Least-Squares minimization, using Trust
        Region Reflective method
      - `'differential_evolution'`: differential evolution
      - `'brute'`: brute force method
      - `'basinhopping'`: basinhopping
      - `'ampgo'`: Adaptive Memory Programming for Global
        Optimization
      - '`nelder`': Nelder-Mead
      - `'lbfgsb'`: L-BFGS-B
      - `'powell'`: Powell
      - `'cg'`: Conjugate-Gradient
      - `'newton'`: Newton-CG
      - `'cobyla'`: Cobyla
      - `'bfgs'`: BFGS
      - `'tnc'`: Truncated Newton
      - `'trust-ncg'`: Newton-CG trust-region
      - `'trust-exact'`: nearly exact trust-region
      - `'trust-krylov'`: Newton GLTR trust-region
      - `'trust-constr'`: trust-region for constrained optimization
      - `'dogleg'`: Dog-leg trust-region
      - `'slsqp'`: Sequential Linear Squares Programming
      - `'emcee'`: Maximum likelihood via Monte-Carlo Markov Chain
      - `'shgo'`: Simplicial Homology Global Optimization
      - `'dual_annealing'`: Dual Annealing optimization
  
      In most cases, these methods wrap and use the method with the
      same name from `scipy.optimize`, or use
      `scipy.optimize.minimize` with the same `method` argument.
      Thus `'leastsq'` will use `scipy.optimize.leastsq`, while
      `'powell'` will use `scipy.optimize.minimizer(...,
      method='powell')`.
  
      For more details on the fitting methods please refer to the
      `SciPy documentation
      <https://docs.scipy.org/doc/scipy/reference/optimize.html>`__.
  
  params : Parameters, optional
      Parameters of the model to use as starting values.
  **kws : optional
      Additional arguments are passed to the underlying minimization
      method.
  
  Returns
  -------
  MinimizerResult
      Object containing the optimized parameters and several
      goodness-of-fit statistics.
  
  
  .. versionchanged:: 0.9.0
     Return value changed to :class:`MinimizerResult`.
docstr_tok: ["Perform","the","minimization",".","Parameters","--","--","--","--","--","method",":","str",",","optional","Name","of","the","fitting","method","to","use",".","Valid","values","are",":","-","`","'leastsq","'","`",":","Levenberg-Marquardt","(","default",")","-","`","'least_squares","'","`",":","Least-Squares","minimization",",","using","Trust","Region","Reflective","method","-","`","'differential_evolution","'","`",":","differential","evolution","-","`","'brute","'","`",":","brute","force","method","-","`","'basinhopping","'","`",":","basinhopping","-","`","'ampgo","'","`",":","Adaptive","Memory","Programming","for","Global","Optimization","-","'","`","nelder","`","'",":","Nelder-Mead","-","`","'lbfgsb","'","`",":","L-BFGS-B","-","`","'powell","'","`",":","Powell","-","`","'cg","'","`",":","Conjugate-Gradient","-","`","'newton","'","`",":","Newton-CG","-","`","'cobyla","'","`",":","Cobyla","-","`","'bfgs","'","`",":","BFGS","-","`","'tnc","'","`",":","Truncated","Newton","-","`","'trust-ncg","'","`",":","Newton-CG","trust-region","-","`","'trust-exact","'","`",":","nearly","exact","trust-region","-","`","'trust-krylov","'","`",":","Newton","GLTR","trust-region","-","`","'trust-constr","'","`",":","trust-region","for","constrained","optimization","-","`","'dogleg","'","`",":","Dog-leg","trust-region","-","`","'slsqp","'","`",":","Sequential","Linear","Squares","Programming","-","`","'emcee","'","`",":","Maximum","likelihood","via","Monte-Carlo","Markov","Chain","-","`","'shgo","'","`",":","Simplicial","Homology","Global","Optimization","-","`","'dual_annealing","'","`",":","Dual","Annealing","optimization","In","most","cases",",","these","methods","wrap","and","use","the","method","with","the","same","name","from","`","scipy.optimize","`",",","or","use","`","scipy.optimize.minimize","`","with","the","same","`","method","`","argument",".","Thus","`","'leastsq","'","`","will","use","`","scipy.optimize.leastsq","`",",","while","`","'powell","'","`","will","use","`","scipy.optimize.minimizer","(","...",",","method='powell","'",")","`",".","For","more","details","on","the","fitting","methods","please","refer","to","the","`","SciPy","documentation","<","https",":","\/\/docs.scipy.org\/doc\/scipy\/reference\/optimize.html",">","`","__",".","params",":","Parameters",",","optional","Parameters","of","the","model","to","use","as","starting","values",".","*","*","kws",":","optional","Additional","arguments","are","passed","to","the","underlying","minimization","method",".","Returns","--","--","--","-","MinimizerResult","Object","containing","the","optimized","parameters","and","several","goodness-of-fit","statistics",".","..","versionchanged",":",":","0.9.0","Return","value","changed","to",":","class",":","`","MinimizerResult","`","."]
code: def minimize(self, method="leastsq", params=None, **kws):
      """Perform the minimization.
  
      Parameters
      ----------
      method : str, optional
          Name of the fitting method to use. Valid values are:
  
          - `'leastsq'`: Levenberg-Marquardt (default)
          - `'least_squares'`: Least-Squares minimization, using Trust
            Region Reflective method
          - `'differential_evolution'`: differential evolution
          - `'brute'`: brute force method
          - `'basinhopping'`: basinhopping
          - `'ampgo'`: Adaptive Memory Programming for Global
            Optimization
          - '`nelder`': Nelder-Mead
          - `'lbfgsb'`: L-BFGS-B
          - `'powell'`: Powell
          - `'cg'`: Conjugate-Gradient
          - `'newton'`: Newton-CG
          - `'cobyla'`: Cobyla
          - `'bfgs'`: BFGS
          - `'tnc'`: Truncated Newton
          - `'trust-ncg'`: Newton-CG trust-region
          - `'trust-exact'`: nearly exact trust-region
          - `'trust-krylov'`: Newton GLTR trust-region
          - `'trust-constr'`: trust-region for constrained optimization
          - `'dogleg'`: Dog-leg trust-region
          - `'slsqp'`: Sequential Linear Squares Programming
          - `'emcee'`: Maximum likelihood via Monte-Carlo Markov Chain
          - `'shgo'`: Simplicial Homology Global Optimization
          - `'dual_annealing'`: Dual Annealing optimization
  
          In most cases, these methods wrap and use the method with the
          same name from `scipy.optimize`, or use
          `scipy.optimize.minimize` with the same `method` argument.
          Thus `'leastsq'` will use `scipy.optimize.leastsq`, while
          `'powell'` will use `scipy.optimize.minimizer(...,
          method='powell')`.
  
          For more details on the fitting methods please refer to the
          `SciPy documentation
          <https://docs.scipy.org/doc/scipy/reference/optimize.html>`__.
  
      params : Parameters, optional
          Parameters of the model to use as starting values.
      **kws : optional
          Additional arguments are passed to the underlying minimization
          method.
  
      Returns
      -------
      MinimizerResult
          Object containing the optimized parameters and several
          goodness-of-fit statistics.
  
  
      .. versionchanged:: 0.9.0
         Return value changed to :class:`MinimizerResult`.
  
      """
      kwargs = {"params": params}
      kwargs.update(self.kws)
      for maxnfev_alias in ("maxfev", "maxiter"):
          if maxnfev_alias in kws:
              warnings.warn(
                  maxeval_warning.format(maxnfev_alias, thisfuncname()),
                  RuntimeWarning,
              )
              kws.pop(maxnfev_alias)
  
      kwargs.update(kws)
  
      user_method = method.lower()
      if user_method.startswith("leasts"):
          function = self.leastsq
      elif user_method.startswith("least_s"):
          function = self.least_squares
      elif user_method == "brute":
          function = self.brute
      elif user_method == "basinhopping":
          function = self.basinhopping
      elif user_method == "ampgo":
          function = self.ampgo
      elif user_method == "emcee":
          function = self.emcee
      elif user_method == "shgo":
          function = self.shgo
      elif user_method == "dual_annealing":
          function = self.dual_annealing
      else:
          function = self.scalar_minimize
          for key, val in SCALAR_METHODS.items():
              if key.lower().startswith(
                  user_method
              ) or val.lower().startswith(user_method):
                  kwargs["method"] = val
      return function(**kwargs)
  
imports: from collections import namedtuple
  from copy import deepcopy
  import inspect
  import multiprocessing
  import numbers
  import warnings
  import numpy
  from scipy.linalg import LinAlgError, inv
  from scipy.optimize import basinhopping
  from scipy.optimize import brute
  from scipy.optimize import differential_evolution
  from scipy.optimize import dual_annealing
  from scipy.optimize import least_squares
  from scipy.optimize import leastsq
  from scipy.optimize import minimize
  from scipy.optimize import shgo
  from scipy.sparse import issparse
  from scipy.sparse.linalg import LinearOperator
  from scipy.stats import cauchy
  from scipy.stats import norm
  from ._ampgo import ampgo
  from .parameter import Parameter, Parameters
  from .printfuncs import fitreport_html_table
label_desc: Use image node_id 22 for calling the Minimizer obj's underlying member method code with example usage: obj.minimize(method, params) and returns: function