Exercise

A second toy model

In this exercise, you will build another classifier using logistic regression on a dataset of images. Each image represents a number 0 through 9. The goal is to classify each imagine as a number - for example, a 7 or a 9. The features used are specific pixel values ranging from 0-16 that make up the image. Instead of evaluating accuracy by hand, you will evaluate the accuracy of the model using accuracy_score() from sklearn.

Sample image data is loaded as image_data along with sklearn and pandas as pd. LogisticRegression is available via sklearn.linear_model.

Instructions

100 XP
  • Get the row count of X to determine the index at which to split the training and testing data.
  • Create a logistic regression classifier.
  • Create predictions using the classifier and evaluate the accuracy using accuracy_score() from sklearn.metrics.