org.apache.spark.mllib.optimization
Class Updater

Object
  extended by org.apache.spark.mllib.optimization.Updater
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
L1Updater, SimpleUpdater, SquaredL2Updater

public abstract class Updater
extends Object
implements scala.Serializable

:: DeveloperApi :: Class used to perform steps (weight update) using Gradient Descent methods.

For general minimization problems, or for regularized problems of the form min L(w) + regParam * R(w), the compute function performs the actual update step, when given some (e.g. stochastic) gradient direction for the loss L(w), and a desired step-size (learning rate).

The updater is responsible to also perform the update coming from the regularization term R(w) (if any regularization is used).

See Also:
Serialized Form

Constructor Summary
Updater()
           
 
Method Summary
abstract  scala.Tuple2<Vector,Object> compute(Vector weightsOld, Vector gradient, double stepSize, int iter, double regParam)
          Compute an updated value for weights given the gradient, stepSize, iteration number and regularization parameter.
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Updater

public Updater()
Method Detail

compute

public abstract scala.Tuple2<Vector,Object> compute(Vector weightsOld,
                                                    Vector gradient,
                                                    double stepSize,
                                                    int iter,
                                                    double regParam)
Compute an updated value for weights given the gradient, stepSize, iteration number and regularization parameter. Also returns the regularization value regParam * R(w) computed using the *updated* weights.

Parameters:
weightsOld - - Column matrix of size dx1 where d is the number of features.
gradient - - Column matrix of size dx1 where d is the number of features.
stepSize - - step size across iterations
iter - - Iteration number
regParam - - Regularization parameter

Returns:
A tuple of 2 elements. The first element is a column matrix containing updated weights, and the second element is the regularization value computed using updated weights.