@@ -1236,23 +1236,36 @@ def linear_kernel(X, Y=None, dense_output=True):
1236
1236
return safe_sparse_dot (X , Y .T , dense_output = dense_output )
1237
1237
1238
1238
1239
+ @validate_params (
1240
+ {
1241
+ "X" : ["array-like" , "sparse matrix" ],
1242
+ "Y" : ["array-like" , "sparse matrix" , None ],
1243
+ "degree" : [Interval (Real , 1 , None , closed = "left" )],
1244
+ "gamma" : [
1245
+ Interval (Real , 0 , None , closed = "left" ),
1246
+ None ,
1247
+ Hidden (np .ndarray ),
1248
+ ],
1249
+ "coef0" : [Interval (Real , None , None , closed = "neither" )],
1250
+ }
1251
+ )
1239
1252
def polynomial_kernel (X , Y = None , degree = 3 , gamma = None , coef0 = 1 ):
1240
1253
"""
1241
1254
Compute the polynomial kernel between X and Y.
1242
1255
1243
- :math:` K(X, Y) = (gamma <X, Y> + coef0)^{ degree}`
1256
+ K(X, Y) = (gamma <X, Y> + coef0) ^ degree
1244
1257
1245
1258
Read more in the :ref:`User Guide <polynomial_kernel>`.
1246
1259
1247
1260
Parameters
1248
1261
----------
1249
- X : ndarray of shape (n_samples_X, n_features)
1262
+ X : {array-like, sparse matrix} of shape (n_samples_X, n_features)
1250
1263
A feature array.
1251
1264
1252
- Y : ndarray of shape (n_samples_Y, n_features), default=None
1265
+ Y : {array-like, sparse matrix} of shape (n_samples_Y, n_features), default=None
1253
1266
An optional second feature array. If `None`, uses `Y=X`.
1254
1267
1255
- degree : int , default=3
1268
+ degree : float , default=3
1256
1269
Kernel degree.
1257
1270
1258
1271
gamma : float, default=None
0 commit comments