liveBook · Manning

Multicategory classification model

As explained in Learn Generative AI with PyTorch

A supervised neural network model that assigns each input to one of more than two discrete classes.

A multicategory classification model assigns each input to one of more than two discrete classes. Fashion MNIST provides a concrete case: the model distinguishes 10 clothing categories rather than choosing between two labels. section 2.4.2

Compared with binary classification, the network ends with 10 output values. A PyTorch model uses progressively smaller hidden layers—256, 128, and 64 neurons—before producing those outputs. CrossEntropyLoss handles the logits without adding a separate softmax layer. section 2.4.2

Classifying clothing images

Flatten each 28×28 image, train the network with Adam and CrossEntropyLoss, and select the class with torch.argmax. Testing five images produces predicted labels, while evaluation across the test loader reports an accuracy of about 0.882.

How Learn Generative AI with PyTorch covers it

How deep it goes
Explains architecture, loss selection, training, prediction, and accuracy evaluation, but does not develop the underlying loss mathematics.
Examples
Demonstrates ten-class clothing recognition using flattened 28×28 images, five test predictions, and test-set accuracy.
What it assumes
Assumes familiarity with PyTorch neural-network construction, data loaders, tensors, and supervised training loops.
What you can do after
Build and evaluate a PyTorch multicategory classifier using CrossEntropyLoss, argmax predictions, and test accuracy.
How it connects
Connects multicategory classification with binary classification, softmax, CrossEntropyLoss, Adam, and accuracy.

This explainer was generated by Manning's knowledge graph from the text of Learn Generative AI with PyTorch. The section links point to the parts of the book it draws on.