Consider the digits data set from Exercise12. In this exercise, we would like to train a binary
Question:
Consider the digits data set from Exercise12.
In this exercise, we would like to train a binary classifier for the identification of digit 8 .
(a) Divide the data such that the first 1000 rows are used as the training set and the rest are used as the test set.
(b) Train the LogisticRegression classifier from the sklearn.linear_model package.
(c) "Train" a naïve classifier that always returns 0 . That is, the naïve classifier identifies each instance as being not 8 .
(d) Compare the zero-one test losses of the logistic regression and the naïve classifiers.
(e) Find the confusion matrix, the precision, and the recall of the logistic regression classifier.
(f) Find the fraction of eights that are correctly detected by the logistic regression classifier.
Step by Step Answer:
Data Science And Machine Learning Mathematical And Statistical Methods
ISBN: 9781118710852
1st Edition
Authors: Dirk P. Kroese, Thomas Taimre, Radislav Vaisman, Zdravko Botev