new LBFGS(gradient, updater)
Class used to solve an optimization problem using Limited-memory BFGS.
Reference: http://en.wikipedia.org/wiki/Limited-memory_BFGS param: gradient
Gradient function to be used. param: updater Updater to be used to update weights after every iteration.
Parameters:
Name | Type | Description |
---|---|---|
gradient |
module:eclairjs/mllib/optimization.Gradient | |
updater |
module:eclairjs/mllib/optimization.Updater |
Methods
(static) runLBFGS(data, gradient, updater, numCorrections, convergenceTol, maxNumIterations, regParam, initialWeights, testData) → {module:eclairjs.Tuple2}
Run Limited-memory BFGS (L-BFGS) in parallel. Averaging the subgradients over different partitions is performed
using one standard spark map-reduce in each iteration.
Parameters:
Name | Type | Description |
---|---|---|
data |
module:eclairjs.RDD | - Input data for L-BFGS. RDD of the set of data examples, each of the form (label, [feature values]). |
gradient |
module:eclairjs/mllib/optimization.Gradient | - Gradient object (used to compute the gradient of the loss function of one single data example) |
updater |
module:eclairjs/mllib/optimization.Updater | - Updater function to actually perform a gradient step in a given direction. |
numCorrections |
integer | - The number of corrections used in the L-BFGS update. |
convergenceTol |
float | - The convergence tolerance of iterations for L-BFGS which is must be nonnegative. Lower values are less tolerant and therefore generally cause more iterations to be run. |
maxNumIterations |
integer | - Maximal number of iterations that L-BFGS can be run. |
regParam |
float | - Regularization parameter |
initialWeights |
module:eclairjs/mllib/linalg.Vector | (undocumented) |
testData |
Returns:
A tuple containing two elements. The first element is a column matrix containing weights for every feature,
and the second element is an array containing the loss computed for every iteration.
optimize(data, initialWeights) → {module:eclairjs/mllib/linalg.Vector}
Description copied from interface: Optimizer
Solve the provided convex optimization problem.
Parameters:
Name | Type | Description |
---|---|---|
data |
module:eclairjs.RDD | |
initialWeights |
module:eclairjs/mllib/linalg.Vector |
Returns:
setConvergenceTol(tolerance) → {LBFGS}
Set the convergence tolerance of iterations for L-BFGS. Default 0.0001. Smaller value will lead to higher accuracy with the cost of more iterations.
This value must be nonnegative. Lower convergence values are less tolerant and therefore generally cause more iterations to be run.
Parameters:
Name | Type | Description |
---|---|---|
tolerance |
float |
Returns:
- Type
- LBFGS
setGradient(gradient) → {LBFGS}
Set the gradient function (of the loss function of one single data example) to be used for L-BFGS.
Parameters:
Name | Type | Description |
---|---|---|
gradient |
module:eclairjs/mllib/optimization.Gradient |
Returns:
- Type
- LBFGS
setNumCorrections(corrections) → {LBFGS}
Set the number of corrections used in the LBFGS update. Default 10. Values of numCorrections less than 3 are not recommended;
large values of numCorrections will result in excessive computing time. 3 < numCorrections < 10 is recommended. Restriction: numCorrections > 0
Parameters:
Name | Type | Description |
---|---|---|
corrections |
integer |
Returns:
- Type
- LBFGS
setNumIterations(iters) → {LBFGS}
Set the maximal number of iterations for L-BFGS. Default 100.
Parameters:
Name | Type | Description |
---|---|---|
iters |
integer |
Returns:
- Type
- LBFGS
setRegParam(regParam) → {LBFGS}
Set the regularization parameter. Default 0.0.
Parameters:
Name | Type | Description |
---|---|---|
regParam |
float |
Returns:
- Type
- LBFGS
setUpdater(updater) → {LBFGS}
Set the updater function to actually perform a gradient step in a given direction.
The updater is responsible to perform the update from the regularization term as well,
and therefore determines what kind or regularization is used, if any.
Parameters:
Name | Type | Description |
---|---|---|
updater |
module:eclairjs/mllib/optimization.Updater |
Returns:
- Type
- LBFGS