A category, or class, is one discrete option in a classification problem. Each sample receives a label identifying its associated class, such as a digit or news topic. section 2.1 section 4.0
Handwritten digits
MNIST classifies 28×28 grayscale images into ten classes, 0 through 9. A Keras model returns ten probabilities for an image; the class with the largest probability becomes the predicted class. section 2.1
Distinguish the related terms:
- A class is a possible category; a label is the particular class annotation attached to one sample. section 4.0
- A prediction is the model output, while the target is the class the model should ideally produce. section 4.0
- For multiclass output, probabilities form a distribution across all classes, and the largest entry identifies the predicted class. section 4.2.5
predictions <- model |> predict(x_test)
Inspect the prediction matrix returned by Keras before selecting the highest-probability class. section 4.2.5


