From da2bd3bdc45b7009f2a075dd28dbf33e7dc81118 Mon Sep 17 00:00:00 2001 From: mandjevant <38689620+mandjevant@users.noreply.github.com> Date: Mon, 15 Nov 2021 11:31:45 +0100 Subject: [PATCH 1/4] DOC svm _classes add callable as accepted type for parameter 'kernel' --- sklearn/svm/_classes.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sklearn/svm/_classes.py b/sklearn/svm/_classes.py index 719540cd725c0..0165210d40114 100644 --- a/sklearn/svm/_classes.py +++ b/sklearn/svm/_classes.py @@ -538,7 +538,7 @@ class SVC(BaseSVC): inversely proportional to C. Must be strictly positive. The penalty is a squared l2 penalty. - kernel : {'linear', 'poly', 'rbf', 'sigmoid', 'precomputed'}, default='rbf' + kernel : {'linear', 'poly', 'rbf', 'sigmoid', 'precomputed'} or callable, default='rbf' Specifies the kernel type to be used in the algorithm. It must be one of 'linear', 'poly', 'rbf', 'sigmoid', 'precomputed' or a callable. @@ -795,7 +795,7 @@ class NuSVC(BaseSVC): `) and a lower bound of the fraction of support vectors. Should be in the interval (0, 1]. - kernel : {'linear', 'poly', 'rbf', 'sigmoid', 'precomputed'}, default='rbf' + kernel : {'linear', 'poly', 'rbf', 'sigmoid', 'precomputed'} or callable, default='rbf' Specifies the kernel type to be used in the algorithm. It must be one of 'linear', 'poly', 'rbf', 'sigmoid', 'precomputed' or a callable. @@ -1053,7 +1053,7 @@ class SVR(RegressorMixin, BaseLibSVM): Parameters ---------- - kernel : {'linear', 'poly', 'rbf', 'sigmoid', 'precomputed'}, default='rbf' + kernel : {'linear', 'poly', 'rbf', 'sigmoid', 'precomputed'} or callable, default='rbf' Specifies the kernel type to be used in the algorithm. It must be one of 'linear', 'poly', 'rbf', 'sigmoid', 'precomputed' or a callable. @@ -1252,7 +1252,7 @@ class NuSVR(RegressorMixin, BaseLibSVM): C : float, default=1.0 Penalty parameter C of the error term. - kernel : {'linear', 'poly', 'rbf', 'sigmoid', 'precomputed'}, default='rbf' + kernel : {'linear', 'poly', 'rbf', 'sigmoid', 'precomputed'} or callable, default='rbf' Specifies the kernel type to be used in the algorithm. It must be one of 'linear', 'poly', 'rbf', 'sigmoid', 'precomputed' or a callable. @@ -1430,7 +1430,7 @@ class OneClassSVM(OutlierMixin, BaseLibSVM): Parameters ---------- - kernel : {'linear', 'poly', 'rbf', 'sigmoid', 'precomputed'}, default='rbf' + kernel : {'linear', 'poly', 'rbf', 'sigmoid', 'precomputed'} or callable, default='rbf' Specifies the kernel type to be used in the algorithm. It must be one of 'linear', 'poly', 'rbf', 'sigmoid', 'precomputed' or a callable. From 810a4f6ff72a0e546386448182acf03059fdeefb Mon Sep 17 00:00:00 2001 From: mandjevant <38689620+mandjevant@users.noreply.github.com> Date: Mon, 15 Nov 2021 14:58:46 +0100 Subject: [PATCH 2/4] Reposition sentence for linter. --- sklearn/svm/_classes.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/sklearn/svm/_classes.py b/sklearn/svm/_classes.py index 0165210d40114..c7468d0ba3ce1 100644 --- a/sklearn/svm/_classes.py +++ b/sklearn/svm/_classes.py @@ -538,7 +538,8 @@ class SVC(BaseSVC): inversely proportional to C. Must be strictly positive. The penalty is a squared l2 penalty. - kernel : {'linear', 'poly', 'rbf', 'sigmoid', 'precomputed'} or callable, default='rbf' + kernel : {'linear', 'poly', 'rbf', 'sigmoid', 'precomputed'} or callable, \ + default='rbf' Specifies the kernel type to be used in the algorithm. It must be one of 'linear', 'poly', 'rbf', 'sigmoid', 'precomputed' or a callable. @@ -795,7 +796,8 @@ class NuSVC(BaseSVC): `) and a lower bound of the fraction of support vectors. Should be in the interval (0, 1]. - kernel : {'linear', 'poly', 'rbf', 'sigmoid', 'precomputed'} or callable, default='rbf' + kernel : {'linear', 'poly', 'rbf', 'sigmoid', 'precomputed'} or callable, \ + default='rbf' Specifies the kernel type to be used in the algorithm. It must be one of 'linear', 'poly', 'rbf', 'sigmoid', 'precomputed' or a callable. @@ -1053,7 +1055,8 @@ class SVR(RegressorMixin, BaseLibSVM): Parameters ---------- - kernel : {'linear', 'poly', 'rbf', 'sigmoid', 'precomputed'} or callable, default='rbf' + kernel : {'linear', 'poly', 'rbf', 'sigmoid', 'precomputed'} or callable, \ + default='rbf' Specifies the kernel type to be used in the algorithm. It must be one of 'linear', 'poly', 'rbf', 'sigmoid', 'precomputed' or a callable. @@ -1252,7 +1255,8 @@ class NuSVR(RegressorMixin, BaseLibSVM): C : float, default=1.0 Penalty parameter C of the error term. - kernel : {'linear', 'poly', 'rbf', 'sigmoid', 'precomputed'} or callable, default='rbf' + kernel : {'linear', 'poly', 'rbf', 'sigmoid', 'precomputed'} or callable, \ + default='rbf' Specifies the kernel type to be used in the algorithm. It must be one of 'linear', 'poly', 'rbf', 'sigmoid', 'precomputed' or a callable. @@ -1430,7 +1434,8 @@ class OneClassSVM(OutlierMixin, BaseLibSVM): Parameters ---------- - kernel : {'linear', 'poly', 'rbf', 'sigmoid', 'precomputed'} or callable, default='rbf' + kernel : {'linear', 'poly', 'rbf', 'sigmoid', 'precomputed'} or callable, \ + default='rbf' Specifies the kernel type to be used in the algorithm. It must be one of 'linear', 'poly', 'rbf', 'sigmoid', 'precomputed' or a callable. From 24e4fbe9219c2b9790e45e27c1b41ec7edf03044 Mon Sep 17 00:00:00 2001 From: "Tholhuijsen, P.T.C.M" Date: Thu, 25 Nov 2021 23:07:29 +0100 Subject: [PATCH 3/4] DOC Remove redundant parameter description. --- sklearn/svm/_classes.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/sklearn/svm/_classes.py b/sklearn/svm/_classes.py index c7468d0ba3ce1..d694b31b7e092 100644 --- a/sklearn/svm/_classes.py +++ b/sklearn/svm/_classes.py @@ -541,8 +541,6 @@ class SVC(BaseSVC): kernel : {'linear', 'poly', 'rbf', 'sigmoid', 'precomputed'} or callable, \ default='rbf' Specifies the kernel type to be used in the algorithm. - It must be one of 'linear', 'poly', 'rbf', 'sigmoid', 'precomputed' or - a callable. If none is given, 'rbf' will be used. If a callable is given it is used to pre-compute the kernel matrix from data matrices; that matrix should be an array of shape ``(n_samples, n_samples)``. From af9e8b2327381954af638188818676e59a8c3c1f Mon Sep 17 00:00:00 2001 From: mandjevant <38689620+mandjevant@users.noreply.github.com> Date: Fri, 26 Nov 2021 19:49:07 +0100 Subject: [PATCH 4/4] DOC remove redundant parameter declaration --- sklearn/svm/_classes.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/sklearn/svm/_classes.py b/sklearn/svm/_classes.py index d694b31b7e092..ff853b194baad 100644 --- a/sklearn/svm/_classes.py +++ b/sklearn/svm/_classes.py @@ -797,8 +797,6 @@ class NuSVC(BaseSVC): kernel : {'linear', 'poly', 'rbf', 'sigmoid', 'precomputed'} or callable, \ default='rbf' Specifies the kernel type to be used in the algorithm. - It must be one of 'linear', 'poly', 'rbf', 'sigmoid', 'precomputed' or - a callable. If none is given, 'rbf' will be used. If a callable is given it is used to precompute the kernel matrix. @@ -1056,8 +1054,6 @@ class SVR(RegressorMixin, BaseLibSVM): kernel : {'linear', 'poly', 'rbf', 'sigmoid', 'precomputed'} or callable, \ default='rbf' Specifies the kernel type to be used in the algorithm. - It must be one of 'linear', 'poly', 'rbf', 'sigmoid', 'precomputed' or - a callable. If none is given, 'rbf' will be used. If a callable is given it is used to precompute the kernel matrix. @@ -1256,8 +1252,6 @@ class NuSVR(RegressorMixin, BaseLibSVM): kernel : {'linear', 'poly', 'rbf', 'sigmoid', 'precomputed'} or callable, \ default='rbf' Specifies the kernel type to be used in the algorithm. - It must be one of 'linear', 'poly', 'rbf', 'sigmoid', 'precomputed' or - a callable. If none is given, 'rbf' will be used. If a callable is given it is used to precompute the kernel matrix. @@ -1435,8 +1429,6 @@ class OneClassSVM(OutlierMixin, BaseLibSVM): kernel : {'linear', 'poly', 'rbf', 'sigmoid', 'precomputed'} or callable, \ default='rbf' Specifies the kernel type to be used in the algorithm. - It must be one of 'linear', 'poly', 'rbf', 'sigmoid', 'precomputed' or - a callable. If none is given, 'rbf' will be used. If a callable is given it is used to precompute the kernel matrix.