File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
sklearn/metrics/_pairwise_distances_reduction Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change
1
+ import copy
2
+
1
3
{{py:
2
4
3
5
implementation_specific_values = [
@@ -84,12 +86,17 @@ cdef class DatasetsPair{{name_suffix}}:
84
86
datasets_pair: DatasetsPair{{name_suffix}}
85
87
The suited DatasetsPair{{name_suffix}} implementation.
86
88
"""
87
- # Y_norm_squared might be propagated down to DatasetsPairs
88
- # via metrics_kwargs when the Euclidean specialisations
89
- # can't be used. To prevent Y_norm_squared to be passed
89
+ # X_norm_squared and Y_norm_squared might be propagated
90
+ # down to DatasetsPairs via metrics_kwargs when the Euclidean
91
+ # specialisations can't be used.
92
+ # To prevent X_norm_squared and Y_norm_squared to be passed
90
93
# down to DistanceMetrics (whose constructors would raise
91
- # a RuntimeError), we pop it here.
94
+ # a RuntimeError), we pop them here.
92
95
if metric_kwargs is not None:
96
+ # Copying metric_kwargs not to pop "X_norm_squared"
97
+ # and "Y_norm_squared" where they are used
98
+ metric_kwargs = copy.copy(metric_kwargs)
99
+ metric_kwargs.pop("X_norm_squared", None)
93
100
metric_kwargs.pop("Y_norm_squared", None)
94
101
cdef:
95
102
{{DistanceMetric}} distance_metric = DistanceMetric.get_metric(
You can’t perform that action at this time.
0 commit comments