liveBook · Manning

Logit

As explained in Math and Architectures of Deep Learning

A vector of unnormalized class scores produced by a classifier before conversion to probabilities.

A logit is one unnormalized score in a classifier’s score vector. Each coordinate corresponds to a class, and the largest score determines the predicted label before probabilities are computed. section 9.1.5

Logits can be any real numbers, from negative to positive infinity. Unlike probabilities, they do not need to lie between 0 and 1 or sum to 1. Softmax converts the complete logit vector into a probability vector while preserving the ordering of scores. section 9.1.5

Classifying an image

For the logit vector [9.99, 10, 0.01, −10], index 1 has the greatest score, so the predicted class is dog. Softmax produces approximately [0.497, 0.502, …], showing that dog is favored but cat remains plausible. section 9.1.5

In LeNet, fully connected layers produce a 10-dimensional logits vector, with one score for each class. A softmax layer converts these scores into probabilities, and CrossEntropyLoss compares the prediction with the ground truth. section 11.1

Equation 9.6

Use the softmax equation to connect individual logits with the normalized class-probability vector. section 9.1.5

Listing 9.4 PyTorch code for softmax
from torch.nn.functional import softmax      #1

scores = torch.tensor([9.99, 10, 0.01, -10]) #2

output = softmax(scores, dim=0)              #3

The PyTorch listing shows softmax applied along the score-vector dimension. section 9.1.5

How Math and Architectures of Deep Learning covers it

How deep it goes
Defines unbounded class scores, explains their normalization, and demonstrates numerical and PyTorch counterparts without deriving training gradients.
Examples
Uses a four-class image score vector and a 10-class LeNet output to illustrate prediction and probability conversion.
What it assumes
Assumes familiarity with classifier classes and neural-network outputs while establishing the distinction between scores and probabilities.
What you can do after
Apply logits by interpreting classifier outputs, identifying the maximal class, and converting scores with PyTorch softmax.
How it connects
Connects logits with classifiers, softmax, argmax, probability vectors, CrossEntropyLoss, and fully connected layers.

Also explained in

Compare how 17 books explain logit →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Math and Architectures of Deep Learning. The section links point to the parts of the book it draws on.