Talip7/scikit-learn-issues-multilabel huggingface dataset:
Unable to use TunedThresholdClassifierCV' in kaggle

### Describe the bug

Unable to use TunedThresholdClassifierCV' in Kaggle 

### Steps/Code to Reproduce

from sklearn.datasets import make_classification
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import classification_report
from sklearn.model_selection import TunedThresholdClassifierCV, train_test_split
X, y = make_classification(
    n_samples=1_000, weights=[0.9, 0.1], class_sep=0.8, random_state=42
)
X_train, X_test, y_train, y_test = train_test_split(
    X, y, stratify=y, random_state=42
)
classifier = RandomForestClassifier(random_state=0).fit(X_train, y_train)
print(classification_report(y_test, classifier.predict(X_test)))

### Expected Results

no error 

### Actual Results

from sklearn.model_selection import TunedThresholdClassifierCV
ImportError: cannot import name 'TunedThresholdClassifierCV' from 'sklearn.model_selection' (/opt/conda/lib/python3.10/site-packages/sklearn/model_selection/__init__.py)

### Versions

```shell
System:
    python: 3.10.13 | packaged by conda-forge | (main, Dec 23 2023, 15:36:39) [GCC 12.3.0]
executable: /opt/conda/bin/python3.10
   machine: Linux-5.15.133+-x86_64-with-glibc2.31

Python dependencies:
      sklearn: 1.2.2
          pip: 23.3.2
   setuptools: 69.0.3
        numpy: 1.26.4
        scipy: 1.11.4
       Cython: 3.0.8
       pandas: 2.2.2
   matplotlib: 3.7.5
       joblib: 1.4.2
threadpoolctl: 3.2.0

Built with OpenMP: True

threadpoolctl info:
       user_api: blas
   internal_api: openblas
    num_threads: 4
         prefix: libopenblas
       filepath: /opt/conda/lib/python3.10/site-packages/numpy.libs/libopenblas64_p-r0-0cf96a72.3.23.dev.so
        version: 0.3.23.dev
threading_layer: pthreads
   architecture: Haswell

       user_api: blas
   internal_api: openblas
    num_threads: 4
         prefix: libopenblas
       filepath: /opt/conda/lib/python3.10/site-packages/scipy.libs/libopenblasp-r0-23e5df77.3.21.dev.so
        version: 0.3.21.dev
threading_layer: pthreads
   architecture: Haswell

       user_api: openmp
   internal_api: openmp
    num_threads: 4
         prefix: libomp
       filepath: /opt/conda/lib/libomp.so
        version: None
```

COMMENT:
You need sklearn>=1.5 for this feature, you're having sklearn=1.2.2 in your environment.

Labels: Bug, Needs Triage
DOC Beginners Tutorial

We need to have a section in our user guide introducing new users to a few concepts similar to what was present in our basics tutorial: https://github.com/scikit-learn/scikit-learn/blob/bc7e52ad7379fd8138418619a1cb0aeef07896a9/doc/tutorial/basic/tutorial.rst

This can go into our "Getting Started" or can be something linked from "Getting Started" page.

We should also link from our docs to the MOOC: https://inria.github.io/scikit-learn-mooc/

COMMENT:
Thank you for raising this issue! It's true that the current user guide can be a bit overwhelming for beginners who are new to machine learning.

I really like the suggestion of creating a new section something like ("Before you get started"/"Getting Started") that includes content highlighted in the 'basics tutorial.' This could significantly improve the onboarding experience for new users.

I'm familiar with scikit-learn and have experience writing technical documentation. I'd be happy to help develop this section to incorporate these introductory concepts.

Is there a specific format or style guide for contributing to the user guide? I'm happy to follow any existing guidelines and collaborate with you on this effort.

Labels: Documentation, Moderate
DOC Beginners Tutorial

We need to have a section in our user guide introducing new users to a few concepts similar to what was present in our basics tutorial: https://github.com/scikit-learn/scikit-learn/blob/bc7e52ad7379fd8138418619a1cb0aeef07896a9/doc/tutorial/basic/tutorial.rst

This can go into our "Getting Started" or can be something linked from "Getting Started" page.

We should also link from our docs to the MOOC: https://inria.github.io/scikit-learn-mooc/

COMMENT:
The format / style guide would be the same as what we already have in the user guide. You might wanna have a look at our contributing guide, specifically the documentation part: https://scikit-learn.org/dev/developers/contributing.html#documentation

Labels: Documentation, Moderate
DOC Beginners Tutorial

We need to have a section in our user guide introducing new users to a few concepts similar to what was present in our basics tutorial: https://github.com/scikit-learn/scikit-learn/blob/bc7e52ad7379fd8138418619a1cb0aeef07896a9/doc/tutorial/basic/tutorial.rst

This can go into our "Getting Started" or can be something linked from "Getting Started" page.

We should also link from our docs to the MOOC: https://inria.github.io/scikit-learn-mooc/

COMMENT:
I noted that the current [Getting Started](https://scikit-learn.org/dev/getting_started.html) (1) section outside User Guide covers basic commands re: model training and evaluation. 

While the [tutorial](https://github.com/scikit-learn/scikit-learn/blob/bc7e52ad7379fd8138418619a1cb0aeef07896a9/doc/tutorial/basic/tutorial.rst) (2) covers brief foundational ML theory.

Combining (1) and (2) would give the users a more comprehensive starting point, and make them better prepared for the User Guide. I can get started on one section that covers that.

If you have any initial thoughts (topics, structure) & a timeline for this, please let me know. Thanks!

Labels: Documentation, Moderate
DOC Beginners Tutorial

We need to have a section in our user guide introducing new users to a few concepts similar to what was present in our basics tutorial: https://github.com/scikit-learn/scikit-learn/blob/bc7e52ad7379fd8138418619a1cb0aeef07896a9/doc/tutorial/basic/tutorial.rst

This can go into our "Getting Started" or can be something linked from "Getting Started" page.

We should also link from our docs to the MOOC: https://inria.github.io/scikit-learn-mooc/

COMMENT:
Hey can I work on this if this issue's open?

Labels: Documentation, Moderate
DOC Beginners Tutorial

We need to have a section in our user guide introducing new users to a few concepts similar to what was present in our basics tutorial: https://github.com/scikit-learn/scikit-learn/blob/bc7e52ad7379fd8138418619a1cb0aeef07896a9/doc/tutorial/basic/tutorial.rst

This can go into our "Getting Started" or can be something linked from "Getting Started" page.

We should also link from our docs to the MOOC: https://inria.github.io/scikit-learn-mooc/

COMMENT:
@hoipranav this is not suitable as a first contribution. I suggest you start with easier issues or to continue pull requests that are marked as easy and stalled

Labels: Documentation, Moderate
DOC Beginners Tutorial

We need to have a section in our user guide introducing new users to a few concepts similar to what was present in our basics tutorial: https://github.com/scikit-learn/scikit-learn/blob/bc7e52ad7379fd8138418619a1cb0aeef07896a9/doc/tutorial/basic/tutorial.rst

This can go into our "Getting Started" or can be something linked from "Getting Started" page.

We should also link from our docs to the MOOC: https://inria.github.io/scikit-learn-mooc/

COMMENT:
Okay @adrinjalali I'll surely look into some easier or stalled PR. Thank you!

Labels: Documentation, Moderate
DOC Beginners Tutorial

We need to have a section in our user guide introducing new users to a few concepts similar to what was present in our basics tutorial: https://github.com/scikit-learn/scikit-learn/blob/bc7e52ad7379fd8138418619a1cb0aeef07896a9/doc/tutorial/basic/tutorial.rst

This can go into our "Getting Started" or can be something linked from "Getting Started" page.

We should also link from our docs to the MOOC: https://inria.github.io/scikit-learn-mooc/

COMMENT:
This is somewhat related to https://github.com/scikit-learn/scikit-learn/issues/30445, but with a different approach.

Labels: Documentation, Moderate
DOC Beginners Tutorial

We need to have a section in our user guide introducing new users to a few concepts similar to what was present in our basics tutorial: https://github.com/scikit-learn/scikit-learn/blob/bc7e52ad7379fd8138418619a1cb0aeef07896a9/doc/tutorial/basic/tutorial.rst

This can go into our "Getting Started" or can be something linked from "Getting Started" page.

We should also link from our docs to the MOOC: https://inria.github.io/scikit-learn-mooc/

COMMENT:
I reopened because I don't think #30445 fixes this. Pointing to a 40 hour MOOC is not really a good resource for a beginner tutorial. Also the MOOC is trying to build up concepts slowly and sometimes you want a quicker "hit the ground running" kind of thing.

I did not remember but we have a [Getting started](https://scikit-learn.org/stable/getting_started.html) page which is maybe good enough for a beginner tutorial?

Part of me thinks the [old tutorials](https://scikit-learn.org/1.4/tutorial/) were actually fine and should be reinstated but the rest of me is not quite ready to fight this battle 😅.

Basically:
- [An introduction to machine learning with scikit-learn](https://scikit-learn.org/1.4/tutorial/basic/tutorial.html) is good 
- [A tutorial on statistical-learning for scientific data processing](https://scikit-learn.org/1.4/tutorial/statistical_inference/index.html) seems fine
- [Working With Text Data](https://scikit-learn.org/1.4/tutorial/text_analytics/working_with_text_data.html) can probably be removed and I think was the tutorial that was not tested.

Labels: Documentation, Moderate
DOC Beginners Tutorial

We need to have a section in our user guide introducing new users to a few concepts similar to what was present in our basics tutorial: https://github.com/scikit-learn/scikit-learn/blob/bc7e52ad7379fd8138418619a1cb0aeef07896a9/doc/tutorial/basic/tutorial.rst

This can go into our "Getting Started" or can be something linked from "Getting Started" page.

We should also link from our docs to the MOOC: https://inria.github.io/scikit-learn-mooc/

COMMENT:
I don't mind adding the ones which are relevant as an example or a user guide, but not as an untested tutorial.

Labels: Documentation, Moderate
Explain how predict_proba is computed from (Hist)GradientBoostingClassifier

### Describe the issue linked to the documentation

I think users would find it useful to see how class probabilities are computed for gradient boosting classifiers 😊 Tried to look into the source but could not understand it. Would be up to taking care of this, but I'd need a reference. Thank you!

### Suggest a potential alternative/fix

_No response_

COMMENT:
@lorentzenchr can probably give a better intuition here.

Labels: Documentation
Explain how predict_proba is computed from (Hist)GradientBoostingClassifier

### Describe the issue linked to the documentation

I think users would find it useful to see how class probabilities are computed for gradient boosting classifiers 😊 Tried to look into the source but could not understand it. Would be up to taking care of this, but I'd need a reference. Thank you!

### Suggest a potential alternative/fix

_No response_

COMMENT:
See [user guide](https://scikit-learn.org/stable/modules/ensemble.html#mathematical-formulation):
- For binary classification: $\mathrm{expit}(\sum_i tree_i(X))$ and $i=1...$ number of trees/iterations
- For multiclass class $k$: $\mathrm{softmax}(trees(X)) = \frac{\exp(\sum_i tree_i^k(X))}{\sum_c \exp(\sum_i tree_i^c(X))}$.

Labels: Documentation
Explain how predict_proba is computed from (Hist)GradientBoostingClassifier

### Describe the issue linked to the documentation

I think users would find it useful to see how class probabilities are computed for gradient boosting classifiers 😊 Tried to look into the source but could not understand it. Would be up to taking care of this, but I'd need a reference. Thank you!

### Suggest a potential alternative/fix

_No response_

COMMENT:
Will use the refs and open a PR later (hopefully today). Will tag @lorentzenchr too for review 😊

Labels: Documentation
Explain how predict_proba is computed from (Hist)GradientBoostingClassifier

### Describe the issue linked to the documentation

I think users would find it useful to see how class probabilities are computed for gradient boosting classifiers 😊 Tried to look into the source but could not understand it. Would be up to taking care of this, but I'd need a reference. Thank you!

### Suggest a potential alternative/fix

_No response_

COMMENT:
Hi @baggiponte,
Do you mind if I take up this issue? I have a local commit ready with the changes and I'd be happy to make a PR for this.

Labels: Documentation
Explain how predict_proba is computed from (Hist)GradientBoostingClassifier

### Describe the issue linked to the documentation

I think users would find it useful to see how class probabilities are computed for gradient boosting classifiers 😊 Tried to look into the source but could not understand it. Would be up to taking care of this, but I'd need a reference. Thank you!

### Suggest a potential alternative/fix

_No response_

COMMENT:
> Hi @baggiponte, Do you mind if I take up this issue? I have a local commit ready with the changes and I'd be happy to make a PR for this.

Ciao, please do! Sorry for taking so much time, but it's been a tough month.

Labels: Documentation
Slightly weird installation buttons maybe due to pydata-sphinx-theme 1.5.3?

### Describe the issue linked to the documentation

I recently browsed the dev website curious to see if I could spot differences after https://github.com/scikit-learn/scikit-learn/pull/29134 was merged.

Maybe it's just me, but I found that the install boxes where you select pip vs conda and potentially your OS is a bit confusing, the nesting of the two boxes looks visually complicated.
https://scikit-learn.org/dev/install.html#installing-the-latest-release
![image](https://github.com/scikit-learn/scikit-learn/assets/1680079/25735f3f-427b-45df-b526-09f2d34a9fc2)

Compare this to the stable website which I find a bit clearer maybe:
https://scikit-learn.org/stable/install.html#installing-the-latest-release
![image](https://github.com/scikit-learn/scikit-learn/assets/1680079/d585150b-919e-450b-940e-e44896fb5106)

Maybe @Charlie-XIAO you have some suggestions on how to improve it with some CSS magic?

### Suggest a potential alternative/fix

The PyTorch similar info for example seems a lot clearer to me than ours (both stable and dev website) https://pytorch.org/get-started/locally/#start-locally:
![image](https://github.com/scikit-learn/scikit-learn/assets/1680079/359c203f-8c94-42a7-a458-2f5298c48568)

The scikit-learn 1.4 seemed clearer as well:
https://scikit-learn.org/1.4/install.html#installing-the-latest-release
![image](https://github.com/scikit-learn/scikit-learn/assets/1680079/63339001-c402-43f4-8a84-a87b984ff325)

COMMENT:
This is what it looks like on the light theme for me. Which I think is fine and better than your dark mode screenshot (which I think is indeed confusing).

<img width="964" alt="Screenshot 2024-05-31 at 16 57 00" src="https://github.com/scikit-learn/scikit-learn/assets/1448859/a11d0437-4dcd-4364-b160-d2d06c6777d1">

The Pytorch one might be good, if we can figure out what to do about the fact that for conda there is no second level.

Labels: Documentation, Low Priority
Slightly weird installation buttons maybe due to pydata-sphinx-theme 1.5.3?

### Describe the issue linked to the documentation

I recently browsed the dev website curious to see if I could spot differences after https://github.com/scikit-learn/scikit-learn/pull/29134 was merged.

Maybe it's just me, but I found that the install boxes where you select pip vs conda and potentially your OS is a bit confusing, the nesting of the two boxes looks visually complicated.
https://scikit-learn.org/dev/install.html#installing-the-latest-release
![image](https://github.com/scikit-learn/scikit-learn/assets/1680079/25735f3f-427b-45df-b526-09f2d34a9fc2)

Compare this to the stable website which I find a bit clearer maybe:
https://scikit-learn.org/stable/install.html#installing-the-latest-release
![image](https://github.com/scikit-learn/scikit-learn/assets/1680079/d585150b-919e-450b-940e-e44896fb5106)

Maybe @Charlie-XIAO you have some suggestions on how to improve it with some CSS magic?

### Suggest a potential alternative/fix

The PyTorch similar info for example seems a lot clearer to me than ours (both stable and dev website) https://pytorch.org/get-started/locally/#start-locally:
![image](https://github.com/scikit-learn/scikit-learn/assets/1680079/359c203f-8c94-42a7-a458-2f5298c48568)

The scikit-learn 1.4 seemed clearer as well:
https://scikit-learn.org/1.4/install.html#installing-the-latest-release
![image](https://github.com/scikit-learn/scikit-learn/assets/1680079/63339001-c402-43f4-8a84-a87b984ff325)

COMMENT:
I was surprised seeing @lesteve comment because I found it much better when I checked before to merge:

<img width="970" alt="image" src="https://github.com/scikit-learn/scikit-learn/assets/7454015/60e9b365-db16-45e8-97ef-2b56cf23ca4f">

But apparently, "on my computer" I have this extra vertical light blue line that @lesteve does not have. I don't really understand why do we have different rendering :)

Labels: Documentation, Low Priority
Slightly weird installation buttons maybe due to pydata-sphinx-theme 1.5.3?

### Describe the issue linked to the documentation

I recently browsed the dev website curious to see if I could spot differences after https://github.com/scikit-learn/scikit-learn/pull/29134 was merged.

Maybe it's just me, but I found that the install boxes where you select pip vs conda and potentially your OS is a bit confusing, the nesting of the two boxes looks visually complicated.
https://scikit-learn.org/dev/install.html#installing-the-latest-release
![image](https://github.com/scikit-learn/scikit-learn/assets/1680079/25735f3f-427b-45df-b526-09f2d34a9fc2)

Compare this to the stable website which I find a bit clearer maybe:
https://scikit-learn.org/stable/install.html#installing-the-latest-release
![image](https://github.com/scikit-learn/scikit-learn/assets/1680079/d585150b-919e-450b-940e-e44896fb5106)

Maybe @Charlie-XIAO you have some suggestions on how to improve it with some CSS magic?

### Suggest a potential alternative/fix

The PyTorch similar info for example seems a lot clearer to me than ours (both stable and dev website) https://pytorch.org/get-started/locally/#start-locally:
![image](https://github.com/scikit-learn/scikit-learn/assets/1680079/359c203f-8c94-42a7-a458-2f5298c48568)

The scikit-learn 1.4 seemed clearer as well:
https://scikit-learn.org/1.4/install.html#installing-the-latest-release
![image](https://github.com/scikit-learn/scikit-learn/assets/1680079/63339001-c402-43f4-8a84-a87b984ff325)

COMMENT:
They were due to https://github.com/pydata/pydata-sphinx-theme/pull/1555, which are considered improvements regarding accessibility.

- `pytorch` version: I know how to achieve this but then we need to write JS and raw HTML instead of relying on `sphinx-design` and simply write reStructuredText.

- 0.15.2 version: Should be easy - I just need to revert the new styling by `pydata-sphinx-theme`.

Another option is to make some customization based on 0.15.3, then I would need to understand more clearly why people find the new version weird. Would it be sufficient if I make non-active tabs have distinguishable backgrounds as they do in the light theme?

Labels: Documentation, Low Priority
Slightly weird installation buttons maybe due to pydata-sphinx-theme 1.5.3?

### Describe the issue linked to the documentation

I recently browsed the dev website curious to see if I could spot differences after https://github.com/scikit-learn/scikit-learn/pull/29134 was merged.

Maybe it's just me, but I found that the install boxes where you select pip vs conda and potentially your OS is a bit confusing, the nesting of the two boxes looks visually complicated.
https://scikit-learn.org/dev/install.html#installing-the-latest-release
![image](https://github.com/scikit-learn/scikit-learn/assets/1680079/25735f3f-427b-45df-b526-09f2d34a9fc2)

Compare this to the stable website which I find a bit clearer maybe:
https://scikit-learn.org/stable/install.html#installing-the-latest-release
![image](https://github.com/scikit-learn/scikit-learn/assets/1680079/d585150b-919e-450b-940e-e44896fb5106)

Maybe @Charlie-XIAO you have some suggestions on how to improve it with some CSS magic?

### Suggest a potential alternative/fix

The PyTorch similar info for example seems a lot clearer to me than ours (both stable and dev website) https://pytorch.org/get-started/locally/#start-locally:
![image](https://github.com/scikit-learn/scikit-learn/assets/1680079/359c203f-8c94-42a7-a458-2f5298c48568)

The scikit-learn 1.4 seemed clearer as well:
https://scikit-learn.org/1.4/install.html#installing-the-latest-release
![image](https://github.com/scikit-learn/scikit-learn/assets/1680079/63339001-c402-43f4-8a84-a87b984ff325)

COMMENT:
I put a "Low Priority" label, so no need to rush :wink:. Maybe it is just me as well that is bothered by this, in which case this may be good enough and we can focus on more important things.

Thinking about it, what I find confusing is the implementation as a nested table. I don't think of it as a nested table but as independent buttons I can click with at the end the command I can copy and paste to install scikit-learn.

Also I think having the OS first and then afterwards pip / conda makes more sense to me. There is the main question (OS) and then the more subtle variation (conda vs pip). I am guessing, the order was reversed compared to 1.4.2 in part because I because this is implemented as a nested table  (but maybe I am wrong) and also because for conda this is the same thing for all the OSes.

In the light theme, the shade of light blue vs white helps a bit but still I don't find it great. Same thing for the additional horizontal line in @glemaitre's screenshot.

I get the argument about pure rst which is more maintainable than js + HTML. Maybe one compromise would be some CSS magic to make tabs to appear more like individual buttons and remove the lines around the table. Sorry I know only how to do the latter so here is a screenshot if that helps:
![image](https://github.com/scikit-learn/scikit-learn/assets/1680079/3539d267-ddf5-43fb-9335-4de37bfd6194)

Then there is the question whether rst + CSS magic is more maintainable than js + HTML, maybe not ... and I still prefer OS before conda/pip ...

Labels: Documentation, Low Priority