Skip to content

Commit

Permalink
DOC Ensures that sklearn.metrics.pairwise.linear_kernel passes numpyd…
Browse files Browse the repository at this point in the history
…oc validation (scikit-learn#21470)

Co-authored-by: Julien Jerphanion <git@jjerphan.xyz>
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
  • Loading branch information
3 people authored Oct 30, 2021
1 parent 8fcf4ce commit d5e045f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 0 additions & 1 deletion maint_tools/test_docstrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@
"sklearn.metrics.pairwise.haversine_distances",
"sklearn.metrics.pairwise.kernel_metrics",
"sklearn.metrics.pairwise.laplacian_kernel",
"sklearn.metrics.pairwise.linear_kernel",
"sklearn.metrics.pairwise.manhattan_distances",
"sklearn.metrics.pairwise.nan_euclidean_distances",
"sklearn.metrics.pairwise.paired_cosine_distances",
Expand Down
4 changes: 3 additions & 1 deletion sklearn/metrics/pairwise.py
Original file line number Diff line number Diff line change
Expand Up @@ -1053,9 +1053,10 @@ def linear_kernel(X, Y=None, dense_output=True):
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`.
dense_output : bool, default=True
Whether to return dense output even when the input is sparse. If
Expand All @@ -1066,6 +1067,7 @@ def linear_kernel(X, Y=None, dense_output=True):
Returns
-------
Gram matrix : ndarray of shape (n_samples_X, n_samples_Y)
The Gram matrix of the linear kernel, i.e. `X @ Y.T`.
"""
X, Y = check_pairwise_arrays(X, Y)
return safe_sparse_dot(X, Y.T, dense_output=dense_output)
Expand Down

0 comments on commit d5e045f

Please sign in to comment.