Scipy: 최적화

Nelder-Mead 알고리즘

scipy.optimize.optimize 모듈의 fmin 함수를 사용한다.

fmin(func, x0, args = (), 
    xtol = 0.0001, ftol = 0.0001, 
    maxiter = None, maxfun = None, 
    full_output = 0, disp = 1, retall = 0, 
    callback = None)

매개변수 설명

  1. func: 최적화시킬 함수
  2. xo: 초기값
  3. args: 최적화 함수에 전달할 추가 매개변수
  4. xtol: 이동 스텝
  5. ftol: 수렴 판정 기준
  6. maxiter: 최대 반복 회수
  7. maxfun: 최대 함수호출 회수
  8. full_output : non-zero if fval and warnflag outputs are desired.
  9. disp : non-zero to print convergence messages.
  10. retall : non-zero to return list of solutions at each iteration
  11. callback : an optional user-supplied function to call after each iteration. It is called as callback(xk), where xk is the current parameter vector.

결과값 설명

(xopt, {fopt, iter, funcalls, warnflag})

  1. xopt : ndarray - minimizer of function
  2. fopt : number - value of function at minimum: fopt = func(xopt)
  3. iter : number - number of iterations
  4. funcalls : number - number of function calls
  5. warnflag : number - Integer warning flag:
    1. 'Maximum number of function evaluations.'
    2. 'Maximum number of iterations.'
  6. allvecs : Python list - a list of solutions at each iteration