Talip7/scikit-learn-issues-multilabel huggingface dataset:
Implementation of XRAY solver for NMF per Kumar 2013

### Describe the workflow you want to enable

I was inspired by this talk [https://www.youtube.com/watch?v=kSfwY68gQ9I](url) to attempt an implementation of the XRAY solver for NMF per Kumar 2013: [https://arxiv.org/pdf/1210.1190.pdf](https://arxiv.org/pdf/1210.1190.pdf) and [https://arxiv.org/pdf/1312.7167.pdf](https://arxiv.org/pdf/1312.7167.pdf)

The talk and the paper make some pretty extraordinary claims about uniqueness, speed, and convergence - subject to certain assumptions about the matrix to be factorized.  

Here is the issue - the paper meets the criteria for inclusion, except for the number of citations, which is at 166 according to Google Scholar.  I would be happy to make a PR, but before I expend the effort I'd like a general sense from the maintainers whether the PR is likely to survive *assuming* the paper's claims pan out and the XRAY solver is a significant advancement for sklearn's NMF implementation.

I have reviewed open issues and cannot find any other proposals for implementing the XRAY solver.   I have, however, found a huge open PR for MinibatchNMF, issue #13308.  Presumably once this is released (milestoned for 1.1), the XRAY solver would be supported in that implementation as well.  I mention this only because I worry about that PR dogpiling on top of whatever work I would also do, causing headaches all around.

### Describe your proposed solution

I propose XRAY as an additional solver within the current NMF implementation, alongside cd and mu.  If there is a test for the separability or near-separability assumption, that may take the form of a warning or exception if the condition is not met.

### Describe alternatives you've considered, if relevant

_No response_

### Additional context

_No response_

COMMENT:
Thank you for your time!  

I may reach out to the author of the paper for a reference implementation.  They mention it is in MATLAB.  Like you, I was unable to find a test for near-separability.  I also understand the emphasis on the mini-batch solver.

Labels: New Feature, module:decomposition
DBSCAN running out of memory and getting killed

### Describe the bug

I am passing data normalized using MinMaxScaler to DBSCAN's fit_predict. My data is very small (12 MB, around 180,000 rows and 9 columns). However while running this, the memory usage quickly climbs up and the kernel gets killed (I presume by OOM killer). I even tried it on a server with 256 GB RAM and it fails fairly quickly.

Here is my repro code:

```
import pandas as pd
X_ml = pd.read_csv('Xml.csv')
from sklearn.cluster import DBSCAN
dbscan = DBSCAN(eps=0.28, min_samples=9)
dbscan_pred = dbscan.fit_predict(X_ml)
```
and [here](https://github.com/sameermahajan/MLWorkshop/blob/master/Xml.csv) is my Xml.csv data file.

Any ideas how to get it working?

### Steps/Code to Reproduce

```
import pandas as pd
X_ml = pd.read_csv('Xml.csv')
from sklearn.cluster import DBSCAN
dbscan = DBSCAN(eps=0.28, min_samples=9)
dbscan_pred = dbscan.fit_predict(X_ml)
```

and [here](https://github.com/sameermahajan/MLWorkshop/blob/master/Xml.csv) is my Xml.csv data file.

### Expected Results

DBSCAN should complete.

### Actual Results

It runs out of memory getting killed.

### Versions

```shell
System:
    python: 3.9.9 (main, Nov 21 2021, 03:23:42)  [Clang 13.0.0 (clang-1300.0.29.3)]
executable: /usr/local/opt/python@3.9/bin/python3.9
   machine: macOS-12.2.1-x86_64-i386-64bit

Python dependencies:
          pip: 21.3.1
   setuptools: 59.0.1
      sklearn: 1.0.2
        numpy: 1.22.0
        scipy: 1.7.3
       Cython: None
       pandas: 1.3.5
   matplotlib: 3.5.1
       joblib: 1.1.0
threadpoolctl: 3.1.0

Built with OpenMP: True
```

COMMENT:
DBSCAN has a worst case memory complexity O(n^2), which for 180000 samples corresponds to a little more than 259GB.
This worst case situation can happen if eps is too large or min_samples too low, ending with all points being in a same cluster.

However it does not seem to be the only issue here. Your dataset contains **a lot** of duplicates. This also increase the memory consumption because all these duplicates are in the neighborhood of each other regardless of eps.

I suggest that you first remove the duplicates from your dataset. You can use sample weights if you want to still use the fact that some points were duplicated. A point with a sample weight of n is equivalent to having n copies of this point.

Labels: Performance, module:cluster
DBSCAN running out of memory and getting killed

### Describe the bug

I am passing data normalized using MinMaxScaler to DBSCAN's fit_predict. My data is very small (12 MB, around 180,000 rows and 9 columns). However while running this, the memory usage quickly climbs up and the kernel gets killed (I presume by OOM killer). I even tried it on a server with 256 GB RAM and it fails fairly quickly.

Here is my repro code:

```
import pandas as pd
X_ml = pd.read_csv('Xml.csv')
from sklearn.cluster import DBSCAN
dbscan = DBSCAN(eps=0.28, min_samples=9)
dbscan_pred = dbscan.fit_predict(X_ml)
```
and [here](https://github.com/sameermahajan/MLWorkshop/blob/master/Xml.csv) is my Xml.csv data file.

Any ideas how to get it working?

### Steps/Code to Reproduce

```
import pandas as pd
X_ml = pd.read_csv('Xml.csv')
from sklearn.cluster import DBSCAN
dbscan = DBSCAN(eps=0.28, min_samples=9)
dbscan_pred = dbscan.fit_predict(X_ml)
```

and [here](https://github.com/sameermahajan/MLWorkshop/blob/master/Xml.csv) is my Xml.csv data file.

### Expected Results

DBSCAN should complete.

### Actual Results

It runs out of memory getting killed.

### Versions

```shell
System:
    python: 3.9.9 (main, Nov 21 2021, 03:23:42)  [Clang 13.0.0 (clang-1300.0.29.3)]
executable: /usr/local/opt/python@3.9/bin/python3.9
   machine: macOS-12.2.1-x86_64-i386-64bit

Python dependencies:
          pip: 21.3.1
   setuptools: 59.0.1
      sklearn: 1.0.2
        numpy: 1.22.0
        scipy: 1.7.3
       Cython: None
       pandas: 1.3.5
   matplotlib: 3.5.1
       joblib: 1.1.0
threadpoolctl: 3.1.0

Built with OpenMP: True
```

COMMENT:
When I try DBSCAN with similar data - 180000 rows but 42 columns and most of them belonging to one cluster (the actual cluster distribution is given below) - it converges pretty quickly on a machine with even 16 GB RAM (of course, I notice it using some swap as actual memory usage of the underlying python process climbs up much beyond that during the execution).

```
cluster distribution for working data with 42 columns:
 0    124783
 1     54341
-1      2071
 2        90
 3        75
```

I can share my data for which it works in case it helps. Please let me know.

Labels: Performance, module:cluster
DBSCAN running out of memory and getting killed

### Describe the bug

I am passing data normalized using MinMaxScaler to DBSCAN's fit_predict. My data is very small (12 MB, around 180,000 rows and 9 columns). However while running this, the memory usage quickly climbs up and the kernel gets killed (I presume by OOM killer). I even tried it on a server with 256 GB RAM and it fails fairly quickly.

Here is my repro code:

```
import pandas as pd
X_ml = pd.read_csv('Xml.csv')
from sklearn.cluster import DBSCAN
dbscan = DBSCAN(eps=0.28, min_samples=9)
dbscan_pred = dbscan.fit_predict(X_ml)
```
and [here](https://github.com/sameermahajan/MLWorkshop/blob/master/Xml.csv) is my Xml.csv data file.

Any ideas how to get it working?

### Steps/Code to Reproduce

```
import pandas as pd
X_ml = pd.read_csv('Xml.csv')
from sklearn.cluster import DBSCAN
dbscan = DBSCAN(eps=0.28, min_samples=9)
dbscan_pred = dbscan.fit_predict(X_ml)
```

and [here](https://github.com/sameermahajan/MLWorkshop/blob/master/Xml.csv) is my Xml.csv data file.

### Expected Results

DBSCAN should complete.

### Actual Results

It runs out of memory getting killed.

### Versions

```shell
System:
    python: 3.9.9 (main, Nov 21 2021, 03:23:42)  [Clang 13.0.0 (clang-1300.0.29.3)]
executable: /usr/local/opt/python@3.9/bin/python3.9
   machine: macOS-12.2.1-x86_64-i386-64bit

Python dependencies:
          pip: 21.3.1
   setuptools: 59.0.1
      sklearn: 1.0.2
        numpy: 1.22.0
        scipy: 1.7.3
       Cython: None
       pandas: 1.3.5
   matplotlib: 3.5.1
       joblib: 1.1.0
threadpoolctl: 3.1.0

Built with OpenMP: True
```

COMMENT:
The issue is not many points belonging to 1 cluster, but many points being in the neighbourhood of each other. It's not the same thing.

I guess that in your second dataset, each point has a bit less neighbors than in your first, resulting in a bit less memory consumption. Essentially, dbscan needs an array (of len n_samples) of arrays containing the neighbors indices for each sample. The more neighbors each point has, the more memory it requires.

Labels: Performance, module:cluster
DBSCAN running out of memory and getting killed

### Describe the bug

I am passing data normalized using MinMaxScaler to DBSCAN's fit_predict. My data is very small (12 MB, around 180,000 rows and 9 columns). However while running this, the memory usage quickly climbs up and the kernel gets killed (I presume by OOM killer). I even tried it on a server with 256 GB RAM and it fails fairly quickly.

Here is my repro code:

```
import pandas as pd
X_ml = pd.read_csv('Xml.csv')
from sklearn.cluster import DBSCAN
dbscan = DBSCAN(eps=0.28, min_samples=9)
dbscan_pred = dbscan.fit_predict(X_ml)
```
and [here](https://github.com/sameermahajan/MLWorkshop/blob/master/Xml.csv) is my Xml.csv data file.

Any ideas how to get it working?

### Steps/Code to Reproduce

```
import pandas as pd
X_ml = pd.read_csv('Xml.csv')
from sklearn.cluster import DBSCAN
dbscan = DBSCAN(eps=0.28, min_samples=9)
dbscan_pred = dbscan.fit_predict(X_ml)
```

and [here](https://github.com/sameermahajan/MLWorkshop/blob/master/Xml.csv) is my Xml.csv data file.

### Expected Results

DBSCAN should complete.

### Actual Results

It runs out of memory getting killed.

### Versions

```shell
System:
    python: 3.9.9 (main, Nov 21 2021, 03:23:42)  [Clang 13.0.0 (clang-1300.0.29.3)]
executable: /usr/local/opt/python@3.9/bin/python3.9
   machine: macOS-12.2.1-x86_64-i386-64bit

Python dependencies:
          pip: 21.3.1
   setuptools: 59.0.1
      sklearn: 1.0.2
        numpy: 1.22.0
        scipy: 1.7.3
       Cython: None
       pandas: 1.3.5
   matplotlib: 3.5.1
       joblib: 1.1.0
threadpoolctl: 3.1.0

Built with OpenMP: True
```

COMMENT:
@jeremiedbb thanks for the clarification. How is the neighbourhood defined to determine whether some other data point lies in the neighbourhood of a data point or not?

Labels: Performance, module:cluster
DBSCAN running out of memory and getting killed

### Describe the bug

I am passing data normalized using MinMaxScaler to DBSCAN's fit_predict. My data is very small (12 MB, around 180,000 rows and 9 columns). However while running this, the memory usage quickly climbs up and the kernel gets killed (I presume by OOM killer). I even tried it on a server with 256 GB RAM and it fails fairly quickly.

Here is my repro code:

```
import pandas as pd
X_ml = pd.read_csv('Xml.csv')
from sklearn.cluster import DBSCAN
dbscan = DBSCAN(eps=0.28, min_samples=9)
dbscan_pred = dbscan.fit_predict(X_ml)
```
and [here](https://github.com/sameermahajan/MLWorkshop/blob/master/Xml.csv) is my Xml.csv data file.

Any ideas how to get it working?

### Steps/Code to Reproduce

```
import pandas as pd
X_ml = pd.read_csv('Xml.csv')
from sklearn.cluster import DBSCAN
dbscan = DBSCAN(eps=0.28, min_samples=9)
dbscan_pred = dbscan.fit_predict(X_ml)
```

and [here](https://github.com/sameermahajan/MLWorkshop/blob/master/Xml.csv) is my Xml.csv data file.

### Expected Results

DBSCAN should complete.

### Actual Results

It runs out of memory getting killed.

### Versions

```shell
System:
    python: 3.9.9 (main, Nov 21 2021, 03:23:42)  [Clang 13.0.0 (clang-1300.0.29.3)]
executable: /usr/local/opt/python@3.9/bin/python3.9
   machine: macOS-12.2.1-x86_64-i386-64bit

Python dependencies:
          pip: 21.3.1
   setuptools: 59.0.1
      sklearn: 1.0.2
        numpy: 1.22.0
        scipy: 1.7.3
       Cython: None
       pandas: 1.3.5
   matplotlib: 3.5.1
       joblib: 1.1.0
threadpoolctl: 3.1.0

Built with OpenMP: True
```

COMMENT:
That's the `eps` parameter. See https://scikit-learn.org/stable/modules/generated/sklearn.cluster.DBSCAN.html

Labels: Performance, module:cluster
DBSCAN running out of memory and getting killed

### Describe the bug

I am passing data normalized using MinMaxScaler to DBSCAN's fit_predict. My data is very small (12 MB, around 180,000 rows and 9 columns). However while running this, the memory usage quickly climbs up and the kernel gets killed (I presume by OOM killer). I even tried it on a server with 256 GB RAM and it fails fairly quickly.

Here is my repro code:

```
import pandas as pd
X_ml = pd.read_csv('Xml.csv')
from sklearn.cluster import DBSCAN
dbscan = DBSCAN(eps=0.28, min_samples=9)
dbscan_pred = dbscan.fit_predict(X_ml)
```
and [here](https://github.com/sameermahajan/MLWorkshop/blob/master/Xml.csv) is my Xml.csv data file.

Any ideas how to get it working?

### Steps/Code to Reproduce

```
import pandas as pd
X_ml = pd.read_csv('Xml.csv')
from sklearn.cluster import DBSCAN
dbscan = DBSCAN(eps=0.28, min_samples=9)
dbscan_pred = dbscan.fit_predict(X_ml)
```

and [here](https://github.com/sameermahajan/MLWorkshop/blob/master/Xml.csv) is my Xml.csv data file.

### Expected Results

DBSCAN should complete.

### Actual Results

It runs out of memory getting killed.

### Versions

```shell
System:
    python: 3.9.9 (main, Nov 21 2021, 03:23:42)  [Clang 13.0.0 (clang-1300.0.29.3)]
executable: /usr/local/opt/python@3.9/bin/python3.9
   machine: macOS-12.2.1-x86_64-i386-64bit

Python dependencies:
          pip: 21.3.1
   setuptools: 59.0.1
      sklearn: 1.0.2
        numpy: 1.22.0
        scipy: 1.7.3
       Cython: None
       pandas: 1.3.5
   matplotlib: 3.5.1
       joblib: 1.1.0
threadpoolctl: 3.1.0

Built with OpenMP: True
```

COMMENT:
I guess we can close this one then. We'll add better docs in https://github.com/scikit-learn/scikit-learn/issues/26726

Labels: Performance, module:cluster
Wheel builder broken for Python 3.7 and 3.8 on Windows (64 bit)

The [scheduled windows builds](https://github.com/scikit-learn/scikit-learn/actions/workflows/wheels.yml?query=event%3Aschedule) have been failing with the following error:

See for instance:

```  
Digest: sha256:91ef3fcdba96f60e137e4e059d7eec3469d0ab9bffc237bf215e5841798c989d
  Status: Downloaded newer image for winamd64/python:3.7-windowsservercore
   ---> d5cccad4ac52
  Step 3/9 : ARG WHEEL_NAME
   ---> Running in 1a4a703e83e4
  Removing intermediate container 1a4a703e83e4
   ---> 3fde7c8820f1
  Step 4/9 : ARG CONFTEST_NAME
   ---> Running in 7aef4bf3e3b0
  Removing intermediate container 7aef4bf3e3b0
   ---> 5b8d371b2dd6
  Step 5/9 : ARG CIBW_TEST_REQUIRES
   ---> Running in 916eb4bc0363
  Removing intermediate container 916eb4bc0363
   ---> 6b8022bc3b3d
  Step 6/9 : COPY $WHEEL_NAME $WHEEL_NAME
   ---> f8d8c465fa5d
  Step 7/9 : COPY $CONFTEST_NAME $CONFTEST_NAME
   ---> 0a5de6ca9026
  Step 8/9 : RUN pip install $env:WHEEL_NAME
   ---> Running in 588a43823183
  hcsshim::CreateComputeSystem 588a43823183bab334b5639e4d4a1ae995ccaa39c41e519546a9430237faf24f: The container operating system does not match the host operating system.
```

Note that this problem does not happen for Python 3.9 and later and it does not happen for 32 bit Windows images either.

COMMENT:
We really don't care about fixing 3.7 because we want to drop Python 3.7 support for 1.1 release. Python 3.8 is annoying though.

Labels: Build / CI
Wheel builder broken for Python 3.7 and 3.8 on Windows (64 bit)

The [scheduled windows builds](https://github.com/scikit-learn/scikit-learn/actions/workflows/wheels.yml?query=event%3Aschedule) have been failing with the following error:

See for instance:

```  
Digest: sha256:91ef3fcdba96f60e137e4e059d7eec3469d0ab9bffc237bf215e5841798c989d
  Status: Downloaded newer image for winamd64/python:3.7-windowsservercore
   ---> d5cccad4ac52
  Step 3/9 : ARG WHEEL_NAME
   ---> Running in 1a4a703e83e4
  Removing intermediate container 1a4a703e83e4
   ---> 3fde7c8820f1
  Step 4/9 : ARG CONFTEST_NAME
   ---> Running in 7aef4bf3e3b0
  Removing intermediate container 7aef4bf3e3b0
   ---> 5b8d371b2dd6
  Step 5/9 : ARG CIBW_TEST_REQUIRES
   ---> Running in 916eb4bc0363
  Removing intermediate container 916eb4bc0363
   ---> 6b8022bc3b3d
  Step 6/9 : COPY $WHEEL_NAME $WHEEL_NAME
   ---> f8d8c465fa5d
  Step 7/9 : COPY $CONFTEST_NAME $CONFTEST_NAME
   ---> 0a5de6ca9026
  Step 8/9 : RUN pip install $env:WHEEL_NAME
   ---> Running in 588a43823183
  hcsshim::CreateComputeSystem 588a43823183bab334b5639e4d4a1ae995ccaa39c41e519546a9430237faf24f: The container operating system does not match the host operating system.
```

Note that this problem does not happen for Python 3.9 and later and it does not happen for 32 bit Windows images either.

COMMENT:
Also note that the Windows builds also randomly fail with:

```
failed with exit status 1158
```

but it seems unrelated to the problem of "container operating system does not match the host operating system" and is already tracked by another issue: #22310.

Labels: Build / CI
Pytest collection error

### Describe the bug

As of  6a16763c008446953ed9380e084ed70a285a9f7e attempting to run `pytest` on any file or directory returns a collection error (see below). I do not know if this has affected CI/CD but will check soon.

### Steps/Code to Reproduce

Run `pytest` .
This works when targeting a specific file as well (at least on the few I tested).

### Expected Results

No error is thrown and testing proceeds as normal.

### Actual Results

![image](https://user-images.githubusercontent.com/34613774/154584520-ec684a9a-92d2-4770-aefc-dfbbd3aa691d.png)

### Versions

```shell
System:
    python: 3.9.7 (default, Sep 16 2021, 16:59:28) [MSC v.1916 64 bit (AMD64)]
executable: C:\ProgramData\Anaconda3\envs\scikit-dev\python.exe
   machine: Windows-10-10.0.19043-SP0

Python dependencies:
          pip: 21.2.4
   setuptools: 58.0.4
      sklearn: 1.1.dev0
        numpy: 1.22.0
        scipy: 1.7.3
       Cython: 0.29.26
       pandas: 1.3.5
   matplotlib: 3.5.1
       joblib: 1.1.0
threadpoolctl: 3.0.0

Built with OpenMP: True

threadpoolctl info:
       user_api: openmp
   internal_api: openmp
         prefix: vcomp
       filepath: C:\Windows\System32\vcomp140.dll
        version: None
    num_threads: 12
```

COMMENT:
you probably need to clean and rebuild. 
```
git clean -xdf
python setup.py build_ext -i
```

Labels: Bug, Needs Triage
Pytest collection error

### Describe the bug

As of  6a16763c008446953ed9380e084ed70a285a9f7e attempting to run `pytest` on any file or directory returns a collection error (see below). I do not know if this has affected CI/CD but will check soon.

### Steps/Code to Reproduce

Run `pytest` .
This works when targeting a specific file as well (at least on the few I tested).

### Expected Results

No error is thrown and testing proceeds as normal.

### Actual Results

![image](https://user-images.githubusercontent.com/34613774/154584520-ec684a9a-92d2-4770-aefc-dfbbd3aa691d.png)

### Versions

```shell
System:
    python: 3.9.7 (default, Sep 16 2021, 16:59:28) [MSC v.1916 64 bit (AMD64)]
executable: C:\ProgramData\Anaconda3\envs\scikit-dev\python.exe
   machine: Windows-10-10.0.19043-SP0

Python dependencies:
          pip: 21.2.4
   setuptools: 58.0.4
      sklearn: 1.1.dev0
        numpy: 1.22.0
        scipy: 1.7.3
       Cython: 0.29.26
       pandas: 1.3.5
   matplotlib: 3.5.1
       joblib: 1.1.0
threadpoolctl: 3.0.0

Built with OpenMP: True

threadpoolctl info:
       user_api: openmp
   internal_api: openmp
         prefix: vcomp
       filepath: C:\Windows\System32\vcomp140.dll
        version: None
    num_threads: 12
```

COMMENT:
> you probably need to clean and rebuild.

That solved it, thanks!

Labels: Bug, Needs Triage
Pytest collection error

### Describe the bug

As of  6a16763c008446953ed9380e084ed70a285a9f7e attempting to run `pytest` on any file or directory returns a collection error (see below). I do not know if this has affected CI/CD but will check soon.

### Steps/Code to Reproduce

Run `pytest` .
This works when targeting a specific file as well (at least on the few I tested).

### Expected Results

No error is thrown and testing proceeds as normal.

### Actual Results

![image](https://user-images.githubusercontent.com/34613774/154584520-ec684a9a-92d2-4770-aefc-dfbbd3aa691d.png)

### Versions

```shell
System:
    python: 3.9.7 (default, Sep 16 2021, 16:59:28) [MSC v.1916 64 bit (AMD64)]
executable: C:\ProgramData\Anaconda3\envs\scikit-dev\python.exe
   machine: Windows-10-10.0.19043-SP0

Python dependencies:
          pip: 21.2.4
   setuptools: 58.0.4
      sklearn: 1.1.dev0
        numpy: 1.22.0
        scipy: 1.7.3
       Cython: 0.29.26
       pandas: 1.3.5
   matplotlib: 3.5.1
       joblib: 1.1.0
threadpoolctl: 3.0.0

Built with OpenMP: True

threadpoolctl info:
       user_api: openmp
   internal_api: openmp
         prefix: vcomp
       filepath: C:\Windows\System32\vcomp140.dll
        version: None
    num_threads: 12
```

COMMENT:
rebuild is always necessary when cython/c/c++ files are modified.
clean is when these files are moved, renamed, ...

Labels: Bug, Needs Triage