jsat.math.optimization
Class ModifiedOWLQN
- java.lang.Object
-
- jsat.math.optimization.ModifiedOWLQN
-
- All Implemented Interfaces:
- Optimizer
public class ModifiedOWLQN extends java.lang.Object implements Optimizer
This implements the Modified Orthant-Wise Limited memory Quasi-Newton(mOWL-QN) optimizer. This algorithm is an extension ofLBFGS, and solves minimization problems of the form: f(x) +λ||x||1. It requires the function and it's gradient to work.
See:
- Gong, P., & Ye, J. (2015). A Modified Orthant-Wise Limited Memory Quasi-Newton Method with Convergence Analysis. In The 32nd International Conference on Machine Learning (Vol. 37).
- Andrew, G., & Gao, J. (2007). Scalable training of L1 -regularized log-linear models. In Proceedings of the 24th international conference on Machine learning - ICML ’07 (pp. 33–40). New York, New York, USA: ACM Press. doi:10.1145/1273496.1273501
-
-
Constructor Summary
Constructors Constructor and Description ModifiedOWLQN()Creates a new mOWL-QN optimizer with no regularization penaltyModifiedOWLQN(double lambda)Creates a new mOWL-QN optimizer
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description ModifiedOWLQNclone()doublegetBeta()doublegetEps()VecgetLambdaMultipler()intgetM()Returns the number of history items that will be usedintgetMaximumIterations()Returns the maximum number of iterations to performvoidoptimize(double tolerance, Vec w, Vec x0, Function f, FunctionVec fp, boolean parallel)Attempts to optimize the given function by finding the value ofwthat will minimize the value returned byf(w), using w = x0 as an initial starting point.voidsetBeta(double beta)Sets the shrinkage term used for the line search.voidsetEps(double eps)Sets the epsilon term that helps control when the gradient descent step is taken instead of the normal Quasi-Newton step.voidsetLambda(double lambda)Sets the regularization term for the optimizervoidsetLambdaMultipler(Vec lambdaMultipler)This method sets a vector that will contain a separate multiplier forlambdafor each dimension of the problem.voidsetM(int m)Sets the number of history items to keep that are used to approximate the Hessian of the problemvoidsetMaximumIterations(int iterations)Sets the maximum number of iterations allowed for the optimization method
-
-
-
Constructor Detail
-
ModifiedOWLQN
public ModifiedOWLQN()
Creates a new mOWL-QN optimizer with no regularization penalty
-
ModifiedOWLQN
public ModifiedOWLQN(double lambda)
Creates a new mOWL-QN optimizer- Parameters:
lambda- the regularization penalty to use
-
-
Method Detail
-
setLambda
public void setLambda(double lambda)
Sets the regularization term for the optimizer- Parameters:
lambda- the regularization penalty
-
setLambdaMultipler
public void setLambdaMultipler(Vec lambdaMultipler)
This method sets a vector that will contain a separate multiplier forlambdafor each dimension of the problem. This allows for each dimension to have a different regularization penalty.
If set tonull, all dimensions will simply use λ as their regularization value.- Parameters:
lambdaMultipler- the per-dimension regularization multiplier, ornull.
-
getLambdaMultipler
public Vec getLambdaMultipler()
-
setM
public void setM(int m)
Sets the number of history items to keep that are used to approximate the Hessian of the problem- Parameters:
m- the number of history items to keep
-
getM
public int getM()
Returns the number of history items that will be used- Returns:
- the number of history items that will be used
-
setEps
public void setEps(double eps)
Sets the epsilon term that helps control when the gradient descent step is taken instead of the normal Quasi-Newton step. Larger values cause more GD steps. You shouldn't need to alter this variable- Parameters:
eps- tolerance term for GD steps
-
getEps
public double getEps()
-
setBeta
public void setBeta(double beta)
Sets the shrinkage term used for the line search.- Parameters:
beta- the line search shrinkage term
-
getBeta
public double getBeta()
-
optimize
public void optimize(double tolerance, Vec w, Vec x0, Function f, FunctionVec fp, boolean parallel)Description copied from interface:OptimizerAttempts to optimize the given function by finding the value ofwthat will minimize the value returned byf(w), using w = x0 as an initial starting point.- Specified by:
optimizein interfaceOptimizer- Parameters:
tolerance- the value that the gradient norm must be less than to consider convergedw- the the location to store the final solutionx0- the initial guess for the solution. This value will not be changed, and intermediate matrices will be created as the same type.f- the objective function to minimizerfp- the derivative of the objective function, may benulldepending on the optimizerparallel-trueif multiple threads should be used for optimization, orfalseif a single thread should be used.
-
setMaximumIterations
public void setMaximumIterations(int iterations)
Description copied from interface:OptimizerSets the maximum number of iterations allowed for the optimization method- Specified by:
setMaximumIterationsin interfaceOptimizer- Parameters:
iterations- the maximum number of iterations to perform
-
getMaximumIterations
public int getMaximumIterations()
Description copied from interface:OptimizerReturns the maximum number of iterations to perform- Specified by:
getMaximumIterationsin interfaceOptimizer- Returns:
- the maximum number of iterations to perform
-
clone
public ModifiedOWLQN clone()
-
-
DataMelt 3.0 © DataMelt by jWork.ORG