@@ -587,14 +587,15 @@ class SVC(BaseSVC):
587
587
588
588
degree : int, default=3
589
589
Degree of the polynomial kernel function ('poly').
590
- Ignored by all other kernels.
590
+ Must be non-negative. Ignored by all other kernels.
591
591
592
592
gamma : {'scale', 'auto'} or float, default='scale'
593
593
Kernel coefficient for 'rbf', 'poly' and 'sigmoid'.
594
594
595
595
- if ``gamma='scale'`` (default) is passed then it uses
596
596
1 / (n_features * X.var()) as value of gamma,
597
- - if 'auto', uses 1 / n_features.
597
+ - if 'auto', uses 1 / n_features
598
+ - if float, must be non-negative.
598
599
599
600
.. versionchanged:: 0.22
600
601
The default value of ``gamma`` changed from 'auto' to 'scale'.
@@ -850,14 +851,15 @@ class NuSVC(BaseSVC):
850
851
851
852
degree : int, default=3
852
853
Degree of the polynomial kernel function ('poly').
853
- Ignored by all other kernels.
854
+ Must be non-negative. Ignored by all other kernels.
854
855
855
856
gamma : {'scale', 'auto'} or float, default='scale'
856
857
Kernel coefficient for 'rbf', 'poly' and 'sigmoid'.
857
858
858
859
- if ``gamma='scale'`` (default) is passed then it uses
859
860
1 / (n_features * X.var()) as value of gamma,
860
- - if 'auto', uses 1 / n_features.
861
+ - if 'auto', uses 1 / n_features
862
+ - if float, must be non-negative.
861
863
862
864
.. versionchanged:: 0.22
863
865
The default value of ``gamma`` changed from 'auto' to 'scale'.
@@ -1037,6 +1039,12 @@ class NuSVC(BaseSVC):
1037
1039
1038
1040
_impl = "nu_svc"
1039
1041
1042
+ _parameter_constraints = {
1043
+ ** BaseSVC ._parameter_constraints , # type: ignore
1044
+ "nu" : [Interval (Real , 0.0 , 1.0 , closed = "right" )],
1045
+ }
1046
+ _parameter_constraints .pop ("C" )
1047
+
1040
1048
def __init__ (
1041
1049
self ,
1042
1050
* ,
@@ -1114,14 +1122,15 @@ class SVR(RegressorMixin, BaseLibSVM):
1114
1122
1115
1123
degree : int, default=3
1116
1124
Degree of the polynomial kernel function ('poly').
1117
- Ignored by all other kernels.
1125
+ Must be non-negative. Ignored by all other kernels.
1118
1126
1119
1127
gamma : {'scale', 'auto'} or float, default='scale'
1120
1128
Kernel coefficient for 'rbf', 'poly' and 'sigmoid'.
1121
1129
1122
1130
- if ``gamma='scale'`` (default) is passed then it uses
1123
1131
1 / (n_features * X.var()) as value of gamma,
1124
- - if 'auto', uses 1 / n_features.
1132
+ - if 'auto', uses 1 / n_features
1133
+ - if float, must be non-negative.
1125
1134
1126
1135
.. versionchanged:: 0.22
1127
1136
The default value of ``gamma`` changed from 'auto' to 'scale'.
@@ -1142,7 +1151,7 @@ class SVR(RegressorMixin, BaseLibSVM):
1142
1151
Epsilon in the epsilon-SVR model. It specifies the epsilon-tube
1143
1152
within which no penalty is associated in the training loss function
1144
1153
with points predicted within a distance epsilon from the actual
1145
- value.
1154
+ value. Must be non-negative.
1146
1155
1147
1156
shrinking : bool, default=True
1148
1157
Whether to use the shrinking heuristic.
@@ -1247,6 +1256,10 @@ class SVR(RegressorMixin, BaseLibSVM):
1247
1256
1248
1257
_impl = "epsilon_svr"
1249
1258
1259
+ _parameter_constraints = {** BaseLibSVM ._parameter_constraints } # type: ignore
1260
+ for unused_param in ["class_weight" , "nu" , "probability" , "random_state" ]:
1261
+ _parameter_constraints .pop (unused_param )
1262
+
1250
1263
def __init__ (
1251
1264
self ,
1252
1265
* ,
@@ -1329,14 +1342,15 @@ class NuSVR(RegressorMixin, BaseLibSVM):
1329
1342
1330
1343
degree : int, default=3
1331
1344
Degree of the polynomial kernel function ('poly').
1332
- Ignored by all other kernels.
1345
+ Must be non-negative. Ignored by all other kernels.
1333
1346
1334
1347
gamma : {'scale', 'auto'} or float, default='scale'
1335
1348
Kernel coefficient for 'rbf', 'poly' and 'sigmoid'.
1336
1349
1337
1350
- if ``gamma='scale'`` (default) is passed then it uses
1338
1351
1 / (n_features * X.var()) as value of gamma,
1339
- - if 'auto', uses 1 / n_features.
1352
+ - if 'auto', uses 1 / n_features
1353
+ - if float, must be non-negative.
1340
1354
1341
1355
.. versionchanged:: 0.22
1342
1356
The default value of ``gamma`` changed from 'auto' to 'scale'.
@@ -1451,6 +1465,10 @@ class NuSVR(RegressorMixin, BaseLibSVM):
1451
1465
1452
1466
_impl = "nu_svr"
1453
1467
1468
+ _parameter_constraints = {** BaseLibSVM ._parameter_constraints } # type: ignore
1469
+ for unused_param in ["class_weight" , "epsilon" , "probability" , "random_state" ]:
1470
+ _parameter_constraints .pop (unused_param )
1471
+
1454
1472
def __init__ (
1455
1473
self ,
1456
1474
* ,
@@ -1523,14 +1541,15 @@ class OneClassSVM(OutlierMixin, BaseLibSVM):
1523
1541
1524
1542
degree : int, default=3
1525
1543
Degree of the polynomial kernel function ('poly').
1526
- Ignored by all other kernels.
1544
+ Must be non-negative. Ignored by all other kernels.
1527
1545
1528
1546
gamma : {'scale', 'auto'} or float, default='scale'
1529
1547
Kernel coefficient for 'rbf', 'poly' and 'sigmoid'.
1530
1548
1531
1549
- if ``gamma='scale'`` (default) is passed then it uses
1532
1550
1 / (n_features * X.var()) as value of gamma,
1533
- - if 'auto', uses 1 / n_features.
1551
+ - if 'auto', uses 1 / n_features
1552
+ - if float, must be non-negative.
1534
1553
1535
1554
.. versionchanged:: 0.22
1536
1555
The default value of ``gamma`` changed from 'auto' to 'scale'.
@@ -1645,6 +1664,10 @@ class OneClassSVM(OutlierMixin, BaseLibSVM):
1645
1664
1646
1665
_impl = "one_class"
1647
1666
1667
+ _parameter_constraints = {** BaseLibSVM ._parameter_constraints } # type: ignore
1668
+ for unused_param in ["C" , "class_weight" , "epsilon" , "probability" , "random_state" ]:
1669
+ _parameter_constraints .pop (unused_param )
1670
+
1648
1671
def __init__ (
1649
1672
self ,
1650
1673
* ,
0 commit comments