Talip7/scikit-learn-issues-multilabel huggingface dataset:
SelfTrainingClassifier: use of warm_start in base_estimator

### Describe the issue linked to the documentation

Hi,
I construct an instance of SelfTrainingClassifier with a base_constructor having warm_start set as True. When calling fit in SelfTrainingClassifier, is the classifier trained incrementally, or at every fit information of previous training is overwritten? I tried to figure out in documentation, but I didn't find whether re-use previous training info was allowed. I would like to pre-train a model on unsupervised data and later fine-tune it on labeled data.

Thank you for your support,
Best

### Suggest a potential alternative/fix

_No response_

COMMENT:
Hi, this issue seems stale. Can I take it?

Labels: Documentation, good first issue
SelfTrainingClassifier: use of warm_start in base_estimator

### Describe the issue linked to the documentation

Hi,
I construct an instance of SelfTrainingClassifier with a base_constructor having warm_start set as True. When calling fit in SelfTrainingClassifier, is the classifier trained incrementally, or at every fit information of previous training is overwritten? I tried to figure out in documentation, but I didn't find whether re-use previous training info was allowed. I would like to pre-train a model on unsupervised data and later fine-tune it on labeled data.

Thank you for your support,
Best

### Suggest a potential alternative/fix

_No response_

COMMENT:
Doesn't seem like there's been much activity. Feel free to have a look @gunesbayir

Labels: Documentation, good first issue
SelfTrainingClassifier: use of warm_start in base_estimator

### Describe the issue linked to the documentation

Hi,
I construct an instance of SelfTrainingClassifier with a base_constructor having warm_start set as True. When calling fit in SelfTrainingClassifier, is the classifier trained incrementally, or at every fit information of previous training is overwritten? I tried to figure out in documentation, but I didn't find whether re-use previous training info was allowed. I would like to pre-train a model on unsupervised data and later fine-tune it on labeled data.

Thank you for your support,
Best

### Suggest a potential alternative/fix

_No response_

COMMENT:
Hello, @adrinjalali I am intreseted  to work on this issue but I am a new to open source contributions, I have good knowledge of machine learning. I want to contribute to this repository. Can you please assign this issue to me?

Labels: Documentation, good first issue
SelfTrainingClassifier: use of warm_start in base_estimator

### Describe the issue linked to the documentation

Hi,
I construct an instance of SelfTrainingClassifier with a base_constructor having warm_start set as True. When calling fit in SelfTrainingClassifier, is the classifier trained incrementally, or at every fit information of previous training is overwritten? I tried to figure out in documentation, but I didn't find whether re-use previous training info was allowed. I would like to pre-train a model on unsupervised data and later fine-tune it on labeled data.

Thank you for your support,
Best

### Suggest a potential alternative/fix

_No response_

COMMENT:
We don't necessarily assign issues here @Laxmikurapati , please go through our docs (https://scikit-learn.org/dev/developers/contributing.html) where you'll find a lot of relevant info on how to contribute to this repository :)

Labels: Documentation, good first issue
SelfTrainingClassifier: use of warm_start in base_estimator

### Describe the issue linked to the documentation

Hi,
I construct an instance of SelfTrainingClassifier with a base_constructor having warm_start set as True. When calling fit in SelfTrainingClassifier, is the classifier trained incrementally, or at every fit information of previous training is overwritten? I tried to figure out in documentation, but I didn't find whether re-use previous training info was allowed. I would like to pre-train a model on unsupervised data and later fine-tune it on labeled data.

Thank you for your support,
Best

### Suggest a potential alternative/fix

_No response_

COMMENT:
Closes since it was addressed in #25325

Labels: Documentation, good first issue
PolynomialFeatures: allow separate degrees for individual features

### Describe the workflow you want to enable

[PolynomialFeatures](https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.PolynomialFeatures.html#sklearn.preprocessing.PolynomialFeatures) allows a degree parameter, but the same parameter is used for all features.

Let's say I have three features [x1, x2, x3] and I want to allow up to cubic terms in x1 and x2, but only quadratic terms in x3. This is not currently possible, but would be a useful feature in many situations.

### Describe your proposed solution

Currently, degree can be an `int` or `tuple (min_degree, max_degree)`. 
How about generalizing this so that `min_degree` and `max_degree` can be `int` or `list` of size=number of features?

COMMENT:
I think the current behaviour is complex enough. You can achieve your goal by using a [`ColumnTransformer`](https://scikit-learn.org/stable/modules/generated/sklearn.compose.ColumnTransformer.html#sklearn.compose.ColumnTransformer) and treat the columns differently as you like.
Read more in the [user guide](https://scikit-learn.org/stable/modules/compose.html#columntransformer-for-heterogeneous-data).

Labels: New Feature, Needs Triage
There seems to be an unnecessary operation in _mutual_info.py

Hi,
In file `scikit-learn/sklearn/feature_selection/_mutual_info.py`, there seems to be an unnecessary operation. 

At line 140 there is:
`m_all = np.array(m_all) - 1.0
`
But then when m_all is used at line 146
`np.mean(digamma(m_all + 1)
`
1 is added again.

This substraction and then addition of 1 seems to be unnecessary.
Thanks.

COMMENT:
Indeed. Thanks for the report @tevfikaytekin

Labels: Needs Triage
Exit Code -1073741819 when doing K-means++ clustering

### Describe the bug

Unfortunately I am getting an exit code in Pycharm when doing clustering with k-means++.
I tried nearly everything. Setup new Pycharm project try using different versions of numpy or sklearn.

### Steps/Code to Reproduce

```python
def __cluster(num_clusters: int, data: list[list[float]]):
    km = KMeans(n_clusters=num_clusters)
    return km.fit_predict(data)


distributions_filename: str = "distributions.json"
with open(distributions_filename) as f:
    distributions: list[list[float]] = json.load(f)
    buckets = __cluster(num_clusters=200, data=distributions)
```
### Expected Results

clustered buckets

### Actual Results

before the clustering is finished I get an error: "Process finished with exit code -1073741819 (0xC0000005)"

### Versions

```shell
System:
    python: 3.10.7 (tags/v3.10.7:6cc6b13, Sep  5 2022, 14:08:36) [MSC v.1933 64 bit (AMD64)]
executable: C:\Users\maron\Desktop\test\venv\Scripts\python.exe
   machine: Windows-10-10.0.19044-SP0

Python dependencies:
      sklearn: 1.1.2
          pip: 21.3.1
   setuptools: 60.2.0
        numpy: 1.23.3
        scipy: 1.9.1
       Cython: None
       pandas: None
   matplotlib: None
       joblib: 1.2.0
threadpoolctl: 3.1.0

Built with OpenMP: True

threadpoolctl info:
       user_api: openmp
   internal_api: openmp
         prefix: vcomp
       filepath: C:\Users\maron\Desktop\test\venv\Lib\site-packages\sklearn\.libs\vcomp140.dll
        version: None
    num_threads: 32

       user_api: blas
   internal_api: openblas
         prefix: libopenblas
       filepath: C:\Users\maron\Desktop\test\venv\Lib\site-packages\numpy\.libs\libopenblas.FB5AE2TYXYH2IJRDKGDGQ3XBKLKTF43H.gfortran-win_amd64.dll
        version: 0.3.20
threading_layer: pthreads
   architecture: Zen
    num_threads: 24

       user_api: blas
   internal_api: openblas
         prefix: libopenblas
       filepath: C:\Users\maron\Desktop\test\venv\Lib\site-packages\scipy\.libs\libopenblas.PZA5WNOTOH6FZLB2KBVKAURAKVTFSNNU.gfortran-win_amd64.dll
        version: 0.3.18
threading_layer: pthreads
   architecture: Zen
    num_threads: 24
```

COMMENT:
As I found out, this only happens since 1.1 changed the algorithm from auto->elkan and full->lloyd to lloyd and elkan. Since I used as it seems auto in the past and now since 1.1 the lloyd algorithm it exits the code. So I guess there is something wrong with the lloyd algorithm because with elkan everything works fine still.

Labels: Bug, module:cluster, Needs Investigation
Exit Code -1073741819 when doing K-means++ clustering

### Describe the bug

Unfortunately I am getting an exit code in Pycharm when doing clustering with k-means++.
I tried nearly everything. Setup new Pycharm project try using different versions of numpy or sklearn.

### Steps/Code to Reproduce

```python
def __cluster(num_clusters: int, data: list[list[float]]):
    km = KMeans(n_clusters=num_clusters)
    return km.fit_predict(data)


distributions_filename: str = "distributions.json"
with open(distributions_filename) as f:
    distributions: list[list[float]] = json.load(f)
    buckets = __cluster(num_clusters=200, data=distributions)
```
### Expected Results

clustered buckets

### Actual Results

before the clustering is finished I get an error: "Process finished with exit code -1073741819 (0xC0000005)"

### Versions

```shell
System:
    python: 3.10.7 (tags/v3.10.7:6cc6b13, Sep  5 2022, 14:08:36) [MSC v.1933 64 bit (AMD64)]
executable: C:\Users\maron\Desktop\test\venv\Scripts\python.exe
   machine: Windows-10-10.0.19044-SP0

Python dependencies:
      sklearn: 1.1.2
          pip: 21.3.1
   setuptools: 60.2.0
        numpy: 1.23.3
        scipy: 1.9.1
       Cython: None
       pandas: None
   matplotlib: None
       joblib: 1.2.0
threadpoolctl: 3.1.0

Built with OpenMP: True

threadpoolctl info:
       user_api: openmp
   internal_api: openmp
         prefix: vcomp
       filepath: C:\Users\maron\Desktop\test\venv\Lib\site-packages\sklearn\.libs\vcomp140.dll
        version: None
    num_threads: 32

       user_api: blas
   internal_api: openblas
         prefix: libopenblas
       filepath: C:\Users\maron\Desktop\test\venv\Lib\site-packages\numpy\.libs\libopenblas.FB5AE2TYXYH2IJRDKGDGQ3XBKLKTF43H.gfortran-win_amd64.dll
        version: 0.3.20
threading_layer: pthreads
   architecture: Zen
    num_threads: 24

       user_api: blas
   internal_api: openblas
         prefix: libopenblas
       filepath: C:\Users\maron\Desktop\test\venv\Lib\site-packages\scipy\.libs\libopenblas.PZA5WNOTOH6FZLB2KBVKAURAKVTFSNNU.gfortran-win_amd64.dll
        version: 0.3.18
threading_layer: pthreads
   architecture: Zen
    num_threads: 24
```

COMMENT:
~~Could you provide what is `__cluster` as well as the import that shows how you are using scikit-learn.~~

The summary above have been updated.

Labels: Bug, module:cluster, Needs Investigation
Exit Code -1073741819 when doing K-means++ clustering

### Describe the bug

Unfortunately I am getting an exit code in Pycharm when doing clustering with k-means++.
I tried nearly everything. Setup new Pycharm project try using different versions of numpy or sklearn.

### Steps/Code to Reproduce

```python
def __cluster(num_clusters: int, data: list[list[float]]):
    km = KMeans(n_clusters=num_clusters)
    return km.fit_predict(data)


distributions_filename: str = "distributions.json"
with open(distributions_filename) as f:
    distributions: list[list[float]] = json.load(f)
    buckets = __cluster(num_clusters=200, data=distributions)
```
### Expected Results

clustered buckets

### Actual Results

before the clustering is finished I get an error: "Process finished with exit code -1073741819 (0xC0000005)"

### Versions

```shell
System:
    python: 3.10.7 (tags/v3.10.7:6cc6b13, Sep  5 2022, 14:08:36) [MSC v.1933 64 bit (AMD64)]
executable: C:\Users\maron\Desktop\test\venv\Scripts\python.exe
   machine: Windows-10-10.0.19044-SP0

Python dependencies:
      sklearn: 1.1.2
          pip: 21.3.1
   setuptools: 60.2.0
        numpy: 1.23.3
        scipy: 1.9.1
       Cython: None
       pandas: None
   matplotlib: None
       joblib: 1.2.0
threadpoolctl: 3.1.0

Built with OpenMP: True

threadpoolctl info:
       user_api: openmp
   internal_api: openmp
         prefix: vcomp
       filepath: C:\Users\maron\Desktop\test\venv\Lib\site-packages\sklearn\.libs\vcomp140.dll
        version: None
    num_threads: 32

       user_api: blas
   internal_api: openblas
         prefix: libopenblas
       filepath: C:\Users\maron\Desktop\test\venv\Lib\site-packages\numpy\.libs\libopenblas.FB5AE2TYXYH2IJRDKGDGQ3XBKLKTF43H.gfortran-win_amd64.dll
        version: 0.3.20
threading_layer: pthreads
   architecture: Zen
    num_threads: 24

       user_api: blas
   internal_api: openblas
         prefix: libopenblas
       filepath: C:\Users\maron\Desktop\test\venv\Lib\site-packages\scipy\.libs\libopenblas.PZA5WNOTOH6FZLB2KBVKAURAKVTFSNNU.gfortran-win_amd64.dll
        version: 0.3.18
threading_layer: pthreads
   architecture: Zen
    num_threads: 24
```

COMMENT:
from sklearn.cluster import KMeans

def __cluster(num_clusters: int, data: list[list[float]]):
    km = KMeans(n_clusters=num_clusters)
    return km.fit_predict(data)

Labels: Bug, module:cluster, Needs Investigation
Exit Code -1073741819 when doing K-means++ clustering

### Describe the bug

Unfortunately I am getting an exit code in Pycharm when doing clustering with k-means++.
I tried nearly everything. Setup new Pycharm project try using different versions of numpy or sklearn.

### Steps/Code to Reproduce

```python
def __cluster(num_clusters: int, data: list[list[float]]):
    km = KMeans(n_clusters=num_clusters)
    return km.fit_predict(data)


distributions_filename: str = "distributions.json"
with open(distributions_filename) as f:
    distributions: list[list[float]] = json.load(f)
    buckets = __cluster(num_clusters=200, data=distributions)
```
### Expected Results

clustered buckets

### Actual Results

before the clustering is finished I get an error: "Process finished with exit code -1073741819 (0xC0000005)"

### Versions

```shell
System:
    python: 3.10.7 (tags/v3.10.7:6cc6b13, Sep  5 2022, 14:08:36) [MSC v.1933 64 bit (AMD64)]
executable: C:\Users\maron\Desktop\test\venv\Scripts\python.exe
   machine: Windows-10-10.0.19044-SP0

Python dependencies:
      sklearn: 1.1.2
          pip: 21.3.1
   setuptools: 60.2.0
        numpy: 1.23.3
        scipy: 1.9.1
       Cython: None
       pandas: None
   matplotlib: None
       joblib: 1.2.0
threadpoolctl: 3.1.0

Built with OpenMP: True

threadpoolctl info:
       user_api: openmp
   internal_api: openmp
         prefix: vcomp
       filepath: C:\Users\maron\Desktop\test\venv\Lib\site-packages\sklearn\.libs\vcomp140.dll
        version: None
    num_threads: 32

       user_api: blas
   internal_api: openblas
         prefix: libopenblas
       filepath: C:\Users\maron\Desktop\test\venv\Lib\site-packages\numpy\.libs\libopenblas.FB5AE2TYXYH2IJRDKGDGQ3XBKLKTF43H.gfortran-win_amd64.dll
        version: 0.3.20
threading_layer: pthreads
   architecture: Zen
    num_threads: 24

       user_api: blas
   internal_api: openblas
         prefix: libopenblas
       filepath: C:\Users\maron\Desktop\test\venv\Lib\site-packages\scipy\.libs\libopenblas.PZA5WNOTOH6FZLB2KBVKAURAKVTFSNNU.gfortran-win_amd64.dll
        version: 0.3.18
threading_layer: pthreads
   architecture: Zen
    num_threads: 24
```

COMMENT:
```python
def __cluster(num_clusters: int, data: list[list[float]]):
    km = KMeans(n_clusters=num_clusters, init="k-means++", algorithm="elkan")
    return km.fit_predict(data)
```
is working, as I previously mentioned due to using elkan instead of lloyd

Labels: Bug, module:cluster, Needs Investigation
Exit Code -1073741819 when doing K-means++ clustering

### Describe the bug

Unfortunately I am getting an exit code in Pycharm when doing clustering with k-means++.
I tried nearly everything. Setup new Pycharm project try using different versions of numpy or sklearn.

### Steps/Code to Reproduce

```python
def __cluster(num_clusters: int, data: list[list[float]]):
    km = KMeans(n_clusters=num_clusters)
    return km.fit_predict(data)


distributions_filename: str = "distributions.json"
with open(distributions_filename) as f:
    distributions: list[list[float]] = json.load(f)
    buckets = __cluster(num_clusters=200, data=distributions)
```
### Expected Results

clustered buckets

### Actual Results

before the clustering is finished I get an error: "Process finished with exit code -1073741819 (0xC0000005)"

### Versions

```shell
System:
    python: 3.10.7 (tags/v3.10.7:6cc6b13, Sep  5 2022, 14:08:36) [MSC v.1933 64 bit (AMD64)]
executable: C:\Users\maron\Desktop\test\venv\Scripts\python.exe
   machine: Windows-10-10.0.19044-SP0

Python dependencies:
      sklearn: 1.1.2
          pip: 21.3.1
   setuptools: 60.2.0
        numpy: 1.23.3
        scipy: 1.9.1
       Cython: None
       pandas: None
   matplotlib: None
       joblib: 1.2.0
threadpoolctl: 3.1.0

Built with OpenMP: True

threadpoolctl info:
       user_api: openmp
   internal_api: openmp
         prefix: vcomp
       filepath: C:\Users\maron\Desktop\test\venv\Lib\site-packages\sklearn\.libs\vcomp140.dll
        version: None
    num_threads: 32

       user_api: blas
   internal_api: openblas
         prefix: libopenblas
       filepath: C:\Users\maron\Desktop\test\venv\Lib\site-packages\numpy\.libs\libopenblas.FB5AE2TYXYH2IJRDKGDGQ3XBKLKTF43H.gfortran-win_amd64.dll
        version: 0.3.20
threading_layer: pthreads
   architecture: Zen
    num_threads: 24

       user_api: blas
   internal_api: openblas
         prefix: libopenblas
       filepath: C:\Users\maron\Desktop\test\venv\Lib\site-packages\scipy\.libs\libopenblas.PZA5WNOTOH6FZLB2KBVKAURAKVTFSNNU.gfortran-win_amd64.dll
        version: 0.3.18
threading_layer: pthreads
   architecture: Zen
    num_threads: 24
```

COMMENT:
[distributions.txt](https://github.com/scikit-learn/scikit-learn/files/9786368/distributions.txt)

Labels: Bug, module:cluster, Needs Investigation
Segmentation error when calling .fit()

### Describe the bug

Hey all,

I'm currently busy working on a solution for a classification problem using LogisticRegression from sklearn.linear_model. I'm training multiple classifiers at the same time with the same hyperparameters and only slightly different input. The largest difference is coming from the number of unique labels.

I don't have any issues fitting data on a model with size 1.500.000 x 20000 with ~200 unique labels. I do however run into issues when my training data has size 1.000.000 X 11000 with ~2500 labels. I'm executing these on docker containers but after calling .fit my containers exit and get an exit code of 139 indicating a segmentation error. I'm using the saga solver. As far as I know this is not a python error but underlying cython problem and my hunch is that because of my dimensions I'm getting a stack overflow somewhere. I've already checked out the source code but did not find any conclusive answers.

My question is: does anyone have an idea where this actually goes wrong and if there is a workaround?

I'm running scikit-learn==1.0.2 with Python 3.7.11

### Steps/Code to Reproduce

```python3
import numpy as np
from sklearn.linear_model import LogisticRegression

nrows = 1000000
num_features = 11000
unique_labels = 2500

features = np.random.rand(nrows, num_features) 
target = np.random.randint(low=0,high=unique_labels, size=nrows)

clf = LogisticRegression(C=1, solver='saga', max_iter=1, verbose=1)
clf.fit(features,target)
```

### Expected Results

No error is thrown.

### Actual Results

Nothing in the traceback. My container exits with status code 139. When running this on Jupyter my kernel exits.

### Versions

```shell
System:
    python: 3.7.11 (default, Jul 22 2021, 16:14:15)  [GCC 6.3.0 20170516]
executable: /usr/local/bin/python
   machine: Linux-5.10.104-linuxkit-x86_64-with-debian-9.13

Python dependencies:
          pip: 19.3.1
   setuptools: 57.4.0
      sklearn: 1.0.2
        numpy: 1.21.6
        scipy: 1.7.3
       Cython: None
       pandas: 1.3.5
   matplotlib: None
       joblib: 1.2.0
threadpoolctl: 3.1.0

Built with OpenMP: True
```

COMMENT:
Closing since we are missing information. Feel free to open a new ticket with more details.

Labels: Bug, Needs Triage
Segmentation error when calling .fit()

### Describe the bug

Hey all,

I'm currently busy working on a solution for a classification problem using LogisticRegression from sklearn.linear_model. I'm training multiple classifiers at the same time with the same hyperparameters and only slightly different input. The largest difference is coming from the number of unique labels.

I don't have any issues fitting data on a model with size 1.500.000 x 20000 with ~200 unique labels. I do however run into issues when my training data has size 1.000.000 X 11000 with ~2500 labels. I'm executing these on docker containers but after calling .fit my containers exit and get an exit code of 139 indicating a segmentation error. I'm using the saga solver. As far as I know this is not a python error but underlying cython problem and my hunch is that because of my dimensions I'm getting a stack overflow somewhere. I've already checked out the source code but did not find any conclusive answers.

My question is: does anyone have an idea where this actually goes wrong and if there is a workaround?

I'm running scikit-learn==1.0.2 with Python 3.7.11

### Steps/Code to Reproduce

```python3
import numpy as np
from sklearn.linear_model import LogisticRegression

nrows = 1000000
num_features = 11000
unique_labels = 2500

features = np.random.rand(nrows, num_features) 
target = np.random.randint(low=0,high=unique_labels, size=nrows)

clf = LogisticRegression(C=1, solver='saga', max_iter=1, verbose=1)
clf.fit(features,target)
```

### Expected Results

No error is thrown.

### Actual Results

Nothing in the traceback. My container exits with status code 139. When running this on Jupyter my kernel exits.

### Versions

```shell
System:
    python: 3.7.11 (default, Jul 22 2021, 16:14:15)  [GCC 6.3.0 20170516]
executable: /usr/local/bin/python
   machine: Linux-5.10.104-linuxkit-x86_64-with-debian-9.13

Python dependencies:
          pip: 19.3.1
   setuptools: 57.4.0
      sklearn: 1.0.2
        numpy: 1.21.6
        scipy: 1.7.3
       Cython: None
       pandas: 1.3.5
   matplotlib: None
       joblib: 1.2.0
threadpoolctl: 3.1.0

Built with OpenMP: True
```

COMMENT:
@glemaitre @JoostKooijman For the record, I'm running into the exact same issue with `X` having shape `(236000,1)` and `y` with shape `(236000,)` and type `float16`. That's mo more than 1GB in RAM and I'm working on a cluster with 60GB of RAM.
Number of unique labels: 3

Switching to [skglm](https://github.com/scikit-learn-contrib/skglm)'s Sparse Logistic Regression did the trick for me.

Labels: Bug, Needs Triage
Saved model

Hi,

I have saved a model of RandomForestClassifier from previous version (0.21.3).
now, if i try to load it in a new version i get the following error: No module name 'sklearn.ensemble.forest'

How can I transfer my previous saved model to a new version?

COMMENT:
Hi @yana25,

Loading a model saved in a previous version is not supported. You can find more information here
https://scikit-learn.org/stable/model_persistence.html#security-maintainability-limitations

in particular:
```
While models saved using one version of scikit-learn might load in other versions,
this is entirely unsupported and inadvisable. It should also be kept in mind that
operations performed on such data could give different and unexpected results.
```

Labels: Question