Running LogisticRegression and SVC
In this exercise, you'll apply logistic regression and a support vector machine to classify images of handwritten digits.
Diese Übung ist Teil des Kurses
Linear Classifiers in Python
Anleitung zur Übung
- Apply logistic regression and SVM (using
SVC()
) to the handwritten digits data set using the provided train/validation split. - For each classifier, print out the training and validation accuracy.
Interaktive Übung
Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.
from sklearn import datasets
digits = datasets.load_digits()
X_train, X_test, y_train, y_test = train_test_split(digits.data, digits.target)
# Apply logistic regression and print scores
lr = ____
lr.____
print(____)
print(____)
# Apply SVM and print scores
svm = ____
svm.____
print(____)
print(____)