티스토리 뷰

문제

fmincg Machine Learning. Andrew Ng. Ex3

★ ☆ 2021. 1. 28. 15:44

fmincg 라는 함수는 MATLAB과 Octave 에 없는 함수이다. 이 수업을 위해 고안된 helper function이다.

fminunc를 모방하여 만들어졌다.

 

function [X, fX, i] = fmincg(f, X, options, P1, P2, P3, P4, P5)

Minimize a continuous differentiable multivariate function.
연속적이고 서로 다른 여러 입력을 가지는 함수를 최소화 한다.

The starting point is given by "X" (D by 1), and the function named in the string "f", must return a function value and a vector of partial derivatives.
시작점은 X로 주어지고 디폴트값은 1이다. 함수의 이름은 string 'f'이다. 함수값function value값과 편도함수partial derivatives를 리턴한다.

The Polack-Ribiere flavour of conjugate gradients is used to compute search directions, and a line search using quadratic and cubic polynomial approximations and the Wolfe-Powell stopping criteria is used together with the slope ratio method for guessing initial step sizes.
Polack-Ribiere flavour of conjugate gradient는 탐색 방향을 계산 하는 데 쓴다. 그리고 line search는 이차, 삼차 다항의 값을 추측approximation하는데 쓴다. 그리고 Wolfe-Powell stopping criteria는 첫번째 단계의 크기를 추측할 때 기울기 구하는 방법들과 함께 쓰인다.

Additionally, a bunch of checks is made to make sure that exploration is taking place and that extrapolation will not be unboundedly large.
또한 해당 탐험exploration이 필요한지 많은 검토가 필요하며 외삽법extrapolation이 너무 커서는 안된다.

The "length" gives the length of the run: if it is positive, it gives the maximum number of line searches, if negative its absolute gives the maximum allowed number of function evaluations.
'length'는 현재 실행시키는 단위의 길이이다. 만약 length가 양수이면, 라인 탐색의 결과 중 가장 큰 숫자를 반환한다. 만약 length가 음수이면 함수 계산에서 허용되는 숫자 중 가장 큰 숫자로 계산한 후 절댓값을 반환한다.

You can (optionally) give "length" a second component, which will indicate the reduction in function value to be expected in the first line-search (defaults to 1.0).
필요에 따라서, 두번째 인자로 'length'를 넣을 수 있다. 그러면 첫번째로 실행되는 라인 탐색의 함수 값이 감소하게 된다. 설정해주지 않으면 디폴트 값은 1.0이다.

The function returns when either its length is up, or if no further progress can be made (ie, we are at a minimum, or so close that due to numerical problems, we cannot get any closer).
함수는 최대까지 계산한 값을 반환한다. 더 이상 계산을 진행할 수 없으면 정확히 그 지점까지 가지 않았더라도 계산을 멈추고 그 값을 반환한다.

If the function terminates within a few iterations, it could be an indication that the function value and derivatives are not consistent (ie, there may be a bug in the implementation of your "f" function).
만약 함수가 몇 번의 반복을 수행하지 않았는데 종료된다면, 함수와 도함수가 서로 맞지 않는다는 방증이다.

The function returns the found solution "X", a vector of function values "fX" indicating the progress made, and "i" the number of iterations (line searches or function evaluations, depending on the sign of "length") used.
함수는 찾은 해답 'X'를 반환한다. 'fX'는 함수 값으로 이루어진 벡터이며 어떤 절차를 거쳤는지 알 수 있다. 'i'는 사용된 반복의 갯수를 의미한다.

Usage: [X, fX, i] = fmincg(f, X, options, P1, P2, P3, P4, P5)
See also: checkgrad 

Copyright (C) 2001 and 2002 by Carl Edward Rasmussen. Date 2002-02-13

 

최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/04   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30
글 보관함