Talip7/scikit-learn-issues-multilabel huggingface dataset:
Update from sckit-learn 0.24.2 to scikit-learn-1.0.2-py38hae1ba45_ gets Linking Error

### Describe the bug

INFO conda.core.link:_execute_actions(771): ===> LINKING PACKAGE: anaconda::scikit-learn-1.0.2-py38hae1ba45_1 <===
  prefix=/Users/davidlaxer/anaconda3/envs/ai
  source=/Users/davidlaxer/anaconda3/pkgs/scikit-learn-1.0.2-py38hae1ba45_1

INFO conda.core.link:_reverse_actions(821): ===> REVERSING PACKAGE LINK: anaconda::python.app-3-py38hca72f7f_0 <===
  prefix=/Users/davidlaxer/anaconda3/envs/ai


### Steps/Code to Reproduce

```
% conda list scikit-learn
# packages in environment at /Users/davidlaxer/anaconda3/envs/ai:
#
# Name                    Version                   Build  Channel
scikit-learn              0.24.2           py38hb2f4e1b_0    anaconda
scikit-learn-intelex      2021.5.0         py38hecd8cb5_0    anaconda
(ai) davidlaxer@x86_64-apple-darwin13 ~ % 
(ai) davidlaxer@x86_64-apple-darwin13 ~ % python
Python 3.8.5 (default, Sep  4 2020, 02:22:02) 
...
$ conda update --all
```



### Expected Results

ERROR conda.core.link:_execute(730): An error occurred while installing package 'anaconda::python.app-3-py38hca72f7f_0'.
Rolling back transaction: done

LinkError: post-link script failed for package anaconda::python.app-3-py38hca72f7f_0
location of failed script: /Users/davidlaxer/anaconda3/envs/ai/bin/.python.app-post-link.sh
==> script messages <==
<None>
==> script output <==
stdout: 
stderr: ln: ./lib: File exists

return code: 1

()


### Actual Results

conda.CondaMultiError: post-link script failed for package anaconda::python.app-3-py38hca72f7f_0
location of failed script: /Users/davidlaxer/anaconda3/envs/ai/bin/.python.app-post-link.sh
==> script messages <==
<None>
==> script output <==
stdout: 
stderr: ln: ./lib: File exists

return code: 1

()


### Versions

```shell
sklearn.show_versions()

System:
    python: 3.8.5 (default, Sep  4 2020, 02:22:02)  [Clang 10.0.0 ]
executable: /Users/davidlaxer/anaconda3/envs/ai/bin/python
   machine: macOS-10.16-x86_64-i386-64bit

Python dependencies:
          pip: 22.0.3
   setuptools: 50.3.0.post20201006
      sklearn: 0.24.2
        numpy: 1.21.5
        scipy: 1.7.3
       Cython: 0.29.23
       pandas: 1.3.4
   matplotlib: None
       joblib: 0.17.0
threadpoolctl: 2.1.0

Built with OpenMP: True
```

COMMENT:
The issue appears to be in python.app and NOT in sklearn.
```
% conda list python.app
# packages in environment at /Users/davidlaxer/anaconda3/envs/ai:
#
# Name                    Version                   Build  Channel
python.app                2                       py38_10    anaconda
```

Labels: Bug, Needs Triage
pyinstaller exe error No module named 'sklearn.utils._typedefs'

### Describe the bug
in my code 
 from sklearn.ensemble import RandomForestClassifier

When I use pyinstaller to convert my .py file to exe it work on scikit-learn version 0.24.2 but not 1.0.2

The command I use is pyinstaller --hidden-import="sklearn.utils._cython_blas" --hidden-import="sklearn.neighbors.typedefs" --hidden-import="sklearn.neighbors.quad_tree" --hidden-import="sklearn.tree._utils" -F myprgname.py



### Steps/Code to Reproduce

#Create a myprg.py file with following code
from sklearn.ensemble import RandomForestClassifier

# then run pyinstaller in command prompt
pyinstaller --hidden-import="sklearn.utils._cython_blas" --hidden-import="sklearn.neighbors.typedefs" --hidden-import="sklearn.neighbors.quad_tree" --hidden-import="sklearn.tree._utils" --hiddenimport win32timezone -F myprg.py

# run exefile
myprg.exe





### Expected Results
on error

### Actual Results

File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
  File "sklearn\ensemble\__init__.py", line 5, in <module>
  File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
  File "sklearn\ensemble\_base.py", line 18, in <module>
  File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
  File "sklearn\tree\__init__.py", line 6, in <module>
  File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
  File "sklearn\tree\_classes.py", line 41, in <module>
  File "sklearn\tree\_criterion.pyx", line 1, in init sklearn.tree._criterion
  File "sklearn\tree\_splitter.pyx", line 1, in init sklearn.tree._splitter
  File "sklearn\tree\_tree.pyx", line 1, in init sklearn.tree._tree
  File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
  File "sklearn\neighbors\__init__.py", line 6, in <module>
  File "sklearn\neighbors\_ball_tree.pyx", line 1, in init sklearn.neighbors._ball_tree
  File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
  File "sklearn\metrics\__init__.py", line 39, in <module>
  File "sklearn\metrics\_dist_metrics.pyx", line 31, in init sklearn.metrics._dist_metrics
ModuleNotFoundError: No module named 'sklearn.utils._typedefs'
### Versions

```shell
1.0.2
```

COMMENT:
At a glance, the hidden import paths need to be specified. In this case the following worked for me (with sklearn 1.0.2)

```bash
pyinstaller --hidden-import="sklearn.utils._typedefs" \
            --hidden-import="sklearn.neighbors._partition_nodes" \
            -F myprg.py
```

Note these paths may change from version to version because they are private. In [v0.22](https://scikit-learn.org/stable/whats_new/v0.22.html#clear-definition-of-the-public-api), scikit-learn deprecated a lot of modules such as `sklearn.neighbors.quad_tree` and made them private, so they are not available anymore in 1.0.

I am closing this issue, because it is about using `pyinstaller` and not a bug with scikit-learn itself.

Labels: Question
pyinstaller exe error No module named 'sklearn.utils._typedefs'

### Describe the bug
in my code 
 from sklearn.ensemble import RandomForestClassifier

When I use pyinstaller to convert my .py file to exe it work on scikit-learn version 0.24.2 but not 1.0.2

The command I use is pyinstaller --hidden-import="sklearn.utils._cython_blas" --hidden-import="sklearn.neighbors.typedefs" --hidden-import="sklearn.neighbors.quad_tree" --hidden-import="sklearn.tree._utils" -F myprgname.py



### Steps/Code to Reproduce

#Create a myprg.py file with following code
from sklearn.ensemble import RandomForestClassifier

# then run pyinstaller in command prompt
pyinstaller --hidden-import="sklearn.utils._cython_blas" --hidden-import="sklearn.neighbors.typedefs" --hidden-import="sklearn.neighbors.quad_tree" --hidden-import="sklearn.tree._utils" --hiddenimport win32timezone -F myprg.py

# run exefile
myprg.exe





### Expected Results
on error

### Actual Results

File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
  File "sklearn\ensemble\__init__.py", line 5, in <module>
  File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
  File "sklearn\ensemble\_base.py", line 18, in <module>
  File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
  File "sklearn\tree\__init__.py", line 6, in <module>
  File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
  File "sklearn\tree\_classes.py", line 41, in <module>
  File "sklearn\tree\_criterion.pyx", line 1, in init sklearn.tree._criterion
  File "sklearn\tree\_splitter.pyx", line 1, in init sklearn.tree._splitter
  File "sklearn\tree\_tree.pyx", line 1, in init sklearn.tree._tree
  File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
  File "sklearn\neighbors\__init__.py", line 6, in <module>
  File "sklearn\neighbors\_ball_tree.pyx", line 1, in init sklearn.neighbors._ball_tree
  File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
  File "sklearn\metrics\__init__.py", line 39, in <module>
  File "sklearn\metrics\_dist_metrics.pyx", line 31, in init sklearn.metrics._dist_metrics
ModuleNotFoundError: No module named 'sklearn.utils._typedefs'
### Versions

```shell
1.0.2
```

COMMENT:
It's works. 
I really appreciate your help.

Labels: Question
Improve SVR vs KRR example further

Follow up of https://github.com/scikit-learn/scikit-learn/pull/22804, example code is https://github.com/scikit-learn/scikit-learn/blob/main/examples/miscellaneous/plot_kernel_ridge_regression.py

- once the grid-search is done use `svr.best_estimator_` and `kr.best_estimator_` as mentioned in https://github.com/scikit-learn/scikit-learn/pull/22804#discussion_r825469629. Maybe using the same gamma and an "equivalent" `C = 1 / alpha` was done on purpose to be able to compare both models in a more fair fashion, not entirely sure.
- Add train scores to learning curve and maybe use 1000 samples rather than 100 samples: https://github.com/scikit-learn/scikit-learn/pull/22804#issuecomment-1066134467. When doing that the learning curve don't make too much sense, try to understand why ...
- timings can change between two runs, not sure what to do, doing more runs will make the example slower and the example is already taking ~20s. Also this may be sensitive to `OPENBLAS_NUM_THREADS` (or `MKL_NUM_THREADS`).

COMMENT:
@lesteve, could you help me answer these two questions?

1) Is this Issue still open? 
I have checked, and it seems that the related PR #26365 is stalled. If it is the case, I could work on it

2) Do you think this Issue is too hard to be a "second contribution"? My first contribution was a [small change in the docs](https://github.com/scikit-learn/scikit-learn/pull/31173) last week  
I read the bullet points in the description, and I think I can handle it, but I need to investigate it properly first. Maybe I will ask more questions/information also

Labels: Documentation
Improve SVR vs KRR example further

Follow up of https://github.com/scikit-learn/scikit-learn/pull/22804, example code is https://github.com/scikit-learn/scikit-learn/blob/main/examples/miscellaneous/plot_kernel_ridge_regression.py

- once the grid-search is done use `svr.best_estimator_` and `kr.best_estimator_` as mentioned in https://github.com/scikit-learn/scikit-learn/pull/22804#discussion_r825469629. Maybe using the same gamma and an "equivalent" `C = 1 / alpha` was done on purpose to be able to compare both models in a more fair fashion, not entirely sure.
- Add train scores to learning curve and maybe use 1000 samples rather than 100 samples: https://github.com/scikit-learn/scikit-learn/pull/22804#issuecomment-1066134467. When doing that the learning curve don't make too much sense, try to understand why ...
- timings can change between two runs, not sure what to do, doing more runs will make the example slower and the example is already taking ~20s. Also this may be sensitive to `OPENBLAS_NUM_THREADS` (or `MKL_NUM_THREADS`).

COMMENT:
Thanks for asking @vitorpohlenz! It's been inactive for a few years and personally I think this is too low priority so that it is not worth working on it. I am going to close this one.

Labels: Documentation
Improve SVR vs KRR example further

Follow up of https://github.com/scikit-learn/scikit-learn/pull/22804, example code is https://github.com/scikit-learn/scikit-learn/blob/main/examples/miscellaneous/plot_kernel_ridge_regression.py

- once the grid-search is done use `svr.best_estimator_` and `kr.best_estimator_` as mentioned in https://github.com/scikit-learn/scikit-learn/pull/22804#discussion_r825469629. Maybe using the same gamma and an "equivalent" `C = 1 / alpha` was done on purpose to be able to compare both models in a more fair fashion, not entirely sure.
- Add train scores to learning curve and maybe use 1000 samples rather than 100 samples: https://github.com/scikit-learn/scikit-learn/pull/22804#issuecomment-1066134467. When doing that the learning curve don't make too much sense, try to understand why ...
- timings can change between two runs, not sure what to do, doing more runs will make the example slower and the example is already taking ~20s. Also this may be sensitive to `OPENBLAS_NUM_THREADS` (or `MKL_NUM_THREADS`).

COMMENT:
> Thanks for asking [@vitorpohlenz](https://github.com/vitorpohlenz)! It's been inactive for a few years and personally I think this is too low priority so that it is not worth working on it. I am going to close this one.

Thanks for replying @lesteve !
[The text below is completely unrelated to this Issue].

Actually, I'm trying to find an Issue to work on, but it is been a bit hard to find one that is unclaimed. So I started looking at the stalled ones. If by chance, do you know (or know a person who knows) some Issue that is unclaimed and seems a "good second issue", just ping me, I would appreciate that help.

Labels: Documentation
Improve SVR vs KRR example further

Follow up of https://github.com/scikit-learn/scikit-learn/pull/22804, example code is https://github.com/scikit-learn/scikit-learn/blob/main/examples/miscellaneous/plot_kernel_ridge_regression.py

- once the grid-search is done use `svr.best_estimator_` and `kr.best_estimator_` as mentioned in https://github.com/scikit-learn/scikit-learn/pull/22804#discussion_r825469629. Maybe using the same gamma and an "equivalent" `C = 1 / alpha` was done on purpose to be able to compare both models in a more fair fashion, not entirely sure.
- Add train scores to learning curve and maybe use 1000 samples rather than 100 samples: https://github.com/scikit-learn/scikit-learn/pull/22804#issuecomment-1066134467. When doing that the learning curve don't make too much sense, try to understand why ...
- timings can change between two runs, not sure what to do, doing more runs will make the example slower and the example is already taking ~20s. Also this may be sensitive to `OPENBLAS_NUM_THREADS` (or `MKL_NUM_THREADS`).

COMMENT:
@vitorpohlenz I guess if you want you could try and give feed-back on my PR https://github.com/scikit-learn/scikit-learn/pull/31212. It is supposed to improve the situation with long path on Windows you have bumped into when compiling from source.

Maybe you could also have a look at https://github.com/scikit-learn/scikit-learn/issues/18187. It's an old issue on Windows. I guess the first step would be to see if you manage to reproduce or whether it has been fixed since (which is completely possible because it's a bit old ...).

In general, it's not always completely trivial to find something to work on. I would suggest to read our [Issues for new contributors](https://scikit-learn.org/dev/developers/contributing.html#issues-for-new-contributors) if you haven't already and in particular look at labels like "help wanted", "needs investigation", "needs info" etc ...

Labels: Documentation
Improve SVR vs KRR example further

Follow up of https://github.com/scikit-learn/scikit-learn/pull/22804, example code is https://github.com/scikit-learn/scikit-learn/blob/main/examples/miscellaneous/plot_kernel_ridge_regression.py

- once the grid-search is done use `svr.best_estimator_` and `kr.best_estimator_` as mentioned in https://github.com/scikit-learn/scikit-learn/pull/22804#discussion_r825469629. Maybe using the same gamma and an "equivalent" `C = 1 / alpha` was done on purpose to be able to compare both models in a more fair fashion, not entirely sure.
- Add train scores to learning curve and maybe use 1000 samples rather than 100 samples: https://github.com/scikit-learn/scikit-learn/pull/22804#issuecomment-1066134467. When doing that the learning curve don't make too much sense, try to understand why ...
- timings can change between two runs, not sure what to do, doing more runs will make the example slower and the example is already taking ~20s. Also this may be sensitive to `OPENBLAS_NUM_THREADS` (or `MKL_NUM_THREADS`).

COMMENT:
> [@vitorpohlenz](https://github.com/vitorpohlenz) I guess if you want you could try and give feed-back on my PR [#31212](https://github.com/scikit-learn/scikit-learn/pull/31212). It is supposed to improve the situation with long path on Windows you have bumped into when compiling from source.
> 
> Maybe you could also have a look at [#18187](https://github.com/scikit-learn/scikit-learn/issues/18187). It's an old issue on Windows. I guess the first step would be to see if you manage to reproduce or whether it has been fixed since (which is completely possible because it's a bit old ...).
> 
> In general, it's not always completely trivial to find something to work on. I would suggest to read our [Issues for new contributors](https://scikit-learn.org/dev/developers/contributing.html#issues-for-new-contributors) if you haven't already and in particular look at labels like "help wanted", "needs investigation", "needs info" etc ...

Thanks for taking the time to send me some possibilities @lesteve !
I read the [Contributing](https://scikit-learn.org/dev/developers/contributing.html#contributing-code), and I am continuously checking some labels like those ones and "Stalled" ones, but as you said, sometimes it is not trivial to find a "suitable" one to work on in the beginning.

Thanks again for the tips!

Labels: Documentation
Scan examples to see where HistGradientBoostingRegressor should replace GradientBoostingRegressor

### Describe the issue linked to the documentation

People still use GradientBoostingRegressor where they should probably be using HistGradientBoostingRegressor (and similar for Classifier).

We need to avoid situations where people find by chance / mistake the non Hist version as for instance people finding the non Hist version in examples.



### Suggest a potential alternative/fix

We should scan the existing examples (as listed on the bottom of
https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.GradientBoostingRegressor.html and https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.GradientBoostingClassifier.html) and see which can be replaced by the Hist version.

COMMENT:
What seem also a quick improvement would be to mention in the `GradientBoosting*` docstring and user guide something like this (this is already in the `HistGradientBoosting*` docstring and user guide but adding it the other way around as well would probably help redirect users to the `HistGradientBoosting*` classes):

> The [HistGradientBoostingClassifier](https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.HistGradientBoostingClassifier.html#sklearn.ensemble.GradientBoostingClassifier) estimator is much faster than [GradientBoostingClassifier](https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.GradientBoostingClassifier.html#sklearn.ensemble.GradientBoostingClassifier) for big datasets (n_samples >= 10 000).

Labels: Easy, Documentation
Scan examples to see where HistGradientBoostingRegressor should replace GradientBoostingRegressor

### Describe the issue linked to the documentation

People still use GradientBoostingRegressor where they should probably be using HistGradientBoostingRegressor (and similar for Classifier).

We need to avoid situations where people find by chance / mistake the non Hist version as for instance people finding the non Hist version in examples.



### Suggest a potential alternative/fix

We should scan the existing examples (as listed on the bottom of
https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.GradientBoostingRegressor.html and https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.GradientBoostingClassifier.html) and see which can be replaced by the Hist version.

COMMENT:
Indeed, we already have the note inside the user guide. However, we should add the suggested node in the API documentation. It might be worth adding it as a note in the long summary since the "Notes" section will come late on the page.

I quickly look at the example and I think that most of them can indeed be improved using the new implementation. It might actually be worth to make to a small example similar to the following: https://inria.github.io/scikit-learn-mooc/python_scripts/ensemble_hist_gradient_boosting.html

It will give the intuition behind the `HistGradientBoosting` and show already some speed-up.

Labels: Easy, Documentation
Scan examples to see where HistGradientBoostingRegressor should replace GradientBoostingRegressor

### Describe the issue linked to the documentation

People still use GradientBoostingRegressor where they should probably be using HistGradientBoostingRegressor (and similar for Classifier).

We need to avoid situations where people find by chance / mistake the non Hist version as for instance people finding the non Hist version in examples.



### Suggest a potential alternative/fix

We should scan the existing examples (as listed on the bottom of
https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.GradientBoostingRegressor.html and https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.GradientBoostingClassifier.html) and see which can be replaced by the Hist version.

COMMENT:
/take

Labels: Easy, Documentation
Scan examples to see where HistGradientBoostingRegressor should replace GradientBoostingRegressor

### Describe the issue linked to the documentation

People still use GradientBoostingRegressor where they should probably be using HistGradientBoostingRegressor (and similar for Classifier).

We need to avoid situations where people find by chance / mistake the non Hist version as for instance people finding the non Hist version in examples.



### Suggest a potential alternative/fix

We should scan the existing examples (as listed on the bottom of
https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.GradientBoostingRegressor.html and https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.GradientBoostingClassifier.html) and see which can be replaced by the Hist version.

COMMENT:
Closed by #23340. If someone thinks there were additional things left to do, feel free to reopen with more details of what remains to be done.

side-comment: @ArturoAmorQ apparently "addresses #issueNumber" is not a recognized keyword to auto-close issue, see 
https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue. But maybe it was on purpose since you had other changes in mind ...

Labels: Easy, Documentation
Scan examples to see where HistGradientBoostingRegressor should replace GradientBoostingRegressor

### Describe the issue linked to the documentation

People still use GradientBoostingRegressor where they should probably be using HistGradientBoostingRegressor (and similar for Classifier).

We need to avoid situations where people find by chance / mistake the non Hist version as for instance people finding the non Hist version in examples.



### Suggest a potential alternative/fix

We should scan the existing examples (as listed on the bottom of
https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.GradientBoostingRegressor.html and https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.GradientBoostingClassifier.html) and see which can be replaced by the Hist version.

COMMENT:
It was on purpose, indeed. But this is already a good fix, unless @GaelVaroquaux really thinks its worth revamping the examples.

Labels: Easy, Documentation