liveBook · Manning

Adam

As explained in Deep Learning with R, Third Edition

Adam is an adaptive stochastic optimization algorithm that uses estimates of first and second moments of gradients to update parameters.

Adam is an adaptive stochastic optimization algorithm that uses estimates of gradient moments to update neural-network parameters. In model compilation, it defines how gradient descent changes the model’s weights to reduce the loss. section 2.5

Compiling a binary classifier

A binary classifier can pair Adam with binary cross-entropy and accuracy monitoring. This practical combination is presented as a strong default for problems whose output is a probability. section 4.1.3 section 4.1.7

Listing 4.5 Compiling the model
model |> compile(
  optimizer = "adam",
  loss = "binary_crossentropy",
  metrics = c("accuracy")
)

Use the complete compilation example to see Adam configured alongside binary cross-entropy and accuracy. section 4.1.3

model |> compile(
  optimizer = "adam",
  loss = "sparse_categorical_crossentropy",
  metrics = "accuracy"
)

Use the MNIST compilation example to see Adam applied to a multiclass neural network. section 2.5

fit(model, train_images, train_labels, epochs = 5, batch_size = 128)

Follow the training call to connect Adam with mini-batches, epochs, gradient computation, and weight updates. section 2.5

How Deep Learning with R, Third Edition covers it

How deep it goes
Identifies Adam’s optimizer role and default usefulness but does not derive its moment estimates or update equations.
Examples
Uses MNIST digit classification and binary probability classification as concrete Adam configurations.
What it assumes
Assumes basic familiarity with neural-network layers, losses, weights, gradients, and model training.
What you can do after
Apply Adam via Keras to compile and train classification models.
How it connects
Connects Adam to loss functions, gradient descent, backpropagation, mini-batch training, and model compilation.

Also explained in

Compare how 7 books explain adam →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Deep Learning with R, Third Edition. The section links point to the parts of the book it draws on.