September 2014
Intermediate to advanced
512 pages
12h 39m
English
In this recipe, we will see how to recognize handwritten digits with a K-nearest neighbors (K-NN) classifier. This classifier is a simple but powerful model, well-adapted to complex, highly nonlinear datasets such as images. We will explain how it works later in this recipe.
In [1]: import numpy as np
import sklearn
import sklearn.datasets as ds
import sklearn.cross_validation as cv
import sklearn.neighbors as nb
import matplotlib.pyplot as plt
%matplotlib inlinedatasets module of scikit-learn. This dataset contains handwritten digits that have been manually labeled:In [2]: digits = ds.load_digits() ...
Read now
Unlock full access