Multiclass Classification

English translation

Understanding the relationship between class scores, probabilities, and ground truth labels helps you interpret multiclass classification errors and incorrect labels.

Before practice

01 Can each class probability be interpreted independently?

Description

Softmax converts class scores to probabilities that sum to 1, so changing one score also affects the other probabilities.

02 How does one incorrect label affect training and evaluation?

Description

Training follows the modified labels, but errors against the original labels may increase.

Practice

Preview practice notebookDownload practice notebook

1. Comparing multiclass logits and predictions

Starting conditions

Generate 6 samples per class, 18 in total, around the provided centers (-2,0),(2,0),(0,2). Use seed=7.

Procedure

  1. Check the input and label shapes for Linear(2,3) and CrossEntropy.
  2. Record the 3 logits, 3 probabilities, and prediction for each of the first 6 samples.
  3. Plot a scatter plot of the data and a loss curve.

Results to retain

Items to record and points to check
Samples
Answer
3 logits
3 probabilities
Prediction

Points to check

  • Do probabilities sum to 1 for each sample, and do logits and probabilities have the same argmax?
  • Did you use integer indices for class labels?

2. Results by class and ambiguous inputs

Starting conditions

Pass query=[(-2,0),(2,0),(0,2),(0,0)] to the trained model.

Procedure

  1. Create a 3×3 confusion matrix for the 18 training samples.
  2. Record the probabilities and predictions for the 4 query points in a table.
  3. Compare the probability distributions for the cluster centers and (0,0).

Results to retain

Items to record and points to check
query
P0
P1
P2
Prediction
Interpretation

Points to check

  • Does the confusion matrix sum to 18?
  • Did you avoid interpreting the maximum probability as an absolute guarantee of the model's reliability?

3. Data with one changed label

Starting conditions

Change only sample 0's label from 0 to 1, and retrain under the same conditions.

Procedure

  1. First mark the changed label and its position.
  2. Compare the baseline and modified models in terms of loss, errors against original labels, and errors against modified labels.
  3. Explain the training difficulty by distinguishing issues with the iteration count from issues with the data.

Results to retain

Items to record and points to check
Model
Final loss
Error count against original labels
Error count against modified labels

Points to check

  • Did you keep the input data and initialization unchanged?
  • Did you specify which labels were used as the evaluation reference?