8000 DOC - Ensure HuberRegressor passes numpydoc validation by EricEllwanger · Pull Request #21062 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

DOC - Ensure HuberRegressor passes numpydoc validation #21062

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 11 commits into from
Sep 17, 2021
Merged
1 change: 0 additions & 1 deletion maint_tools/test_docstrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

# List of modules ignored when checking for numpydoc validation.
DOCSTRING_IGNORE_LIST = [
"HuberRegressor",
"IterativeImputer",
"KNNImputer",
"LabelPropagation",
Expand Down
21 changes: 14 additions & 7 deletions sklearn/linear_model/_huber.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,19 @@ class HuberRegressor(LinearModel, RegressorMixin, BaseEstimator):
A boolean mask which is set to True where the samples are identified
as outliers.

See Also
--------
RANSACRegressor : RANSAC (RANdom SAmple Consensus) algorithm.
TheilSenRegressor : Theil-Sen Estimator robust multivariate regression model.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add the SGDRegressor as well. This estimator can get several loss functions as the Huber loss as well.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment has not been addressed yet.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be added now

SGDRegressor : Fitted by minimizing a regularized empirical loss with SGD.

References
----------
.. [1] Peter J. Huber, Elvezio M. Ronchetti, Robust Statistics
Concomitant scale estimates, pg 172
.. [2] Art B. Owen (2006), A robust hybrid of lasso and ridge regression.
https://statweb.stanford.edu/~owen/reports/hhu.pdf

Examples
--------
>>> import numpy as np
Expand All @@ -227,13 +240,6 @@ class HuberRegressor(LinearModel, RegressorMixin, BaseEstimator):
Huber coefficients: [17.7906... 31.0106...]
>>> print("Linear Regression coefficients:", linear.coef_)
Linear Regression coefficients: [-1.9221... 7.0226...]

References
----------
.. [1] Peter J. Huber, Elvezio M. Ronchetti, Robust Statistics
Concomitant scale estimates, pg 172
.. [2] Art B. Owen (2006), A robust hybrid of lasso and ridge regression.
https://statweb.stanford.edu/~owen/reports/hhu.pdf
"""

def __init__(
Expand Down Expand Up @@ -271,6 +277,7 @@ def fit(self, X, y, sample_weight=None):
Returns
-------
self : object
Fitted `HuberRegressor` estimator.
"""
X, y = self._validate_data(
X,
Expand Down
0