@@ -1236,23 +1236,36 @@ def linear_kernel(X, Y=None, dense_output=True):
12361236 return safe_sparse_dot (X , Y .T , dense_output = dense_output )
12371237
12381238
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+ )
12391252def polynomial_kernel (X , Y = None , degree = 3 , gamma = None , coef0 = 1 ):
12401253 """
12411254 Compute the polynomial kernel between X and Y.
12421255
1243- :math:` K(X, Y) = (gamma <X, Y> + coef0)^{ degree}`
1256+ K(X, Y) = (gamma <X, Y> + coef0) ^ degree
12441257
12451258 Read more in the :ref:`User Guide <polynomial_kernel>`.
12461259
12471260 Parameters
12481261 ----------
1249- X : ndarray of shape (n_samples_X, n_features)
1262+ X : {array-like, sparse matrix} of shape (n_samples_X, n_features)
12501263 A feature array.
12511264
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
12531266 An optional second feature array. If `None`, uses `Y=X`.
12541267
1255- degree : int , default=3
1268+ degree : float , default=3
12561269 Kernel degree.
12571270
12581271 gamma : float, default=None
0 commit comments