Skip to content

DOC Ensures that BayesianRidge passes numpydoc validation #20389

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion maint_tools/test_docstrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"AgglomerativeClustering",
"BaggingClassifier",
"BaggingRegressor",
"BayesianRidge",
"BernoulliNB",
"BernoulliRBM",
"Binarizer",
Expand Down
30 changes: 17 additions & 13 deletions sklearn/linear_model/_bayes.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ class BayesianRidge(RegressorMixin, LinearModel):
verbose : bool, default=False
Verbose mode when fitting the model.


Attributes
----------
coef_ : array-like of shape (n_features,)
Expand Down Expand Up @@ -137,14 +136,9 @@ class BayesianRidge(RegressorMixin, LinearModel):

.. versionadded:: 0.24

Examples
See Also
--------
>>> from sklearn import linear_model
>>> clf = linear_model.BayesianRidge()
>>> clf.fit([[0,0], [1, 1], [2, 2]], [0, 1, 2])
BayesianRidge()
>>> clf.predict([[1, 1]])
array([1.])
ARDRegression : Bayesian ARD regression.

Notes
-----
Expand All @@ -163,6 +157,15 @@ class BayesianRidge(RegressorMixin, LinearModel):

M. E. Tipping, Sparse Bayesian Learning and the Relevance Vector Machine,
Journal of Machine Learning Research, Vol. 1, 2001.

Examples
--------
>>> from sklearn import linear_model
>>> clf = linear_model.BayesianRidge()
>>> clf.fit([[0,0], [1, 1], [2, 2]], [0, 1, 2])
BayesianRidge()
>>> clf.predict([[1, 1]])
array([1.])
"""

def __init__(
Expand Down Expand Up @@ -197,24 +200,25 @@ def __init__(
self.verbose = verbose

def fit(self, X, y, sample_weight=None):
"""Fit the model
"""Fit the model.

Parameters
----------
X : ndarray of shape (n_samples, n_features)
Training data
Training data.
y : ndarray of shape (n_samples,)
Target values. Will be cast to X's dtype if necessary
Target values. Will be cast to X's dtype if necessary.

sample_weight : ndarray of shape (n_samples,), default=None
Individual weights for each sample
Individual weights for each sample.

.. versionadded:: 0.20
parameter *sample_weight* support to BayesianRidge.

Returns
-------
self : returns an instance of self.
self : object
Returns the instance itself.
"""
self._normalize = _deprecate_normalize(
self.normalize, default=False, estimator_name=self.__class__.__name__
Expand Down