November 2017
Intermediate to advanced
1035 pages
11h 31m
English
In the previous chapter we used a support vector machine to classify the handwritten digits in the MNIST dataset. In this section we will classify the images using an artificial neural network:
from sklearn.datasets import load_digits from sklearn.cross_validation import train_test_split, cross_val_score from sklearn.pipeline import Pipeline from sklearn.preprocessing import StandardScaler from sklearn.neural_network.multilayer_perceptron import MultilayerPerceptronClassifier
First we use the load_digits convenience function to load the MNIST dataset. We will fork additional processes during cross validation, which requires execution from a main-protected block:
>>> if __name__ == '__main__': >>> digits = load_digits() ...
Read now
Unlock full access