Machine Learning Lab
Preview learning notebook Download learning notebook
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.
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 Check the input and label shapes for Linear(2,3) and CrossEntropy. Record the 3 logits, 3 probabilities, and prediction for each of the first 6 samples. Plot a scatter plot of the data and a loss curve. Results to retain A 6-row output table and plots of the data and loss. 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 Create a 3×3 confusion matrix for the 18 training samples. Record the probabilities and predictions for the 4 query points in a table. Compare the probability distributions for the cluster centers and (0,0). Results to retain A confusion matrix and a query table. 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 First mark the changed label and its position. Compare the baseline and modified models in terms of loss, errors against original labels, and errors against modified labels. Explain the training difficulty by distinguishing issues with the iteration count from issues with the data. Results to retain A comparison table of the two models and a brief interpretation. 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?