Scikit-Learn tutorial: Iris and digit classification

Learn classification with Scikit-Learn using Iris flowers and 1,797 digit images, then tune an SVM with PCA and a 48-combination grid search.

Player not loading? Watch on YouTube

This Python tutorial uses Scikit-Learn for two classification projects: identifying Iris species from flower measurements and recognizing handwritten digits. It introduces the shared estimator interface, inspectable parameters and pipelines before working through training and evaluation.

The Iris example uses four measurements in centimeters. The tutorial applies StandardScaler, separates training and test data, and trains logistic regression. It explains how to read a confusion matrix and examines model coefficients alongside a pair plot. The speaker reports 100% accuracy in this example, but cautions that the dataset's easily separated classes do not establish reliability on noisier data. New flower measurements need the same scaling transformation as the training inputs.

The digits example contains 1,797 grayscale images, each an 8×8 grid represented by 64 features. The speaker reports 98% accuracy for a support vector classifier, then examines precision, recall and misclassified images. A later pipeline combines scaling, PCA and classification. GridSearchCV evaluates 48 combinations of component counts, C values, kernels and gamma settings. In the reported result, PCA reduces 64 dimensions to 40 while retaining 95% of the variance.