Linear Classifiers in Python
Michael (Mike) Gelbart
Instructor, The University of British Columbia
Logistic regression:
Support vector machine (SVM):
Logistic regression in sklearn:
linear_model.LogisticRegression
Key hyperparameters in sklearn:
C
(inverse regularization strength)penalty
(type of regularization)multi_class
(type of multi-class)SVM in sklearn:
svm.LinearSVC
and svm.SVC
Key hyperparameters in sklearn:
C
(inverse regularization strength)kernel
(type of kernel)gamma
(inverse RBF smoothness)SGDClassifier
: scales well to large datasets
from sklearn.linear_model import SGDClassifier
logreg = SGDClassifier(loss='log_loss')
linsvm = SGDClassifier(loss='hinge')
SGDClassifier
hyperparameter alpha
is like 1/C
Linear Classifiers in Python