liveBook · Manning

Class probability distribution

As explained in Deep Learning with R, Third Edition

A class probability is a model's estimated probability that an input belongs to a particular class, represented here as a distribution across all classes.

A class probability distribution is the model’s probability estimate for every possible class. Its entries form a vector whose values sum to 1, with one entry per class. section 4.2.5 section 4.2.3

Reading predictions

For a 46-topic classifier, predict() returns one 46-entry vector for each input. The largest entry identifies the predicted topic. In the digit example, predictions[1, 8] is 0.9993394, so class 8 receives the highest score. section 4.2.5

A distribution communicates more than the single winning class:

  • Each position corresponds to a different output class. section 4.2.3
  • Softmax produces scores that sum to 1, allowing the entries to be read as probabilities. section 2.1 section 4.2.5
  • Categorical crossentropy compares the predicted distribution with the true label distribution during training. section 4.2.3
predictions <- model |> predict(x_test)

Inspect the R prediction call that generates class probability distributions for new samples. section 4.2.5

How Deep Learning with R, Third Edition covers it

How deep it goes
Explains vector structure, normalization, maximum selection, softmax, and categorical crossentropy without deriving the underlying mathematics.
Examples
Demonstrates distributions with MNIST digit predictions and a 46-class topic-classification model.
What you can do after
Apply it via Keras predict(), inspect class scores, verify normalization, and select the highest-probability class.
How it connects
Connects class probability distributions to softmax activation, neural networks, categorical crossentropy, and accuracy metrics.

Also explained in

Compare how 2 books explain class probability distribution →

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.