Skip to main content
`Ctrl`+`K`

# SVM for QMNIST

We want to classify QMNIST images with an SVM.

## Load Data Set

Task: Load QMNIST training and test data to NumPy arrays as required by Scikit-Learn. Center bounding boxes of all images and crop images to 20x20 pixels.

Solution:

    # your solution

## Linear SVM

The data set is relatively small (60000 training samples) compared to the space dimension (400). So there is some chance that classes can be separated by hyperplanes instead of nonlinear hypersurfaces.

Task: Train and evaluate a linear SVM on the QMNIST training samples with Scikit-Learn’s `LinearSVC` and again with `SGDClassifier`.

Solution:

    # your solution

## Nonlinear SVM

To reduce computation time we should apply PCA to our data set. Thus, inner products are computed in, say, \(\mathbb{R}^{15}\) instead of in \(\mathbb{R}^{400}\).

Task: Apply PCA transform with 15 components to the data. Then train a kernel SVM with rbf kernel.

Solution:

    # your solution

Task: Visualize some support vectors (original images, not PCA coefficients).

Solution:

    # your solution