61 bool enable_newton_if_fail)
63 m_enable_newton_if_fail = enable_newton_if_fail;
81 int orthantwise_start,
85 m_max_linesearch = max_linesearch;
86 m_linesearch = linesearch;
87 m_max_iterations = max_iterations;
91 m_min_step = min_step;
92 m_max_step = max_step;
97 m_orthantwise_c = orthantwise_c;
98 m_orthantwise_start = orthantwise_start;
99 m_orthantwise_end = orthantwise_end;
102 void CSingleLaplacianInferenceMethodWithLBFGS::init()
108 "The number of corrections to approximate the inverse hessian matrix",
110 SG_ADD(&m_max_linesearch,
"max_linesearch",
111 "The maximum number of trials to do line search for each L-BFGS update",
113 SG_ADD(&m_linesearch,
"linesearch",
114 "The line search algorithm",
116 SG_ADD(&m_max_iterations,
"max_iterations",
117 "The maximum number of iterations for L-BFGS update",
120 "Delta for convergence test based on the change of function value",
123 "Distance for delta-based convergence test",
125 SG_ADD(&m_epsilon,
"epsilon",
126 "Epsilon for convergence test based on the change of gradient",
128 SG_ADD(&m_min_step,
"min_step",
129 "The minimum step of the line search",
131 SG_ADD(&m_max_step,
"max_step",
132 "The maximum step of the line search",
135 "A parameter used in Armijo condition",
138 "A parameter used in curvature condition",
141 "A parameter used in Morethuente linesearch to control the accuracy",
144 "The machine precision for floating-point values",
146 SG_ADD(&m_orthantwise_c,
"orthantwise_c",
147 "Coeefficient for the L1 norm of variables",
149 SG_ADD(&m_orthantwise_start,
"orthantwise_start",
150 "Start index for computing L1 norm of the variables",
152 SG_ADD(&m_orthantwise_end,
"orthantwise_end",
153 "End index for computing L1 norm of the variables",
155 SG_ADD(&m_enable_newton_if_fail,
"enable_newton_if_fail",
156 "Enable the original Newton method if the L-BFGS method fails",
164 float64_t CSingleLaplacianInferenceMethodWithLBFGS::evaluate(
180 obj_prt->get_psi_wrt_alpha(alpha_cast, dim, psi);
181 obj_prt->get_gradient_wrt_alpha(alpha_cast, gradient, dim);
206 lbfgs_param.
delta = m_delta;
207 lbfgs_param.
past = m_past;
208 lbfgs_param.
epsilon = m_epsilon;
211 lbfgs_param.
ftol = m_ftol;
212 lbfgs_param.
wolfe = m_wolfe;
213 lbfgs_param.
gtol = m_gtol;
214 lbfgs_param.
xtol = m_xtol;
231 void * obj_prt =
static_cast<void *
>(
this);
234 CSingleLaplacianInferenceMethodWithLBFGS::evaluate,
235 NULL, obj_prt, &lbfgs_param);
248 SG_WARNING(
"Error during L-BFGS optimization, using original Newton method as fallback\n");
256 void CSingleLaplacianInferenceMethodWithLBFGS::get_psi_wrt_alpha(
274 psi = eigen_alpha.dot(eigen_f - eigen_mean_f) * 0.5;
278 void CSingleLaplacianInferenceMethodWithLBFGS::get_gradient_wrt_alpha(
285 SGVector<float64_t> f(dim);
296 SGVector<float64_t> dlp_f =
virtual ~CSingleLaplacianInferenceMethodWithLBFGS()
virtual SGVector< float64_t > get_log_probability_f(const CLabels *lab, SGVector< float64_t > func) const =0
SGVector< float64_t > m_alpha
int32_t lbfgs(int32_t n, float64_t *x, float64_t *ptr_fx, lbfgs_evaluate_t proc_evaluate, lbfgs_progress_t proc_progress, void *instance, lbfgs_parameter_t *_param, lbfgs_adjust_step_t proc_adjust_step)
The class Labels models labels, i.e. class assignments of objects.
virtual void update_alpha()
virtual void set_lbfgs_parameters(int m=100, int max_linesearch=1000, int linesearch=LBFGS_LINESEARCH_BACKTRACKING_STRONG_WOLFE, int max_iterations=1000, float64_t delta=0.0, int past=0, float64_t epsilon=1e-5, float64_t min_step=1e-20, float64_t max_step=1e+20, float64_t ftol=1e-4, float64_t wolfe=0.9, float64_t gtol=0.9, float64_t xtol=1e-16, float64_t orthantwise_c=0.0, int orthantwise_start=0, int orthantwise_end=1)
CSingleLaplacianInferenceMethodWithLBFGS()
virtual SGVector< float64_t > get_mean_vector(const CFeatures *features) const =0
An abstract class of the mean function.
static const float64_t epsilon
virtual void update_alpha()
The SingleLaplace approximation inference method class for regression and binary Classification.
SGVector< float64_t > m_mu
static T sum(T *vec, int32_t len)
Return sum(vec)
all of classes and functions are contained in the shogun namespace
The class Features is the base class of all feature objects.
static float64_t exp(float64_t x)
The Laplace approximation inference method with LBFGS class for regression and binary classification...
virtual SGVector< float64_t > get_log_probability_derivative_f(const CLabels *lab, SGVector< float64_t > func, index_t i) const =0
The Likelihood model base class.
SGMatrix< float64_t > m_ktrtr
CLikelihoodModel * m_model
virtual void set_newton_method(bool enable_newton_if_fail)