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






