Turi Create  4.0

Classes

class  turi::optimization::lbfgs_solver
 

Functions

 turi::optimization::lbfgs_solver::lbfgs_solver (std::shared_ptr< first_order_opt_interface > _model)
 
void turi::optimization::lbfgs_solver::setup (const DenseVector &init_point, const std::map< std::string, flexible_type > &opts, const std::shared_ptr< smooth_regularizer_interface > &reg=nullptr)
 
bool turi::optimization::lbfgs_solver::next_iteration ()
 
const solver_statusturi::optimization::lbfgs_solver::status () const
 
solver_status turi::optimization::lbfgs (std::shared_ptr< first_order_opt_interface > model, const DenseVector &init_point, const std::map< std::string, flexible_type > &opts, const std::shared_ptr< smooth_regularizer_interface > &reg=nullptr)
 

Variables

size_t turi::optimization::solver_status::iteration = 0
 
double turi::optimization::solver_status::solver_time = 0
 
DenseVector turi::optimization::solver_status::solution
 
DenseVector turi::optimization::solver_status::gradient
 
DenseMatrix turi::optimization::solver_status::hessian
 
double turi::optimization::solver_status::residual = NAN
 
double turi::optimization::solver_status::function_value = NAN
 
size_t turi::optimization::solver_status::num_function_evaluations = 0
 
size_t turi::optimization::solver_status::num_gradient_evaluations = 0
 
double turi::optimization::solver_status::step_size = 0
 
OPTIMIZATION_STATUS turi::optimization::solver_status::status = OPTIMIZATION_STATUS::OPT_UNSET
 

Detailed Description

Function Documentation

◆ lbfgs_solver()

turi::optimization::lbfgs_solver::lbfgs_solver ( std::shared_ptr< first_order_opt_interface _model)
inline

Construct the solver around a specific model interface.

Parameters
[in]modelModel with first order optimization interface.

Definition at line 100 of file lbfgs.hpp.

◆ lbfgs()

solver_status turi::optimization::lbfgs ( std::shared_ptr< first_order_opt_interface model,
const DenseVector &  init_point,
const std::map< std::string, flexible_type > &  opts,
const std::shared_ptr< smooth_regularizer_interface > &  reg = nullptr 
)

Solves lbgfgs problem end-to-end.

This class wraps the above iterative solver in a convenience function, iterating the solution until completion.

Parameters
modelThe implementation of first_order_opt_interface used in the optimization.
init_pointThe initial point at which the optimization starts.
optsThe options. Uses all the options given to setup() in the lbfgs_solver class, plus "max_iterations" to terminate the optimization after a given number of iterations.
regOptional regularization interface.

◆ next_iteration()

bool turi::optimization::lbfgs_solver::next_iteration ( )

Perform the next update of the solution.

Call this method repeatedly to perform the optimization. Each iteration updates the solution point with one step.

◆ setup()

void turi::optimization::lbfgs_solver::setup ( const DenseVector &  init_point,
const std::map< std::string, flexible_type > &  opts,
const std::shared_ptr< smooth_regularizer_interface > &  reg = nullptr 
)

Sets up (or resets) the solver.

Parameters
[in]init_pointStarting point for the solver.
[in]optsSolver options. Options are "lbfgs_memory_level" and "convergence_threshold". If not given, defaults are taken from the table in optimization_interface.hpp.
[in]regShared ptr to an interface to a smooth regularizer.

◆ status()

const solver_status& turi::optimization::lbfgs_solver::status ( ) const
inline

The status after a given iteration.

The best solution so far is given by status().solution.

Definition at line 129 of file lbfgs.hpp.

Variable Documentation

◆ function_value

double turi::optimization::solver_status::function_value = NAN

Function value

Definition at line 36 of file lbfgs.hpp.

◆ gradient

DenseVector turi::optimization::solver_status::gradient

Current gradient

Definition at line 33 of file lbfgs.hpp.

◆ hessian

DenseMatrix turi::optimization::solver_status::hessian

Current hessian

Definition at line 34 of file lbfgs.hpp.

◆ iteration

size_t turi::optimization::solver_status::iteration = 0

Iterations taken

Definition at line 30 of file lbfgs.hpp.

◆ num_function_evaluations

size_t turi::optimization::solver_status::num_function_evaluations = 0

Function evals

Definition at line 37 of file lbfgs.hpp.

◆ num_gradient_evaluations

size_t turi::optimization::solver_status::num_gradient_evaluations = 0

Gradient evals

Definition at line 38 of file lbfgs.hpp.

◆ residual

double turi::optimization::solver_status::residual = NAN

Residual norm

Definition at line 35 of file lbfgs.hpp.

◆ solution

DenseVector turi::optimization::solver_status::solution

Current Solution

Definition at line 32 of file lbfgs.hpp.

◆ solver_time

double turi::optimization::solver_status::solver_time = 0

Wall clock time (s)

Definition at line 31 of file lbfgs.hpp.

◆ status

OPTIMIZATION_STATUS turi::optimization::solver_status::status = OPTIMIZATION_STATUS::OPT_UNSET

Status

Definition at line 41 of file lbfgs.hpp.

◆ step_size

double turi::optimization::solver_status::step_size = 0

Current step size

Definition at line 39 of file lbfgs.hpp.