Use Classes 0–4 from the 8×8 images in sklearn load_digits, which requires no external download. Use a stratified 70/30 split with seed=7.
Procedure
Inspect one image's 8×8 array and its Flattened 64 features.
Perform baseline classification using StandardScaler fitted on train data and LogisticRegression(max_iter=1000).
Results to retain
A data structure table, example image panel, and Test Accuracy.
Items to record and points to check
Step
Number of samples
Input shape
Label range
Points to check
Did you check image position information and the element order after Flatten?
2. Misclassifications and Ambiguous Inputs
Starting conditions
Select up to 6 misclassified Test samples and display each image, true label, prediction, and maximum probability together. If there are none, select low-confidence samples.
Procedure
Find Indices where Test predictions differ from true labels and select the first 6 at most. If there are no misclassifications, select up to 6 in ascending order of maximum predicted probability.
Plot the original 64 values for each Index as a image, with Test Index, true label, prediction, and maximum probability in the title.
Distinguish features observed in the plots from model predictions in your explanation. Do not retrain the model or Scaler.
Results to retain
An image panel showing Test Index, true label, prediction, and probability.
Items to record and points to check
Selected Test Index
Original image
True labels and predictions
Maximum prediction probability and observations
Points to check
Do the image, Label, and probabilities correspond to the selected Index?
3. Checking Other Inputs
Starting conditions
Add small noise using seed=7 to one selected test image, clip to the 0~16 range, and compare predictions.
Procedure
Choose one test image from Activity 2 and record its index. Add small noise with Seed 7 and limit the pixel range using np.clip(...,0,16). For example, you can use normal noise with mean 0 and standard deviation 0.5.
Display original and noisy images using the same brightness range. Feed each image into the same Scaler and model to obtain the predicted Class and per-Class probabilities.
Record the noise distribution and magnitude used, both predictions, and their probabilities. Explain whether visual changes and prediction changes mean the same thing.
Results to retain
Compare original and noisy images, along with the same model's predictions and probabilities.
Items to record and points to check
Test Index and noise conditions
Original and noisy images
Original predictions and per-Class probabilities
Predictions and per-Class probabilities for noisy images
Points to check
Did you change only the image while keeping the scaler and classifier fixed?