DOC added examples to ridge classes
@@ -779,6 +779,15 @@ class RidgeClassifier(LinearClassifierMixin, _BaseRidge):
Actual number of iterations for each target. Available only for
sag and lsqr solvers. Other solvers will return None.
+ Examples
+ --------
+ >>> from sklearn.datasets import load_breast_cancer
+ >>> from sklearn.linear_model import RidgeClassifier
+ >>> X, y = load_breast_cancer(return_X_y=True)
+ >>> clf = RidgeClassifier().fit(X, y)
+ >>> clf.score(X, y) # doctest: +ELLIPSIS
+ 0.9595...
+
See also
--------
Ridge : Ridge regression
@@ -1249,6 +1258,15 @@ class RidgeCV(_BaseRidgeCV, RegressorMixin):
alpha_ : float
Estimated regularization parameter.
+ Examples
+ --------
+ >>> from sklearn.datasets import load_diabetes
+ >>> from sklearn.linear_model import RidgeCV
+ >>> X, y = load_diabetes(return_X_y=True)
+ >>> clf = RidgeCV(alphas=[1e-3, 1e-2, 1e-1, 1]).fit(X, y)
+ >>> clf.score(X, y) # doctest: +ELLIPSIS
+ 0.5166...
+
See also
--------
Ridge : Ridge regression
@@ -1339,6 +1357,15 @@ class RidgeClassifierCV(LinearClassifierMixin, _BaseRidgeCV):
alpha_ : float
Estimated regularization parameter
+ Examples
+ --------
+ >>> from sklearn.datasets import load_breast_cancer
+ >>> from sklearn.linear_model import RidgeClassifierCV
+ >>> X, y = load_breast_cancer(return_X_y=True)
+ >>> clf = RidgeClassifierCV(alphas=[1e-3, 1e-2, 1e-1, 1]).fit(X, y)
+ >>> clf.score(X, y) # doctest: +ELLIPSIS
+ 0.9630...
+
See also
--------
Ridge : Ridge regression
