Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cc4e8c8

Browse filesBrowse files
zouharvithomasjpfan
authored andcommitted
MNT Fix error message for Minkowski metric parameter (scikit-learn#19671)
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
1 parent bb5c42c commit cc4e8c8
Copy full SHA for cc4e8c8

File tree

1 file changed

+4
-3
lines changed
Filter options

1 file changed

+4
-3
lines changed

‎sklearn/neighbors/_base.py

Copy file name to clipboardExpand all lines: sklearn/neighbors/_base.py
+4-3Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,8 @@ def _check_algorithm_metric(self):
355355
effective_p = self.p
356356

357357
if self.metric in ['wminkowski', 'minkowski'] and effective_p < 1:
358-
raise ValueError("p must be greater than one for minkowski metric")
358+
raise ValueError("p must be greater or equal to one for "
359+
"minkowski metric")
359360

360361
def _fit(self, X, y=None):
361362
if self._get_tags()["requires_y"]:
@@ -411,8 +412,8 @@ def _fit(self, X, y=None):
411412
if self.metric == 'minkowski':
412413
p = self.effective_metric_params_.pop('p', 2)
413414
if p < 1:
414-
raise ValueError("p must be greater than one "
415-
"for minkowski metric")
415+
raise ValueError("p must be greater or equal to one for "
416+
"minkowski metric")
416417
elif p == 1:
417418
self.effective_metric_ = 'manhattan'
418419
elif p == 2:

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.