From d30f7ad7e7db034726e008cf58d73b3517920f0d Mon Sep 17 00:00:00 2001 From: Tuhin Sharma Date: Thu, 25 Apr 2024 23:04:43 +0530 Subject: [PATCH 01/10] DOC: add elasticnet example to doc/modules/linear_model.rst --- doc/modules/linear_model.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/modules/linear_model.rst b/doc/modules/linear_model.rst index b92a8c2a01019..06826c398f635 100644 --- a/doc/modules/linear_model.rst +++ b/doc/modules/linear_model.rst @@ -530,6 +530,7 @@ The class :class:`ElasticNetCV` can be used to set the parameters * :ref:`sphx_glr_auto_examples_linear_model_plot_lasso_and_elasticnet.py` * :ref:`sphx_glr_auto_examples_linear_model_plot_lasso_coordinate_descent_path.py` + * :ref:`sphx_glr_auto_examples_linear_model_plot_elastic_net_precomputed_gram_matrix_with_weighted_samples.py` |details-start| **References** From 802e86a691dbbf4ddc3b5ad4789fce2a6cb05e3f Mon Sep 17 00:00:00 2001 From: Tuhin Sharma Date: Thu, 25 Apr 2024 23:05:30 +0530 Subject: [PATCH 02/10] DOC: add elasticnet example to ElasticNet docstring --- sklearn/linear_model/_coordinate_descent.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sklearn/linear_model/_coordinate_descent.py b/sklearn/linear_model/_coordinate_descent.py index 05d7b93f3e090..c40405410ce45 100644 --- a/sklearn/linear_model/_coordinate_descent.py +++ b/sklearn/linear_model/_coordinate_descent.py @@ -859,6 +859,11 @@ class ElasticNet(MultiOutputMixin, RegressorMixin, LinearModel): If so, then additionally check whether the dual gap is smaller than `tol` times :math:`||y||_2^2 / n_{\text{samples}}`. + For an example, + see :ref:`examples/linear_model/plot_elastic_net_\precomputed_gram_matrix_with_\ + weighted_samples `. + Examples -------- >>> from sklearn.linear_model import ElasticNet From e8f876cc96cd2a645e61ae6a849a44af99fe4167 Mon Sep 17 00:00:00 2001 From: Tuhin Sharma Date: Thu, 25 Apr 2024 23:17:15 +0530 Subject: [PATCH 03/10] DOC: remove extra \ --- sklearn/linear_model/_coordinate_descent.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sklearn/linear_model/_coordinate_descent.py b/sklearn/linear_model/_coordinate_descent.py index c40405410ce45..fea8fada27b2c 100644 --- a/sklearn/linear_model/_coordinate_descent.py +++ b/sklearn/linear_model/_coordinate_descent.py @@ -860,7 +860,7 @@ class ElasticNet(MultiOutputMixin, RegressorMixin, LinearModel): :math:`||y||_2^2 / n_{\text{samples}}`. For an example, - see :ref:`examples/linear_model/plot_elastic_net_\precomputed_gram_matrix_with_\ + see :ref:`examples/linear_model/plot_elastic_net_precomputed_gram_matrix_with_\ weighted_samples `. From 55aec739630de82e10de812e9443b47558d06108 Mon Sep 17 00:00:00 2001 From: Tuhin Sharma Date: Fri, 26 Apr 2024 00:03:03 +0530 Subject: [PATCH 04/10] DOC: remove linebreak --- sklearn/linear_model/_coordinate_descent.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sklearn/linear_model/_coordinate_descent.py b/sklearn/linear_model/_coordinate_descent.py index fea8fada27b2c..6f1bbcd2fc3e2 100644 --- a/sklearn/linear_model/_coordinate_descent.py +++ b/sklearn/linear_model/_coordinate_descent.py @@ -860,9 +860,8 @@ class ElasticNet(MultiOutputMixin, RegressorMixin, LinearModel): :math:`||y||_2^2 / n_{\text{samples}}`. For an example, - see :ref:`examples/linear_model/plot_elastic_net_precomputed_gram_matrix_with_\ - weighted_samples `. + see :ref:`examples/linear_model/plot_elastic_net_precomputed_gram_matrix_with_weighted_samples + `. Examples -------- From ba7ae9d7a030bf7f229f8ebff4b2b55a81f7a0cc Mon Sep 17 00:00:00 2001 From: Tuhin Sharma Date: Fri, 26 Apr 2024 00:05:23 +0530 Subject: [PATCH 05/10] DOC: add linebreaks --- sklearn/linear_model/_coordinate_descent.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sklearn/linear_model/_coordinate_descent.py b/sklearn/linear_model/_coordinate_descent.py index 6f1bbcd2fc3e2..a1f08bc56f0f4 100644 --- a/sklearn/linear_model/_coordinate_descent.py +++ b/sklearn/linear_model/_coordinate_descent.py @@ -860,8 +860,9 @@ class ElasticNet(MultiOutputMixin, RegressorMixin, LinearModel): :math:`||y||_2^2 / n_{\text{samples}}`. For an example, - see :ref:`examples/linear_model/plot_elastic_net_precomputed_gram_matrix_with_weighted_samples - `. + see :ref:`examples/linear_model/plot_elastic_net_precomputed_gram_matrix_with_we\ + ighted_samples `. Examples -------- From a69d4ac1b983f8cb5491b67eef9007a5e004e7b3 Mon Sep 17 00:00:00 2001 From: Tuhin Sharma Date: Fri, 26 Apr 2024 02:32:24 +0530 Subject: [PATCH 06/10] DOC: replace sphinx ref link --- sklearn/linear_model/_coordinate_descent.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sklearn/linear_model/_coordinate_descent.py b/sklearn/linear_model/_coordinate_descent.py index a1f08bc56f0f4..cae74880a12d2 100644 --- a/sklearn/linear_model/_coordinate_descent.py +++ b/sklearn/linear_model/_coordinate_descent.py @@ -859,10 +859,8 @@ class ElasticNet(MultiOutputMixin, RegressorMixin, LinearModel): If so, then additionally check whether the dual gap is smaller than `tol` times :math:`||y||_2^2 / n_{\text{samples}}`. - For an example, - see :ref:`examples/linear_model/plot_elastic_net_precomputed_gram_matrix_with_we\ - ighted_samples `. + For an example, see + :ref:`sphx_glr_auto_examples_linear_model_plot_elastic_net_precomputed_gram_matrix_with_weighted_samples.py`. Examples -------- From c09efc8d203101337d7fe3b679b45abbc27c6a1b Mon Sep 17 00:00:00 2001 From: Tuhin Sharma Date: Fri, 26 Apr 2024 02:41:15 +0530 Subject: [PATCH 07/10] DOC: replace sphinx ref link with exaple path --- sklearn/linear_model/_coordinate_descent.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sklearn/linear_model/_coordinate_descent.py b/sklearn/linear_model/_coordinate_descent.py index cae74880a12d2..1de4ba65ef802 100644 --- a/sklearn/linear_model/_coordinate_descent.py +++ b/sklearn/linear_model/_coordinate_descent.py @@ -860,7 +860,8 @@ class ElasticNet(MultiOutputMixin, RegressorMixin, LinearModel): :math:`||y||_2^2 / n_{\text{samples}}`. For an example, see - :ref:`sphx_glr_auto_examples_linear_model_plot_elastic_net_precomputed_gram_matrix_with_weighted_samples.py`. + :ref:`examples/linear_model/plot_elastic_net_precomputed_gram_matrix_with_weighted_samples.py + `. Examples -------- From 821ab710ef9fdfd189c578e519a1c96c6e57ffc9 Mon Sep 17 00:00:00 2001 From: Tuhin Sharma Date: Fri, 26 Apr 2024 22:56:54 +0530 Subject: [PATCH 08/10] moved example from Notes to precompute --- sklearn/linear_model/_coordinate_descent.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sklearn/linear_model/_coordinate_descent.py b/sklearn/linear_model/_coordinate_descent.py index 1de4ba65ef802..1c67c6fba420f 100644 --- a/sklearn/linear_model/_coordinate_descent.py +++ b/sklearn/linear_model/_coordinate_descent.py @@ -776,6 +776,9 @@ class ElasticNet(MultiOutputMixin, RegressorMixin, LinearModel): Whether to use a precomputed Gram matrix to speed up calculations. The Gram matrix can also be passed as argument. For sparse input this option is always ``False`` to preserve sparsity. + For an example, see + :ref:`examples/linear_model/plot_elastic_net_precomputed_gram_matrix_with_weighted_samples.py + `. max_iter : int, default=1000 The maximum number of iterations. @@ -859,10 +862,6 @@ class ElasticNet(MultiOutputMixin, RegressorMixin, LinearModel): If so, then additionally check whether the dual gap is smaller than `tol` times :math:`||y||_2^2 / n_{\text{samples}}`. - For an example, see - :ref:`examples/linear_model/plot_elastic_net_precomputed_gram_matrix_with_weighted_samples.py - `. - Examples -------- >>> from sklearn.linear_model import ElasticNet From ebec86873ab68d9c517e832a441e33ba768cae2e Mon Sep 17 00:00:00 2001 From: Tuhin Sharma Date: Mon, 29 Apr 2024 18:43:18 +0530 Subject: [PATCH 09/10] DOC: change language for the example in precompute --- sklearn/linear_model/_coordinate_descent.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sklearn/linear_model/_coordinate_descent.py b/sklearn/linear_model/_coordinate_descent.py index 1c67c6fba420f..6cfacf0cbfc3f 100644 --- a/sklearn/linear_model/_coordinate_descent.py +++ b/sklearn/linear_model/_coordinate_descent.py @@ -776,9 +776,9 @@ class ElasticNet(MultiOutputMixin, RegressorMixin, LinearModel): Whether to use a precomputed Gram matrix to speed up calculations. The Gram matrix can also be passed as argument. For sparse input this option is always ``False`` to preserve sparsity. - For an example, see - :ref:`examples/linear_model/plot_elastic_net_precomputed_gram_matrix_with_weighted_samples.py - `. + Check :ref:`an example on how to use a precomputed Gram Matrix in ElasticNet + ` + for details.``` max_iter : int, default=1000 The maximum number of iterations. From cc595e8a9a157ae61f56a8a767f8989b5cec638a Mon Sep 17 00:00:00 2001 From: Tuhin Sharma Date: Mon, 29 Apr 2024 20:09:30 +0530 Subject: [PATCH 10/10] DOC: add . at the end of the parameter description --- sklearn/linear_model/_coordinate_descent.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sklearn/linear_model/_coordinate_descent.py b/sklearn/linear_model/_coordinate_descent.py index 6cfacf0cbfc3f..981cefed899d5 100644 --- a/sklearn/linear_model/_coordinate_descent.py +++ b/sklearn/linear_model/_coordinate_descent.py @@ -778,7 +778,7 @@ class ElasticNet(MultiOutputMixin, RegressorMixin, LinearModel): For sparse input this option is always ``False`` to preserve sparsity. Check :ref:`an example on how to use a precomputed Gram Matrix in ElasticNet ` - for details.``` + for details. max_iter : int, default=1000 The maximum number of iterations.