Skip to content

sklearn.cluster.OPTICS uses all cores when minkowski's p=2 #21786

Open
@szperajacyzolw

Description

@szperajacyzolw

Describe the bug

I have specified n_jobs=2. When p=1, joblib backend is working as specified. But when p=2 it ignores n_jobs and goes full power.

Steps/Code to Reproduce

optics_oh = OPTICS(min_samples=3, p=2, n_jobs=2)
optics_oh_predict = optics_oh.fit_predict(X_oh)

Expected Results

Two cores loaded

Actual Results

All cores loaded
Screenshot from 2021-11-25 15-23-14

Versions

System:
python: 3.8.10 (default, Sep 28 2021, 16:10:42) [GCC 9.3.0]
executable: /home/some_folder_structure/env/bin/python
machine: Linux-5.11.0-40-generic-x86_64-with-glibc2.29

Python dependencies:
pip: 21.3.1
setuptools: 58.2.0
sklearn: 0.24.2
numpy: 1.21.4
scipy: 1.5.4
Cython: 0.29.22
pandas: 1.2.2
matplotlib: 3.3.4
joblib: 1.0.1
threadpoolctl: 2.1.0

Built with OpenMP: True

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationModerateAnything that requires some knowledge of conventions and best practicesmodule:cluster

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions