DOC added LogisticRegression(CV) examples
@@ -1128,6 +1128,20 @@ class LogisticRegression(BaseEstimator, LinearClassifierMixin,
In SciPy <= 1.0.0 the number of lbfgs iterations may exceed
``max_iter``. ``n_iter_`` will now report at most ``max_iter``.
+ Examples
+ --------
+ >>> 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, :]) # doctest: +ELLIPSIS
+ array([[8.78...e-01, 1.21...e-01, 1.079...e-05],
+ [7.97...e-01, 2.02...e-01, 3.029...e-05]])
+ >>> clf.score(X, y)
+ 0.96
+
See also
--------
SGDClassifier : incrementally trained logistic regression (when given
@@ -1572,6 +1586,20 @@ class LogisticRegressionCV(LogisticRegression, BaseEstimator,
Actual number of iterations for all classes, folds and Cs.
In the binary or multinomial cases, the first dimension is equal to 1.
+ Examples
+ --------
+ >>> from sklearn.datasets import load_iris
+ >>> from sklearn.linear_model import LogisticRegressionCV
+ >>> X, y = load_iris(return_X_y=True)
+ >>> clf = LogisticRegressionCV(cv=5, random_state=0).fit(X, y)
+ >>> clf.predict(X[:2, :])
+ array([0, 0])
+ >>> clf.predict_proba(X[:2, :]) # doctest: +ELLIPSIS
+ array([[8.72...e-01, 1.27...e-01, 5.50...e-14],
+ [6.76...e-01, 3.23...e-01, 2.11...e-13]])
+ >>> clf.score(X, y) # doctest: +ELLIPSIS
+ 0.9266...
+
See also
--------
LogisticRegression
