6 #ifndef TURI_OPTIMIZATION_INTERFACE_H_ 7 #define TURI_OPTIMIZATION_INTERFACE_H_ 10 #include <core/data/flexible_type/flexible_type.hpp> 12 #include <Eigen/SparseCore> 13 #include <core/storage/sframe_data/sframe.hpp> 22 typedef Eigen::Matrix<double, Eigen::Dynamic,1> DenseVector;
23 typedef Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic> DenseMatrix;
24 typedef Eigen::DiagonalMatrix<double, Eigen::Dynamic> DiagonalMatrix;
25 typedef Eigen::SparseVector<double> SparseVector;
26 typedef Eigen::SparseMatrix<double> SparseMatrix;
28 namespace optimization {
39 {
"convergence_threshold", 1e-2},
41 {
"lbfgs_memory_level", 3},
42 {
"mini_batch_size", 1000},
43 {
"max_iterations", 10},
44 {
"auto_tuning",
true},
102 double solve_time = -1;
109 int gradient_evals = 0;
122 double step_size = 1.0;
125 int gradient_evals = 0;
157 virtual size_t num_examples()
const = 0;
167 virtual size_t num_variables()
const = 0;
180 virtual void compute_first_order_statistics(
const DenseVector &point,
181 DenseVector& gradient,
double & function_value,
const size_t mbStart = 0,
182 const size_t mbSize = -1) = 0;
196 virtual double compute_function_value(
const DenseVector &point,
const size_t 197 mbStart = 0,
const size_t mbSize = -1);
213 virtual void compute_gradient(
const DenseVector &point, DenseVector&
214 gradient,
const size_t mbStart = 0,
const size_t mbSize = -1);
224 virtual void reset(
int seed);
231 virtual std::vector<std::pair<std::string,size_t>>
232 get_status_header(
const std::vector<std::string>& stats);
240 virtual std::vector<std::string> get_status(
const DenseVector& coefs,
241 const std::vector<std::string>& stats);
272 virtual void compute_second_order_statistics(
const DenseVector &point,
273 DenseMatrix& Hessian, DenseVector& gradient,
double & function_value) = 0;
291 virtual void compute_hessian(
const DenseVector& point, DenseMatrix& hessian);
const double LS_MAX_STEP_SIZE
Max allowable step size.
const double LS_C2
Line search curvature approximation.
const double LS_INFTY
No steps that are too large.
const double OPTIMIZATION_ZERO
Optimization method zero.
Optimization terminated by user.
Model was loaded but the solution was not found.
OPTIMIZATION_STATUS
Optimization status.
const std::map< std::string, flex_type_enum > default_solver_option_types
Types of the solver options.
const double LS_C1
Line search sufficient decrease parameters.
const double FINITE_DIFFERENCE_EPSILON
Finite difference parameters (required for gradient checking)
const int LS_MAX_ITER
Num func evals before a failed line search.
const std::map< std::string, flexible_type > default_solver_options
Solver options type is a map from string to flexible_type.
Optimizer wasn't called.
const double LS_SAFE_GUARD
Safe guarding tolerance for line search.
Line search iteration limit hit.
Numerical overflow. Step size parameter may be too large.
const double OPTIMIZATION_INFTY
Optimization method infinity.
Doing fine, hasn't completed yet.
const double LS_ZERO
Smallest allowable step length.
Numerical underflow (not enough progress).