TKU-IIT / Elite-Course

2 stars 0 forks source link

Logistic regression #3

Open min20120907 opened 4 years ago

min20120907 commented 4 years ago

>>> from sklearn.datasets import load_iris
>>> from sklearn.linear_model import LogisticRegression
>>> X, y = load_iris(return_X_y=True)
>>> clf = LogisticRegression(random_state=0).fit(X, y)
>>> clf.predict(X[:2, :])
array([0, 0])
>>> clf.predict_proba(X[:2, :])
array([[9.8...e-01, 1.8...e-02, 1.4...e-08],
       [9.7...e-01, 2.8...e-02, ...e-08]])
>>> clf.score(X, y)
0.97...
min20120907 commented 4 years ago

https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html