Adam

public class Adam

Optimizer that implements the Adam algorithm.

Adam optimization is a stochastic gradient descent method that is based on adaptive estimation of first-order and second-order moments.

According to Kingma et al., 2014, the method is "computationally efficient, has little memory requirement, invariant to diagonal rescaling of gradients, and is well suited for problems that are large in terms of data/parameters".

@see Kingma et al., 2014, Adam: A Method for Stochastic Optimization .

Constants

float BETA_ONE_DEFAULT
float BETA_TWO_DEFAULT
float EPSILON_DEFAULT
String FIRST_MOMENT
float LEARNING_RATE_DEFAULT
String SECOND_MOMENT

Inherited Constants

Public Constructors

Adam ( Graph graph)
Creates an Adam optimizer
Adam ( Graph graph, float learningRate)
Creates an Adam optimizer
Adam ( Graph graph, float learningRate, float betaOne, float betaTwo, float epsilon)
Creates an Adam optimizer
Adam ( Graph graph, String name, float learningRate)
Creates an Adam optimizer
Adam ( Graph graph, String name, float learningRate, float betaOne, float betaTwo, float epsilon)
Creates an Adam optimizer

Public Methods

static <T extends TType > Op
createAdamMinimize ( Scope scope, Operand <T> loss, float learningRate, float betaOne, float betaTwo, float epsilon, Options... options)
Creates the Operation that minimizes the loss
String
getOptimizerName ()
Get the Name of the optimizer.
String

Inherited Methods

Constants

public static final float BETA_ONE_DEFAULT

Constant Value: 0.9

public static final float BETA_TWO_DEFAULT

Constant Value: 0.999

public static final float EPSILON_DEFAULT

Constant Value: 1.0E-8

public static final String FIRST_MOMENT

Constant Value: "m"

public static final float LEARNING_RATE_DEFAULT

Constant Value: 0.001

public static final String SECOND_MOMENT

Constant Value: "v"

Public Constructors

public Adam ( Graph graph)

Creates an Adam optimizer

Parameters
graph the TensorFlow graph

public Adam ( Graph graph, float learningRate)

Creates an Adam optimizer

Parameters
graph the TensorFlow graph
learningRate the learning rate

public Adam ( Graph graph, float learningRate, float betaOne, float betaTwo, float epsilon)

Creates an Adam optimizer

Parameters
graph the TensorFlow graph
learningRate the learning rate
betaOne The exponential decay rate for the 1st moment estimates. Defaults to 0.9.
betaTwo The exponential decay rate for the 2nd moment estimates. Defaults to 0.999.
epsilon A small constant for numerical stability. This epsilon is "epsilon hat" in the Kingma and Ba paper (in the formula just before Section 2.1), not the epsilon in Algorithm 1 of the paper. Defaults to 1e-8.

public Adam ( Graph graph, String name, float learningRate)

Creates an Adam optimizer

Parameters
graph the TensorFlow graph
name the Optimizer name, defaults to "Adam"
learningRate the learning rate

public Adam ( Graph graph, String name, float learningRate, float betaOne, float betaTwo, float epsilon)

Creates an Adam optimizer

Parameters
graph the TensorFlow graph
name the Optimizer name, defaults to "Adam"
learningRate the learning rate
betaOne The exponential decay rate for the 1st moment estimates. Defaults to 0.9.
betaTwo The exponential decay rate for the 2nd moment estimates. Defaults to 0.999.
epsilon A small constant for numerical stability. This epsilon is "epsilon hat" in the Kingma and Ba paper (in the formula just before Section 2.1), not the epsilon in Algorithm 1 of the paper. Defaults to 1e-8.

Public Methods

public static Op createAdamMinimize ( Scope scope, Operand <T> loss, float learningRate, float betaOne, float betaTwo, float epsilon, Options... options)

Creates the Operation that minimizes the loss

Parameters
scope the TensorFlow scope
loss the loss to minimize
learningRate the learning rate
betaOne The exponential decay rate for the 1st moment estimates.
betaTwo The exponential decay rate for the 2nd moment estimates.
epsilon A small constant for numerical stability. This epsilon is "epsilon hat" in the Kingma and Ba paper (in the formula just before Section 2.1), not the epsilon in Algorithm 1 of the paper.
options Optional Optimizer attributes
Returns
  • the Operation that minimizes the loss
Throws
IllegalArgumentException if scope does not represent a Graph

public String getOptimizerName ()

Get the Name of the optimizer.

Returns
  • The optimizer name.

public String toString ()