liveBook · Manning

Negative log-likelihood

As explained in Optimization Algorithms: AI techniques for design, planning, and control problems

Negative log likelihood is a loss equal to the negative logarithm of the probability assigned to the true label.

Negative log-likelihood (NLL) measures how well a multiclass classifier assigns probability to the true label. For true label y and predicted probability p(y), NLL is −log(p(y)); higher confidence in the correct class produces a smaller loss, while low confidence produces a larger one. section 9.7

Calculating batch NLL

A neural network converts logits into class probabilities, selects the probability assigned to each true label, applies −log, and averages the results across samples. This average loss can guide training or evaluate a classifier.

How Optimization Algorithms: AI techniques for design, planning, and control problems covers it

How deep it goes
Defines NLL and explains its behavior, then demonstrates batch computation but stops short of deriving optimization details.
Examples
Demonstrates NLL inside NumPy forward propagation for a neural network trained on the Penguins classification dataset.
What it assumes
Assumes multiclass labels and predicted probabilities while introducing the loss formula and its confidence interpretation.
What you can do after
Apply it via NumPy to compute and average classification loss from logits, probabilities, and true labels.
How it connects
Connects NLL with cross-entropy loss, probability distributions, logits, feedforward networks, and particle swarm optimization.

Also explained in

Compare how 7 books explain negative log-likelihood →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Optimization Algorithms: AI techniques for design, planning, and control problems. The section links point to the parts of the book it draws on.