From 1f0df4295c7887504147b72d5070fcfffe867761 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Fuglede=20J=C3=B8rgensen?= Date: Wed, 12 Jul 2023 10:30:59 +0200 Subject: [PATCH 1/2] DOC fix description of tolerance in OMP The phrasing of the documentation suggested that the result was so that the resulting regression coefficients had the property that the norm of the residual was less than `tol`, when in fact all that was guaranteed was that the norm square would be less than `tol`. Looking at the implementation, the latter is very much the intended behavior, so we change the documentation instead of the implementation. --- sklearn/linear_model/_omp.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sklearn/linear_model/_omp.py b/sklearn/linear_model/_omp.py index b3c4381ad13aa..e0ea919b99a73 100644 --- a/sklearn/linear_model/_omp.py +++ b/sklearn/linear_model/_omp.py @@ -332,7 +332,7 @@ def orthogonal_mp( default) this value is set to 10% of n_features. tol : float, default=None - Maximum norm of the residual. If not None, overrides n_nonzero_coefs. + Maximum squared norm of the residual. If not None, overrides n_nonzero_coefs. precompute : 'auto' or bool, default=False Whether to perform precomputations. Improves performance when n_targets @@ -493,7 +493,7 @@ def orthogonal_mp_gram( default) this value is set to 10% of n_features. tol : float, default=None - Maximum norm of the residual. If not `None`, overrides `n_nonzero_coefs`. + Maximum squared norm of the residual. If not `None`, overrides `n_nonzero_coefs`. norms_squared : array-like of shape (n_targets,), default=None Squared L2 norms of the lines of `y`. Required if `tol` is not None. @@ -625,7 +625,7 @@ class OrthogonalMatchingPursuit(MultiOutputMixin, RegressorMixin, LinearModel): default) this value is set to 10% of n_features. tol : float, default=None - Maximum norm of the residual. If not None, overrides n_nonzero_coefs. + Maximum squared 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 From bf16a9353d3043495eaf7de4823b06e44790ed31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Fuglede=20J=C3=B8rgensen?= Date: Wed, 12 Jul 2023 10:58:53 +0200 Subject: [PATCH 2/2] DOC fix OMP documentation line length being too long --- sklearn/linear_model/_omp.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sklearn/linear_model/_omp.py b/sklearn/linear_model/_omp.py index e0ea919b99a73..620e0505703de 100644 --- a/sklearn/linear_model/_omp.py +++ b/sklearn/linear_model/_omp.py @@ -493,7 +493,8 @@ def orthogonal_mp_gram( default) this value is set to 10% of n_features. tol : float, default=None - Maximum squared norm of the residual. If not `None`, overrides `n_nonzero_coefs`. + Maximum squared norm of the residual. If not `None`, + overrides `n_nonzero_coefs`. norms_squared : array-like of shape (n_targets,), default=None Squared L2 norms of the lines of `y`. Required if `tol` is not None.