8000 MAINT Parameters validation for sklearn.metrics.pairwise.paired_manhattan_distances by Charlie-XIAO · Pull Request #26074 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content
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: 5 additions & 2 deletions sklearn/metrics/pairwise.py
Original file line number Diff line number Diff line change
Expand Up @@ -1051,6 +1051,9 @@ def paired_euclidean_distances(X, Y):
return row_norms(X - Y)


@validate_params(
{"X": ["array-like", "sparse matrix"], "Y": ["array-like", "sparse matrix"]}
)
def paired_manhattan_distances(X, Y):
"""Compute the paired L1 distances between X and Y.

Expand All @@ -1061,10 +1064,10 @@ def paired_manhattan_distances(X, Y):

Parameters
----------
X : array-like of shape (n_samples, n_features)
X : {array-like, sparse matrix} of shape (n_samples, n_features)
An array-like where each row is a sample and each column is a feature.

Y : array-like of shape (n_samples, n_features)
Y : {array-like, sparse matrix} of shape (n_samples, n_features)
An array-like where each row is a sample and each column is a feature.

Returns
Expand Down
1 change: 1 addition & 0 deletions sklearn/tests/test_public_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ def _check_function_param_validation(
"sklearn.metrics.pairwise.laplacian_kernel",
"sklearn.metrics.pairwise.linear_kernel",
"sklearn.metrics.pairwise.paired_euclidean_distances",
"sklearn.metrics.pairwise.paired_manhattan_distances",
"sklearn.metrics.precision_recall_curve",
"sklearn.metric 4461 s.precision_recall_fscore_support",
"sklearn.metrics.precision_score",
Expand Down
0