From 0875cdf3a47b8e71499921d2b9b0bdb608871769 Mon Sep 17 00:00:00 2001 From: anmatngu Date: Sun, 3 Nov 2024 19:42:52 +0700 Subject: [PATCH 01/13] DOC: Link examples for SGDClassifier, NuSVR, and GradientBoostingRegressor --- examples/applications/plot_model_complexity_influence.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/examples/applications/plot_model_complexity_influence.py b/examples/applications/plot_model_complexity_influence.py index 342dd4d899dab..3713adaa06958 100644 --- a/examples/applications/plot_model_complexity_influence.py +++ b/examples/applications/plot_model_complexity_influence.py @@ -16,10 +16,12 @@ We will model the complexity influence on three different estimators: - :class:`~sklearn.linear_model.SGDClassifier` (for classification data) - which implements stochastic gradient descent learning; - + which implements stochastic gradient descent learning. + See example for comparison with different penalties: :ref:`sphx_glr_auto_examples_linear_model_plot_sgd_penalties.py` + - :class:`~sklearn.svm.NuSVR` (for regression data) which implements - Nu support vector regression; + Nu support vector regression. + See example of its application: :ref:`sphx_glr_auto_examples_svm_plot_svm_regression.py` - :class:`~sklearn.ensemble.GradientBoostingRegressor` builds an additive model in a forward stage-wise fashion. Notice that @@ -27,6 +29,7 @@ than :class:`~sklearn.ensemble.GradientBoostingRegressor` starting with intermediate datasets (`n_samples >= 10_000`), which is not the case for this example. + See detailed example: :ref:`sphx_glr_auto_examples_ensemble_plot_gradient_boosting_regression.py` We make the model complexity vary through the choice of relevant model From d06c4ac1fd28398d8c8b53cd5970e1a86ce819b8 Mon Sep 17 00:00:00 2001 From: anmatngu Date: Sun, 3 Nov 2024 19:53:15 +0700 Subject: [PATCH 02/13] DOC: Fix formatting and line length for compliance with black and ruff --- .../applications/plot_model_complexity_influence.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/examples/applications/plot_model_complexity_influence.py b/examples/applications/plot_model_complexity_influence.py index 3713adaa06958..565b8d3a47b28 100644 --- a/examples/applications/plot_model_complexity_influence.py +++ b/examples/applications/plot_model_complexity_influence.py @@ -17,19 +17,20 @@ We will model the complexity influence on three different estimators: - :class:`~sklearn.linear_model.SGDClassifier` (for classification data) which implements stochastic gradient descent learning. - See example for comparison with different penalties: :ref:`sphx_glr_auto_examples_linear_model_plot_sgd_penalties.py` - + See example for comparison with different penalties: + :ref:`sphx_glr_auto_examples_linear_model_plot_sgd_penalties.py` + - :class:`~sklearn.svm.NuSVR` (for regression data) which implements - Nu support vector regression. - See example of its application: :ref:`sphx_glr_auto_examples_svm_plot_svm_regression.py` + Nu support vector regression. See example of its application: + :ref:`sphx_glr_auto_examples_svm_plot_svm_regression.py` - :class:`~sklearn.ensemble.GradientBoostingRegressor` builds an additive model in a forward stage-wise fashion. Notice that :class:`~sklearn.ensemble.HistGradientBoostingRegressor` is much faster than :class:`~sklearn.ensemble.GradientBoostingRegressor` starting with intermediate datasets (`n_samples >= 10_000`), which is not the case for - this example. - See detailed example: :ref:`sphx_glr_auto_examples_ensemble_plot_gradient_boosting_regression.py` + this example. See detailed example: + :ref:`sphx_glr_auto_examples_ensemble_plot_gradient_boosting_regression.py` We make the model complexity vary through the choice of relevant model From 58e6e0cc7308f98efc2c748bbd107ce9cf4c07b5 Mon Sep 17 00:00:00 2001 From: anmatngu Date: Sun, 3 Nov 2024 19:56:43 +0700 Subject: [PATCH 03/13] STYLE: Fix trailing whitespace (W291) in code --- examples/applications/plot_model_complexity_influence.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/applications/plot_model_complexity_influence.py b/examples/applications/plot_model_complexity_influence.py index 565b8d3a47b28..ab10b5e1d3f87 100644 --- a/examples/applications/plot_model_complexity_influence.py +++ b/examples/applications/plot_model_complexity_influence.py @@ -17,11 +17,11 @@ We will model the complexity influence on three different estimators: - :class:`~sklearn.linear_model.SGDClassifier` (for classification data) which implements stochastic gradient descent learning. - See example for comparison with different penalties: + See example for comparison with different penalties: :ref:`sphx_glr_auto_examples_linear_model_plot_sgd_penalties.py` - :class:`~sklearn.svm.NuSVR` (for regression data) which implements - Nu support vector regression. See example of its application: + Nu support vector regression. See example of its application: :ref:`sphx_glr_auto_examples_svm_plot_svm_regression.py` - :class:`~sklearn.ensemble.GradientBoostingRegressor` builds an additive @@ -29,7 +29,7 @@ :class:`~sklearn.ensemble.HistGradientBoostingRegressor` is much faster than :class:`~sklearn.ensemble.GradientBoostingRegressor` starting with intermediate datasets (`n_samples >= 10_000`), which is not the case for - this example. See detailed example: + this example. See detailed example: :ref:`sphx_glr_auto_examples_ensemble_plot_gradient_boosting_regression.py` From 5de0832ec1aff49262bd0ab3290b9264eb3b01e1 Mon Sep 17 00:00:00 2001 From: anmatngu Date: Sun, 10 Nov 2024 16:54:06 +0700 Subject: [PATCH 04/13] Add ref to SVM, NuSVM and SVM user guide --- doc/modules/svm.rst | 1 + sklearn/svm/_classes.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/modules/svm.rst b/doc/modules/svm.rst index fd58b87f3dde4..b4093bf5152a0 100644 --- a/doc/modules/svm.rst +++ b/doc/modules/svm.rst @@ -339,6 +339,7 @@ floating point values instead of integer values:: >>> regr.predict([[1, 1]]) array([1.5]) +See a visualization example of Support Vector Regression with different kernels in :ref:`sphx_glr_auto_examples_svm_plot_svm_regression.py`. .. rubric:: Examples diff --git a/sklearn/svm/_classes.py b/sklearn/svm/_classes.py index f4e4aa118c069..c499d28a8063b 100644 --- a/sklearn/svm/_classes.py +++ b/sklearn/svm/_classes.py @@ -1209,6 +1209,7 @@ class SVR(RegressorMixin, BaseLibSVM): other :ref:`kernel_approximation`. Read more in the :ref:`User Guide `. + See a visualization example in :ref:`sphx_glr_auto_examples_svm_plot_svm_regression.py`. Parameters ---------- @@ -1407,7 +1408,8 @@ class NuSVR(RegressorMixin, BaseLibSVM): The implementation is based on libsvm. Read more in the :ref:`User Guide `. - + See a visualization example in :ref:`sphx_glr_auto_examples_svm_plot_svm_regression.py`. + Parameters ---------- nu : float, default=0.5 From 25e8213d259bfc3b46eec0e351b5fde7aca82d6f Mon Sep 17 00:00:00 2001 From: anmatngu Date: Sun, 10 Nov 2024 16:54:11 +0700 Subject: [PATCH 05/13] Update plot_model_complexity_influence.py --- .../applications/plot_model_complexity_influence.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/examples/applications/plot_model_complexity_influence.py b/examples/applications/plot_model_complexity_influence.py index ab10b5e1d3f87..d2a8213f5e4d8 100644 --- a/examples/applications/plot_model_complexity_influence.py +++ b/examples/applications/plot_model_complexity_influence.py @@ -16,21 +16,17 @@ We will model the complexity influence on three different estimators: - :class:`~sklearn.linear_model.SGDClassifier` (for classification data) - which implements stochastic gradient descent learning. - See example for comparison with different penalties: - :ref:`sphx_glr_auto_examples_linear_model_plot_sgd_penalties.py` + which implements stochastic gradient descent learning;` - :class:`~sklearn.svm.NuSVR` (for regression data) which implements - Nu support vector regression. See example of its application: - :ref:`sphx_glr_auto_examples_svm_plot_svm_regression.py` + Nu support vector regression.` - :class:`~sklearn.ensemble.GradientBoostingRegressor` builds an additive model in a forward stage-wise fashion. Notice that :class:`~sklearn.ensemble.HistGradientBoostingRegressor` is much faster than :class:`~sklearn.ensemble.GradientBoostingRegressor` starting with intermediate datasets (`n_samples >= 10_000`), which is not the case for - this example. See detailed example: - :ref:`sphx_glr_auto_examples_ensemble_plot_gradient_boosting_regression.py` + this example.` We make the model complexity vary through the choice of relevant model From 82d5cc21dfee661994c173fe1ebce4560b689935 Mon Sep 17 00:00:00 2001 From: anmatngu Date: Sun, 10 Nov 2024 17:01:23 +0700 Subject: [PATCH 06/13] Update _classes.py --- sklearn/svm/_classes.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sklearn/svm/_classes.py b/sklearn/svm/_classes.py index c499d28a8063b..9b79a4a63b004 100644 --- a/sklearn/svm/_classes.py +++ b/sklearn/svm/_classes.py @@ -1209,7 +1209,8 @@ class SVR(RegressorMixin, BaseLibSVM): other :ref:`kernel_approximation`. Read more in the :ref:`User Guide `. - See a visualization example in :ref:`sphx_glr_auto_examples_svm_plot_svm_regression.py`. + See a visualization example in + :ref:`sphx_glr_auto_examples_svm_plot_svm_regression.py`. Parameters ---------- @@ -1408,8 +1409,9 @@ class NuSVR(RegressorMixin, BaseLibSVM): The implementation is based on libsvm. Read more in the :ref:`User Guide `. - See a visualization example in :ref:`sphx_glr_auto_examples_svm_plot_svm_regression.py`. - + See a visualization example in + :ref:`sphx_glr_auto_examples_svm_plot_svm_regression.py`. + Parameters ---------- nu : float, default=0.5 From 8249f2ccea93e5545a02deb287148129b2b7c70a Mon Sep 17 00:00:00 2001 From: anmatngu Date: Mon, 11 Nov 2024 21:39:50 +0700 Subject: [PATCH 07/13] Remove redundant backtick --- examples/applications/plot_model_complexity_influence.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/applications/plot_model_complexity_influence.py b/examples/applications/plot_model_complexity_influence.py index d2a8213f5e4d8..342dd4d899dab 100644 --- a/examples/applications/plot_model_complexity_influence.py +++ b/examples/applications/plot_model_complexity_influence.py @@ -16,17 +16,17 @@ We will model the complexity influence on three different estimators: - :class:`~sklearn.linear_model.SGDClassifier` (for classification data) - which implements stochastic gradient descent learning;` + which implements stochastic gradient descent learning; - :class:`~sklearn.svm.NuSVR` (for regression data) which implements - Nu support vector regression.` + Nu support vector regression; - :class:`~sklearn.ensemble.GradientBoostingRegressor` builds an additive model in a forward stage-wise fashion. Notice that :class:`~sklearn.ensemble.HistGradientBoostingRegressor` is much faster than :class:`~sklearn.ensemble.GradientBoostingRegressor` starting with intermediate datasets (`n_samples >= 10_000`), which is not the case for - this example.` + this example. We make the model complexity vary through the choice of relevant model From f8eaa5bdce98078139f43c447962fcff687493b8 Mon Sep 17 00:00:00 2001 From: anmatngu Date: Mon, 11 Nov 2024 21:40:24 +0700 Subject: [PATCH 08/13] Remove redundant reference --- doc/modules/svm.rst | 2 -- 1 file changed, 2 deletions(-) diff --git a/doc/modules/svm.rst b/doc/modules/svm.rst index b4093bf5152a0..72e98e77a844a 100644 --- a/doc/modules/svm.rst +++ b/doc/modules/svm.rst @@ -339,8 +339,6 @@ floating point values instead of integer values:: >>> regr.predict([[1, 1]]) array([1.5]) -See a visualization example of Support Vector Regression with different kernels in :ref:`sphx_glr_auto_examples_svm_plot_svm_regression.py`. - .. rubric:: Examples * :ref:`sphx_glr_auto_examples_svm_plot_svm_regression.py` From 046077688680897c84da4727c0e087ac50c9a1e5 Mon Sep 17 00:00:00 2001 From: anmatngu Date: Mon, 11 Nov 2024 21:41:13 +0700 Subject: [PATCH 09/13] Update line 1158-1159 in sklean/svm/_class.py --- sklearn/svm/_classes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sklearn/svm/_classes.py b/sklearn/svm/_classes.py index bef8eead0ba99..8811defa06cda 100644 --- a/sklearn/svm/_classes.py +++ b/sklearn/svm/_classes.py @@ -1155,8 +1155,8 @@ class SVR(RegressorMixin, BaseLibSVM): other :ref:`kernel_approximation`. Read more in the :ref:`User Guide `. - See a visualization example in - :ref:`sphx_glr_auto_examples_svm_plot_svm_regression.py`. + See :ref:`sphx_glr_auto_examples_svm_plot_svm_regression.py` + for a regression example using SVR with different kernels. Parameters ---------- From 67d83038346cf060b7b77860f8633a35d22388f3 Mon Sep 17 00:00:00 2001 From: anmatngu Date: Mon, 11 Nov 2024 21:42:13 +0700 Subject: [PATCH 10/13] Update line 1348-1349 sklearn/svm/_classes.py --- sklearn/svm/_classes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sklearn/svm/_classes.py b/sklearn/svm/_classes.py index 8811defa06cda..5f9dddd7f0520 100644 --- a/sklearn/svm/_classes.py +++ b/sklearn/svm/_classes.py @@ -1345,8 +1345,8 @@ class NuSVR(RegressorMixin, BaseLibSVM): The implementation is based on libsvm. Read more in the :ref:`User Guide `. - See a visualization example in - :ref:`sphx_glr_auto_examples_svm_plot_svm_regression.py`. + See :ref:`sphx_glr_auto_examples_svm_plot_svm_regression.py` + for a regression example using NuSVR with different kernels. Parameters ---------- From ef9e908ff064054d3677a09577dd3b73b49def5a Mon Sep 17 00:00:00 2001 From: anmatngu Date: Tue, 12 Nov 2024 21:46:34 +0700 Subject: [PATCH 11/13] Update svm.rst --- doc/modules/svm.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/modules/svm.rst b/doc/modules/svm.rst index 72e98e77a844a..fd58b87f3dde4 100644 --- a/doc/modules/svm.rst +++ b/doc/modules/svm.rst @@ -339,6 +339,7 @@ floating point values instead of integer values:: >>> regr.predict([[1, 1]]) array([1.5]) + .. rubric:: Examples * :ref:`sphx_glr_auto_examples_svm_plot_svm_regression.py` From 51a1dee156a6d773a2159cb52c5f2ee990abfe1a Mon Sep 17 00:00:00 2001 From: anmatngu Date: Tue, 12 Nov 2024 21:59:30 +0700 Subject: [PATCH 12/13] Move visualization ref to kernel parameter --- sklearn/svm/_classes.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sklearn/svm/_classes.py b/sklearn/svm/_classes.py index 5f9dddd7f0520..cf37f56974853 100644 --- a/sklearn/svm/_classes.py +++ b/sklearn/svm/_classes.py @@ -1155,8 +1155,6 @@ class SVR(RegressorMixin, BaseLibSVM): other :ref:`kernel_approximation`. Read more in the :ref:`User Guide `. - See :ref:`sphx_glr_auto_examples_svm_plot_svm_regression.py` - for a regression example using SVR with different kernels. Parameters ---------- @@ -1165,6 +1163,8 @@ class SVR(RegressorMixin, BaseLibSVM): Specifies the kernel type to be used in the algorithm. If none is given, 'rbf' will be used. If a callable is given it is used to precompute the kernel matrix. + For an intuitive visualization of different kernel types + see :ref:`sphx_glr_auto_examples_svm_plot_svm_regression.py` degree : int, default=3 Degree of the polynomial kernel function ('poly'). @@ -1345,8 +1345,6 @@ class NuSVR(RegressorMixin, BaseLibSVM): The implementation is based on libsvm. Read more in the :ref:`User Guide `. - See :ref:`sphx_glr_auto_examples_svm_plot_svm_regression.py` - for a regression example using NuSVR with different kernels. Parameters ---------- @@ -1365,6 +1363,8 @@ class NuSVR(RegressorMixin, BaseLibSVM): Specifies the kernel type to be used in the algorithm. If none is given, 'rbf' will be used. If a callable is given it is used to precompute the kernel matrix. + For an intuitive visualization of different kernel types see + See :ref:`sphx_glr_auto_examples_svm_plot_svm_regression.py` degree : int, default=3 Degree of the polynomial kernel function ('poly'). From 6a56227c8f95850bc33ec11692a63e7cf481d259 Mon Sep 17 00:00:00 2001 From: anmatngu Date: Tue, 12 Nov 2024 22:02:38 +0700 Subject: [PATCH 13/13] Remove Trailing whitespace --- sklearn/svm/_classes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sklearn/svm/_classes.py b/sklearn/svm/_classes.py index cf37f56974853..664c7443045d2 100644 --- a/sklearn/svm/_classes.py +++ b/sklearn/svm/_classes.py @@ -1163,7 +1163,7 @@ class SVR(RegressorMixin, BaseLibSVM): Specifies the kernel type to be used in the algorithm. If none is given, 'rbf' will be used. If a callable is given it is used to precompute the kernel matrix. - For an intuitive visualization of different kernel types + For an intuitive visualization of different kernel types see :ref:`sphx_glr_auto_examples_svm_plot_svm_regression.py` degree : int, default=3