Class AdaGradDA
java.lang.Object
org.tensorflow.framework.optimizers.Optimizer
org.tensorflow.framework.optimizers.AdaGradDA
Optimizer that implements the Adagrad Dual-Averaging algorithm.
This optimizer takes care of regularization of unseen features in a mini batch by updating them when they are seen with a closed form update rule that is equivalent to having updated them on every mini-batch.
AdagradDA is typically used when there is a need for large sparsity in the trained model. This optimizer only guarantees sparsity for linear models. Be careful when using AdagradDA for deep networks as it will require careful initialization of the gradient accumulators for it to train.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class Optimizer
Optimizer.GradAndVar<T>, Optimizer.Options -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final floatstatic final floatstatic final floatstatic final floatstatic final StringFields inherited from class Optimizer
globals, graph, tf, VARIABLE_V2 -
Constructor Summary
ConstructorsConstructorDescriptionCreates an AdaGradDA OptimizerCreates an AdaGradDA OptimizerAdaGradDA(Graph graph, float learningRate, float initialAccumulatorValue, float l1Strength, float l2Strength) Creates an AdaGradDA OptimizerCreates an AdaGradDA OptimizerAdaGradDA(Graph graph, String name, float learningRate, float initialAccumulatorValue, float l1Strength, float l2Strength) Creates an AdaGradDA Optimizer -
Method Summary
Modifier and TypeMethodDescriptionapplyDense(Ops deps, Output<T> gradient, Output<T> variable) Generates the gradient update operations for the specific variable and gradient.protected voidcreateSlots(List<Output<? extends TType>> variables) Performs a No-op slot creation method.protected OpGathers up the update operations into a single op that can be used as a run target.Get the Name of the optimizer.Returns a No-op prepare.toString()Methods inherited from class Optimizer
applyGradients, computeGradients, createName, createSlot, getSlot, getTF, minimize, minimize
-
Field Details
-
ACCUMULATOR
- See Also:
-
SQUARED_ACCUMULATOR
- See Also:
-
LEARNING_RATE_DEFAULT
public static final float LEARNING_RATE_DEFAULT- See Also:
-
INITIAL_ACCUMULATOR_DEFAULT
public static final float INITIAL_ACCUMULATOR_DEFAULT- See Also:
-
L1_STRENGTH_DEFAULT
public static final float L1_STRENGTH_DEFAULT- See Also:
-
L2_STRENGTH_DEFAULT
public static final float L2_STRENGTH_DEFAULT- See Also:
-
-
Constructor Details
-
AdaGradDA
Creates an AdaGradDA Optimizer- Parameters:
graph- the TensorFlow Graph
-
AdaGradDA
Creates an AdaGradDA Optimizer- Parameters:
graph- the TensorFlow GraphlearningRate- the learning rate
-
AdaGradDA
public AdaGradDA(Graph graph, float learningRate, float initialAccumulatorValue, float l1Strength, float l2Strength) Creates an AdaGradDA Optimizer- Parameters:
graph- the TensorFlow GraphlearningRate- the learning rateinitialAccumulatorValue- Starting value for the accumulators, must be greater than zero.l1Strength- l1 regularization strength, must be greater than or equal to zero.l2Strength- l2 regularization strength, must be greater than or equal to zero.- Throws:
IllegalArgumentException- if initialAccumulatorValue is not greater than zero, or l1Strength or l2Strength is less than zero
-
AdaGradDA
-
AdaGradDA
public AdaGradDA(Graph graph, String name, float learningRate, float initialAccumulatorValue, float l1Strength, float l2Strength) Creates an AdaGradDA Optimizer- Parameters:
graph- the TensorFlow Graphname- the name for this Optimizer (defaults to 'adagrad-da')learningRate- the learning rateinitialAccumulatorValue- Starting value for the accumulators, must be positivel1Strength- l1 regularization strength, must be greater than or equal to zero.l2Strength- l2 regularization strength, must be greater than or equal to zero.- Throws:
IllegalArgumentException- if initialAccumulatorValue is not greater than zero, or * l1Strength or l2Strength is less than zero
-
-
Method Details
-
prepare
-
createSlots
Performs a No-op slot creation method.- Overrides:
createSlotsin classOptimizer- Parameters:
variables- The variables to create slots for.
-
applyDense
Generates the gradient update operations for the specific variable and gradient.- Specified by:
applyDensein classOptimizer- Type Parameters:
T- The type of the variable.- Parameters:
gradient- The gradient to use.variable- The variable to update.- Returns:
- An operand which applies the desired optimizer update to the variable.
-
finish
Gathers up the update operations into a single op that can be used as a run target.Adds the global step update to the end of the updates list.
-
toString
-
getOptimizerName
Get the Name of the optimizer.- Specified by:
getOptimizerNamein classOptimizer- Returns:
- The optimizer name.
-