Path: blob/master/notebooks/book1/10/logreg_sklearn.ipynb
1192 views
Kernel: Python 3
Logistic regression
In this notebook, we illustrate how to perform logistic regression using sklearn. The code is mostly based on https://github.com/ageron/handson-ml2/blob/master/04_training_linear_models.ipynb by Aurelien Geron.
In [ ]:
In [ ]:
In [ ]:
LogisticRegression(C=1000, class_weight=None, dual=False, fit_intercept=True,
intercept_scaling=1, l1_ratio=None, max_iter=100,
multi_class='auto', n_jobs=None, penalty='l2',
random_state=None, solver='lbfgs', tol=0.0001, verbose=0,
warm_start=False)
In [ ]:
/usr/local/lib/python3.6/dist-packages/matplotlib/patches.py:1327: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray
verts = np.dot(coords, M) + (x + dx, y + dy)
In [ ]:
In [ ]:
In [ ]:
In [ ]:
[[0.01 0.4 0.6 ]]
In [ ]:
Made 10 errors out of 50, on instances (array([ 4, 15, 21, 32, 35, 36, 40, 41, 42, 48]),)
Error rates on train 0.180 and test 0.200