![]() |
Stan
2.10.0
probability, sampling & optimization
|
Classes | |
class | BFGSLineSearch |
class | BFGSMinimizer |
class | BFGSUpdate_HInv |
class | ConvergenceOptions |
class | LBFGSUpdate |
Implement a limited memory version of the BFGS update. More... | |
class | LSOptions |
class | ModelAdaptor |
Typedefs | |
typedef Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > | matrix_d |
typedef Eigen::Matrix< double, Eigen::Dynamic, 1 > | vector_d |
Enumerations | |
enum | TerminationCondition { TERM_SUCCESS = 0, TERM_ABSX = 10, TERM_ABSF = 20, TERM_RELF = 21, TERM_ABSGRAD = 30, TERM_RELGRAD = 31, TERM_MAXIT = 40, TERM_LSFAIL = -1 } |
Functions | |
template<typename Scalar > | |
Scalar | CubicInterp (const Scalar &df0, const Scalar &x1, const Scalar &f1, const Scalar &df1, const Scalar &loX, const Scalar &hiX) |
Find the minima in an interval [loX, hiX] of a cubic function which interpolates the points, function values and gradients provided. More... | |
template<typename Scalar > | |
Scalar | CubicInterp (const Scalar &x0, const Scalar &f0, const Scalar &df0, const Scalar &x1, const Scalar &f1, const Scalar &df1, const Scalar &loX, const Scalar &hiX) |
Find the minima in an interval [loX, hiX] of a cubic function which interpolates the points, function values and gradients provided. More... | |
template<typename FunctorType , typename Scalar , typename XType > | |
int | WolfeLineSearch (FunctorType &func, Scalar &alpha, XType &x1, Scalar &f1, XType &gradx1, const XType &p, const XType &x0, const Scalar &f0, const XType &gradx0, const Scalar &c1, const Scalar &c2, const Scalar &minAlpha) |
Perform a line search which finds an approximate solution to:
satisfying the strong Wolfe conditions: 1) | |
template<typename M > | |
double | newton_step (M &model, std::vector< double > ¶ms_r, std::vector< int > ¶ms_i, std::ostream *output_stream=0) |
typedef Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic> stan::optimization::matrix_d |
Definition at line 13 of file newton.hpp.
typedef Eigen::Matrix<double, Eigen::Dynamic, 1> stan::optimization::vector_d |
Definition at line 14 of file newton.hpp.
Scalar stan::optimization::CubicInterp | ( | const Scalar & | df0, |
const Scalar & | x1, | ||
const Scalar & | f1, | ||
const Scalar & | df1, | ||
const Scalar & | loX, | ||
const Scalar & | hiX | ||
) |
Find the minima in an interval [loX, hiX] of a cubic function which interpolates the points, function values and gradients provided.
Implicitly, this function constructs an interpolating polynomial g(x) = a_3 x^3 + a_2 x^2 + a_1 x + a_0 such that g(0) = 0, g(x1) = f1, g'(0) = df0, g'(x1) = df1 where g'(x) = 3 a_3 x^2 + 2 a_2 x + a_1 is the derivative of g(x). It then computes the roots of g'(x) and finds the minimal value of g(x) on the interval [loX,hiX] including the end points.
This function implements the full parameter version of CubicInterp().
df0 | First derivative value, f'(x0) |
x1 | Second point |
f1 | Second function value, f(x1) |
df1 | Second derivative value, f'(x1) |
loX | Lower bound on the interval of solutions |
hiX | Upper bound on the interval of solutions |
Definition at line 35 of file bfgs_linesearch.hpp.
Scalar stan::optimization::CubicInterp | ( | const Scalar & | x0, |
const Scalar & | f0, | ||
const Scalar & | df0, | ||
const Scalar & | x1, | ||
const Scalar & | f1, | ||
const Scalar & | df1, | ||
const Scalar & | loX, | ||
const Scalar & | hiX | ||
) |
Find the minima in an interval [loX, hiX] of a cubic function which interpolates the points, function values and gradients provided.
Implicitly, this function constructs an interpolating polynomial g(x) = a_3 x^3 + a_2 x^2 + a_1 x + a_0 such that g(x0) = f0, g(x1) = f1, g'(x0) = df0, g'(x1) = df1 where g'(x) = 3 a_3 x^2 + 2 a_2 x + a_1 is the derivative of g(x). It then computes the roots of g'(x) and finds the minimal value of g(x) on the interval [loX,hiX] including the end points.
x0 | First point |
f0 | First function value, f(x0) |
df0 | First derivative value, f'(x0) |
x1 | Second point |
f1 | Second function value, f(x1) |
df1 | Second derivative value, f'(x1) |
loX | Lower bound on the interval of solutions |
hiX | Upper bound on the interval of solutions |
Definition at line 103 of file bfgs_linesearch.hpp.
double stan::optimization::newton_step | ( | M & | model, |
std::vector< double > & | params_r, | ||
std::vector< int > & | params_i, | ||
std::ostream * | output_stream = 0 |
||
) |
Definition at line 33 of file newton.hpp.
int stan::optimization::WolfeLineSearch | ( | FunctorType & | func, |
Scalar & | alpha, | ||
XType & | x1, | ||
Scalar & | f1, | ||
XType & | gradx1, | ||
const XType & | p, | ||
const XType & | x0, | ||
const Scalar & | f0, | ||
const XType & | gradx0, | ||
const Scalar & | c1, | ||
const Scalar & | c2, | ||
const Scalar & | minAlpha | ||
) |
Perform a line search which finds an approximate solution to:
satisfying the strong Wolfe conditions: 1) 2)
where
is the gradient of f(x).
FunctorType | A type which supports being called as ret = func(x,f,g) where x is the input point, f and g are the function value and gradient at x and ret is non-zero if function evaluation fails. |
func | Function which is being minimized. |
alpha | First value of ![]() ![]() |
x1 | Final point, equal to ![]() |
f1 | Final point function value, equal to ![]() |
gradx1 | Final point gradient, equal to ![]() |
p | Search direction. It is assumed to be a descent direction such that ![]() |
x0 | Value of starting point, ![]() |
f0 | Value of function at starting point, ![]() |
gradx0 | Value of function gradient at starting point, ![]() |
c1 | Parameter of the Wolfe conditions. ![]() |
c2 | Parameter of the Wolfe conditions. ![]() |
minAlpha | Smallest allowable step-size. |
Definition at line 222 of file bfgs_linesearch.hpp.