public class QNMinimizer extends Object
Usage example:
// Quadratic function f(x) = (x-1)^2 + 10 // f obtains its minimum value 10 at x = 1 Function f = new Function() { @Override public int getDimension() { return 1; } @Override public double valueAt(double[] x) { return Math.pow(x[0]-1, 2) + 10; } @Override public double[] gradientAt(double[] x) { return new double[] { 2*(x[0]-1) }; } }; QNMinimizer minimizer = new QNMinimizer(); double[] x = minimizer.minimize(f); double min = f.valueAt(x);
Modifier and Type | Class and Description |
---|---|
static interface |
QNMinimizer.Evaluator
Evaluate quality of training parameters.
|
static class |
QNMinimizer.L2RegFunction
L2-regularized objective function
|
Modifier and Type | Field and Description |
---|---|
static double |
CONVERGE_TOLERANCE |
static double |
INITIAL_STEP_SIZE |
static double |
L1COST_DEFAULT |
static double |
L2COST_DEFAULT |
static int |
M_DEFAULT |
static int |
MAX_FCT_EVAL_DEFAULT |
static double |
MIN_STEP_SIZE |
static int |
NUM_ITERATIONS_DEFAULT |
static double |
REL_GRAD_NORM_TOL |
Constructor and Description |
---|
QNMinimizer() |
QNMinimizer(double l1Cost,
double l2Cost) |
QNMinimizer(double l1Cost,
double l2Cost,
int iterations) |
QNMinimizer(double l1Cost,
double l2Cost,
int iterations,
int m,
int maxFctEval) |
QNMinimizer(double l1Cost,
double l2Cost,
int iterations,
int m,
int maxFctEval,
boolean verbose)
Constructor
|
Modifier and Type | Method and Description |
---|---|
QNMinimizer.Evaluator |
getEvaluator() |
double[] |
minimize(Function function)
Find the parameters that minimize the objective function
|
void |
setEvaluator(QNMinimizer.Evaluator evaluator) |
public static final double CONVERGE_TOLERANCE
public static final double REL_GRAD_NORM_TOL
public static final double INITIAL_STEP_SIZE
public static final double MIN_STEP_SIZE
public static final double L1COST_DEFAULT
public static final double L2COST_DEFAULT
public static final int NUM_ITERATIONS_DEFAULT
public static final int M_DEFAULT
public static final int MAX_FCT_EVAL_DEFAULT
public QNMinimizer()
public QNMinimizer(double l1Cost, double l2Cost)
public QNMinimizer(double l1Cost, double l2Cost, int iterations)
public QNMinimizer(double l1Cost, double l2Cost, int iterations, int m, int maxFctEval)
public QNMinimizer(double l1Cost, double l2Cost, int iterations, int m, int maxFctEval, boolean verbose)
l1Cost
- L1-regularization costl2Cost
- L2-regularization costiterations
- maximum number of iterationsm
- number of Hessian updates to storemaxFctEval
- maximum number of function evaluationsverbose
- verbose outputpublic QNMinimizer.Evaluator getEvaluator()
public void setEvaluator(QNMinimizer.Evaluator evaluator)
public double[] minimize(Function function)
function
- objective functionCopyright © 2015 The Apache Software Foundation. All rights reserved.