Skip to content

DOC Ensures Lasso passes numpydoc validation #20409

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 2 commits into from
Jun 27, 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 @@ -88,7 +88,6 @@
"LabelSpreading",
"Lars",
"LarsCV",
"Lasso",
"LassoCV",
"LassoLars",
"LassoLarsCV",
Expand Down
3 changes: 1 addition & 2 deletions sklearn/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -558,8 +558,7 @@ class RegressorMixin:
_estimator_type = "regressor"

def score(self, X, y, sample_weight=None):
"""Return the coefficient of determination :math:`R^2` of the
prediction.
"""Return the coefficient of determination :math:`R^2` of the prediction.

The coefficient :math:`R^2` is defined as :math:`(1 - \\frac{u}{v})`,
where :math:`u` is the residual sum of squares ``((y_true - y_pred)
Expand Down
42 changes: 22 additions & 20 deletions sklearn/linear_model/_coordinate_descent.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,10 +478,11 @@ def enet_path(

See Also
--------
MultiTaskElasticNet
MultiTaskElasticNetCV
ElasticNet
ElasticNetCV
MultiTaskElasticNet : Multi-task ElasticNet model trained with L1/L2 mixed-norm \
as regularizer.
MultiTaskElasticNetCV : Multi-task L1/L2 ElasticNet with built-in cross-validation.
ElasticNet : Linear regression with combined L1 and L2 priors as regularizer.
ElasticNetCV : Elastic Net model with iterative fitting along a regularization path.

Notes
-----
Expand Down Expand Up @@ -865,6 +866,7 @@ def fit(self, X, y, sample_weight=None, check_input=True):
Returns
-------
self : object
Fitted estimator.

Notes
-----
Expand Down Expand Up @@ -1178,6 +1180,22 @@ class Lasso(ElasticNet):

.. versionadded:: 0.24

See Also
--------
lars_path : Regularization path using LARS.
lasso_path : Regularization path using Lasso.
LassoLars : Lasso Path along the regularization parameter usingLARS algorithm.
LassoCV : Lasso alpha parameter by cross-validation.
LassoLarsCV : Lasso least angle parameter algorithm by cross-validation.
sklearn.decomposition.sparse_encode : Sparse coding array estimator.

Notes
-----
The algorithm used to fit the model is coordinate descent.

To avoid unnecessary memory duplication the X argument of the fit method
should be directly passed as a Fortran-contiguous numpy array.

Examples
--------
>>> from sklearn import linear_model
Expand All @@ -1188,22 +1206,6 @@ class Lasso(ElasticNet):
[0.85 0. ]
>>> print(clf.intercept_)
0.15...

See Also
--------
lars_path
lasso_path
LassoLars
LassoCV
LassoLarsCV
sklearn.decomposition.sparse_encode

Notes
-----
The algorithm used to fit the model is coordinate descent.

To avoid unnecessary memory duplication the X argument of the fit method
should be directly passed as a Fortran-contiguous numpy array.
"""

path = staticmethod(enet_path)
Expand Down