Using the scikit-learn (sklearn) module

The following example is borrowed from http://scikit-learn.org/stable/auto_examples/classification/plot_digits_classification.html#sphx-glr-auto-examples-classification-plot-digits-classification-py. The program uses the scikit-learn module to recognize images of handwritten digits. The slightly modified code, for an easy presentation, is shown here:

import matplotlib.pyplot as plt from sklearn import datasets, svm, metrics from sklearn.metrics import classification_report as report # format1="Classification report for classifier %s:n%sn" format2="Confusion matrix:n%s" digits = datasets.load_digits() imageLabels = list(zip(digits.images, digits.target)) for index,(image,label) in enumerate(imageLabels[:4]): ...

Get Hands-On Data Science with Anaconda now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.