Skip to content

Commit

Permalink
DOC Ensure polynomial_kernel passes numpydoc validation (#23953)
Browse files Browse the repository at this point in the history
Co-authored-by: Meekail Zain <34613774+Micky774@users.noreply.github.com>
  • Loading branch information
2 people authored and glemaitre committed Aug 5, 2022
1 parent 6ed911a commit 5b60f4d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
11 changes: 8 additions & 3 deletions sklearn/metrics/pairwise.py
Original file line number Diff line number Diff line change
Expand Up @@ -1190,28 +1190,33 @@ def linear_kernel(X, Y=None, dense_output=True):

def polynomial_kernel(X, Y=None, degree=3, gamma=None, coef0=1):
"""
Compute the polynomial kernel between X and Y::
Compute the polynomial kernel between X and Y.
K(X, Y) = (gamma <X, Y> + coef0)^degree
:math:`K(X, Y) = (gamma <X, Y> + coef0)^degree`
Read more in the :ref:`User Guide <polynomial_kernel>`.
Parameters
----------
X : ndarray of shape (n_samples_X, n_features)
A feature array.
Y : ndarray of shape (n_samples_Y, n_features), default=None
An optional second feature array. If `None`, uses `Y=X`.
degree : int, default=3
Kernel degree.
gamma : float, default=None
If None, defaults to 1.0 / n_features.
Coefficient of the vector inner product. If None, defaults to 1.0 / n_features.
coef0 : float, default=1
Constant offset added to scaled inner product.
Returns
-------
Gram matrix : ndarray of shape (n_samples_X, n_samples_Y)
The polynomial kernel.
"""
X, Y = check_pairwise_arrays(X, Y)
if gamma is None:
Expand Down
1 change: 0 additions & 1 deletion sklearn/tests/test_docstrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
"sklearn.metrics.cluster._supervised.rand_score",
"sklearn.metrics.cluster._supervised.v_measure_score",
"sklearn.metrics.pairwise.pairwise_distances_chunked",
"sklearn.metrics.pairwise.polynomial_kernel",
"sklearn.preprocessing._data.maxabs_scale",
"sklearn.preprocessing._data.scale",
"sklearn.preprocessing._label.label_binarize",
Expand Down

0 comments on commit 5b60f4d

Please sign in to comment.