Skip to content

DOC - Ensure TheilSenRegressor passes numpydoc validation #21087

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 5 commits into from
Sep 20, 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 @@ -47,7 +47,6 @@
"SplineTransformer",
"StackingClassifier",
"StackingRegressor",
"TheilSenRegressor",
"TransformedTargetRegressor",
"TweedieRegressor",
]
Expand Down
21 changes: 14 additions & 7 deletions sklearn/linear_model/_theil_sen.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ class TheilSenRegressor(RegressorMixin, LinearModel):
A random number generator instance to define the state of the random
permutations generator. Pass an int for reproducible output across
multiple function calls.
See :term:`Glossary <random_state>`
See :term:`Glossary <random_state>`.

n_jobs : int, default=None
Number of CPUs to use during the cross validation.
Expand Down Expand Up @@ -295,6 +295,18 @@ class TheilSenRegressor(RegressorMixin, LinearModel):

.. versionadded:: 1.0

See Also
--------
HuberRegressor : Linear regression model that is robust to outliers.
RANSACRegressor : RANSAC (RANdom SAmple Consensus) algorithm.
SGDRegressor : Fitted by minimizing a regularized empirical loss with SGD.

References
----------
- Theil-Sen Estimators in a Multiple Linear Regression Model, 2009
Xin Dang, Hanxiang Peng, Xueqin Wang and Heping Zhang
http://home.olemiss.edu/~xdang/papers/MTSE.pdf

Examples
--------
>>> from sklearn.linear_model import TheilSenRegressor
Expand All @@ -306,12 +318,6 @@ class TheilSenRegressor(RegressorMixin, LinearModel):
0.9884...
>>> reg.predict(X[:1,])
array([-31.5871...])

References
----------
- Theil-Sen Estimators in a Multiple Linear Regression Model, 2009
Xin Dang, Hanxiang Peng, Xueqin Wang and Heping Zhang
http://home.olemiss.edu/~xdang/papers/MTSE.pdf
"""

def __init__(
Expand Down Expand Up @@ -394,6 +400,7 @@ def fit(self, X, y):
Returns
-------
self : returns an instance of self.
Fitted `TheilSenRegressor` estimator.
"""
random_state = check_random_state(self.random_state)
X, y = self._validate_data(X, y, y_numeric=True)
Expand Down