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 b571d64

Browse filesBrowse files
FIX Set n_jobs=None as default for neighbors transformers (#24075)
1 parent 7f83d00 commit b571d64
Copy full SHA for b571d64

File tree

2 files changed

+9
-4
lines changed
Filter options

2 files changed

+9
-4
lines changed

‎doc/whats_new/v1.2.rst

Copy file name to clipboardExpand all lines: doc/whats_new/v1.2.rst
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,11 @@ Changelog
225225
instead of failing with a low-level error message at predict-time.
226226
:pr:`23874` by :user:`Juan Gomez <2357juan>`.
227227

228+
- |Fix| Set `n_jobs=None` by default (instead of `1`) for
229+
:class:`neighbors.KNeighborsTransformer` and
230+
:class:`neighbors.RadiusNeighborsTransformer`.
231+
:pr:`24075` by :user:`Valentin Laurent <Valentin-Laurent>`.
232+
228233
:mod:`sklearn.svm`
229234
..................
230235

‎sklearn/neighbors/_graph.py

Copy file name to clipboardExpand all lines: sklearn/neighbors/_graph.py
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ class KNeighborsTransformer(
291291
metric_params : dict, default=None
292292
Additional keyword arguments for the metric function.
293293
294-
n_jobs : int, default=1
294+
n_jobs : int, default=None
295295
The number of parallel jobs to run for neighbors search.
296296
If ``-1``, then the number of jobs is set to the number of CPU cores.
297297
@@ -358,7 +358,7 @@ def __init__(
358358
metric="minkowski",
359359
p=2,
360360
metric_params=None,
361-
n_jobs=1,
361+
n_jobs=None,
362362
):
363363
super(KNeighborsTransformer, self).__init__(
364364
n_neighbors=n_neighbors,
@@ -515,7 +515,7 @@ class RadiusNeighborsTransformer(
515515
metric_params : dict, default=None
516516
Additional keyword arguments for the metric function.
517517
518-
n_jobs : int, default=1
518+
n_jobs : int, default=None
519519
The number of parallel jobs to run for neighbors search.
520520
If ``-1``, then the number of jobs is set to the number of CPU cores.
521521
@@ -586,7 +586,7 @@ def __init__(
586586
metric="minkowski",
587587
p=2,
588588
metric_params=None,
589-
n_jobs=1,
589+
n_jobs=None,
590590
):
591591
super(RadiusNeighborsTransformer, self).__init__(
592592
n_neighbors=None,

0 commit comments

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