Thanks to visit codestin.com
Credit goes to github.com

Skip to content

DOC Ensure rbf_kernel passes numpydoc validation #23954

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions sklearn/metrics/pairwise.py
Original file line number Diff line number Diff line change
Expand Up @@ -1258,8 +1258,7 @@ def sigmoid_kernel(X, Y=None, gamma=None, coef0=1):


def rbf_kernel(X, Y=None, gamma=None):
"""
Compute the rbf (gaussian) kernel between X and Y::
"""Compute the rbf (gaussian) kernel between X and Y.

K(x, y) = exp(-gamma ||x-y||^2)

Expand All @@ -1270,16 +1269,18 @@ def rbf_kernel(X, Y=None, gamma=None):
Parameters
----------
X : ndarray of shape (n_samples_X, n_features)
A feature array.

Y : ndarray of shape (n_samples_Y, n_features), default=None
If `None`, uses `Y=X`.
An optional second feature array. If `None`, uses `Y=X`.

gamma : float, default=None
If None, defaults to 1.0 / n_features.

Returns
-------
kernel_matrix : ndarray of shape (n_samples_X, n_samples_Y)
The RBF 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 @@ -59,7 +59,6 @@
"sklearn.metrics.pairwise.pairwise_distances_argmin_min",
"sklearn.metrics.pairwise.pairwise_distances_chunked",
"sklearn.metrics.pairwise.polynomial_kernel",
"sklearn.metrics.pairwise.rbf_kernel",
"sklearn.metrics.pairwise.sigmoid_kernel",
"sklearn.preprocessing._data.maxabs_scale",
"sklearn.preprocessing._data.scale",
Expand Down