From 2151847e8074a167003390e79cb85a161e48402b Mon Sep 17 00:00:00 2001 From: mani2106 Date: Sun, 10 Oct 2021 10:43:22 +0530 Subject: [PATCH 1/4] Remove Orthmatchpursuit from exceptions --- maint_tools/test_docstrings.py | 1 - 1 file changed, 1 deletion(-) diff --git a/maint_tools/test_docstrings.py b/maint_tools/test_docstrings.py index bb73b3ad3e22f..2e02e944f37ea 100644 --- a/maint_tools/test_docstrings.py +++ b/maint_tools/test_docstrings.py @@ -18,7 +18,6 @@ "MultiTaskElasticNetCV", "MultiTaskLasso", "MultiTaskLassoCV", - "OrthogonalMatchingPursuit", "OrthogonalMatchingPursuitCV", "PassiveAggressiveClassifier", "PassiveAggressiveRegressor", From b90506410339cf1ed79bdb20741686ce293a812e Mon Sep 17 00:00:00 2001 From: mani2106 Date: Sun, 10 Oct 2021 10:43:59 +0530 Subject: [PATCH 2/4] ensure doc validations pass --- sklearn/linear_model/_omp.py | 43 ++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/sklearn/linear_model/_omp.py b/sklearn/linear_model/_omp.py index 082254a7f5682..bd50c614b44a8 100644 --- a/sklearn/linear_model/_omp.py +++ b/sklearn/linear_model/_omp.py @@ -604,7 +604,7 @@ class OrthogonalMatchingPursuit(MultiOutputMixin, RegressorMixin, LinearModel): Maximum norm of the residual. If not None, overrides n_nonzero_coefs. fit_intercept : bool, default=True - whether to calculate the intercept for this model. If set + Whether to calculate the intercept for this model. If set to false, no intercept will be used in calculations (i.e. data is expected to be centered). @@ -653,16 +653,17 @@ class OrthogonalMatchingPursuit(MultiOutputMixin, RegressorMixin, LinearModel): .. versionadded:: 1.0 - Examples + See Also -------- - >>> from sklearn.linear_model import OrthogonalMatchingPursuit - >>> from sklearn.datasets import make_regression - >>> X, y = make_regression(noise=4, random_state=0) - >>> reg = OrthogonalMatchingPursuit(normalize=False).fit(X, y) - >>> reg.score(X, y) - 0.9991... - >>> reg.predict(X[:1,]) - array([-78.3854...]) + orthogonal_mp : Solves n_targets Orthogonal Matching Pursuit problems. + orthogonal_mp_gram : Solves n_targets Orthogonal Matching Pursuit problems using only + the Gram matrix X.T * X and the product X.T * y. + lars_path : Compute Least Angle Regression or Lasso path using LARS algorithm. + Lars : Least Angle Regression model a.k.a. LAR. + LassoLars : Lasso model fit with Least Angle Regression a.k.a. Lars. + sklearn.decomposition.sparse_encode : Generic sparse coding. + Each column of the result is the solution to a Lasso problem. + OrthogonalMatchingPursuitCV : Cross-validated Orthogonal Matching Pursuit model (OMP). Notes ----- @@ -676,15 +677,16 @@ class OrthogonalMatchingPursuit(MultiOutputMixin, RegressorMixin, LinearModel): Matching Pursuit Technical Report - CS Technion, April 2008. https://www.cs.technion.ac.il/~ronrubin/Publications/KSVD-OMP-v2.pdf - See Also + Examples -------- - orthogonal_mp - orthogonal_mp_gram - lars_path - Lars - LassoLars - sklearn.decomposition.sparse_encode - OrthogonalMatchingPursuitCV + >>> from sklearn.linear_model import OrthogonalMatchingPursuit + >>> from sklearn.datasets import make_regression + >>> X, y = make_regression(noise=4, random_state=0) + >>> reg = OrthogonalMatchingPursuit(normalize=False).fit(X, y) + >>> reg.score(X, y) + 0.9991... + >>> reg.predict(X[:1,]) + array([-78.3854...]) """ def __init__( @@ -711,13 +713,12 @@ def fit(self, X, y): Training data. y : array-like of shape (n_samples,) or (n_samples, n_targets) - Target values. Will be cast to X's dtype if necessary - + Target values. Will be cast to X's dtype if necessary. Returns ------- self : object - returns an instance of self. + Returns an instance of self. """ _normalize = _deprecate_normalize( self.normalize, default=True, estimator_name=self.__class__.__name__ From e5a8e1ba9829095f0b90449b52a24e19c4f7a5ee Mon Sep 17 00:00:00 2001 From: mani2106 Date: Sun, 10 Oct 2021 10:53:30 +0530 Subject: [PATCH 3/4] shorten line length --- sklearn/linear_model/_omp.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sklearn/linear_model/_omp.py b/sklearn/linear_model/_omp.py index bd50c614b44a8..5874698d401e9 100644 --- a/sklearn/linear_model/_omp.py +++ b/sklearn/linear_model/_omp.py @@ -656,14 +656,15 @@ class OrthogonalMatchingPursuit(MultiOutputMixin, RegressorMixin, LinearModel): See Also -------- orthogonal_mp : Solves n_targets Orthogonal Matching Pursuit problems. - orthogonal_mp_gram : Solves n_targets Orthogonal Matching Pursuit problems using only - the Gram matrix X.T * X and the product X.T * y. + orthogonal_mp_gram : Solves n_targets Orthogonal Matching Pursuit + problems using only the Gram matrix X.T * X and the product X.T * y. lars_path : Compute Least Angle Regression or Lasso path using LARS algorithm. Lars : Least Angle Regression model a.k.a. LAR. LassoLars : Lasso model fit with Least Angle Regression a.k.a. Lars. sklearn.decomposition.sparse_encode : Generic sparse coding. Each column of the result is the solution to a Lasso problem. - OrthogonalMatchingPursuitCV : Cross-validated Orthogonal Matching Pursuit model (OMP). + OrthogonalMatchingPursuitCV : Cross-validated + Orthogonal Matching Pursuit model (OMP). Notes ----- From 6fa76d1c01386fd17ada0e7719d03de1e7296ddb Mon Sep 17 00:00:00 2001 From: mani2106 Date: Sun, 10 Oct 2021 10:55:45 +0530 Subject: [PATCH 4/4] remove trailing ws --- sklearn/linear_model/_omp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sklearn/linear_model/_omp.py b/sklearn/linear_model/_omp.py index 5874698d401e9..0dad398104143 100644 --- a/sklearn/linear_model/_omp.py +++ b/sklearn/linear_model/_omp.py @@ -663,7 +663,7 @@ class OrthogonalMatchingPursuit(MultiOutputMixin, RegressorMixin, LinearModel): LassoLars : Lasso model fit with Least Angle Regression a.k.a. Lars. sklearn.decomposition.sparse_encode : Generic sparse coding. Each column of the result is the solution to a Lasso problem. - OrthogonalMatchingPursuitCV : Cross-validated + OrthogonalMatchingPursuitCV : Cross-validated Orthogonal Matching Pursuit model (OMP). Notes