Talip7/scikit-learn-issues-multilabel huggingface dataset:
32-Bit Raspberry Pi OS Installation Issues with UV

### Describe the bug

When attempting to install scikit-learn==1.4.2 - 1.6.1 on Raspberry Pi OS Lite 32-Bit (Bookworm) or Raspberry Pi OS Lit 32-Bit (Bullseye) with UV, the following error is given:
```
  × Failed to download and build `scikit-learn==1.4.2`
  ├─▶ Failed to resolve requirements from `build-system.requires`
  ├─▶ No solution found when resolving: `setuptools`, `wheel`, `cython>=3.0.8`, `numpy==2.0.0rc1`, `scipy>=1.6.0`
  ╰─▶ Because there is no version of numpy==2.0.0rc1 and you require numpy==2.0.0rc1, we can conclude that your
      requirements are unsatisfiable.
```

If I had to guess, it's that the numpy==2.0.0rc1 is the issue, but I'm not sure.  

Bullseye is also on Python 3.9 so the last version we can install is v1.6.1.  



### Steps/Code to Reproduce

```bash
# 1. Install UV
# 2. Create Virtual Environment
uv venv --system-site-packages test 
# 3. Start venv
source test/bin/activate
# 4. Install scikit-learn
uv pip install scikit-learn==1.6.1
```

### Expected Results

Expect that it should install correctly without errors. 

### Actual Results

```
  × Failed to download and build `scikit-learn==1.4.2`
  ├─▶ Failed to resolve requirements from `build-system.requires`
  ├─▶ No solution found when resolving: `setuptools`, `wheel`, `cython>=3.0.8`, `numpy==2.0.0rc1`, `scipy>=1.6.0`
  ╰─▶ Because there is no version of numpy==2.0.0rc1 and you require numpy==2.0.0rc1, we can conclude that your
      requirements are unsatisfiable.
```

### Versions

```shell
1.4.2
1.6.0
1.6.1
```

COMMENT:
32bit wheels haven't been uploaded for a while on PyPI for numpy (see mailing-list [thread](https://mail.python.org/archives/list/numpy-discussion@python.org/thread/6B3VJZ3I5JV4PFJUSRPTN4ABZE7UPAEI/#3O37HETOD637FIH5FWR53QP3ROWHAXHE) from October 2021) so `pip install scikit-learn` will need to build numpy, scipy and scikit-learn from source.

A mixed approach could be to install numpy and scipy with `apt-get` and hope that they are recent enough for installing the version of scikit-learn you want/need.

You would need to create a venv with `--system-site-packages` (as you are already doing from your snippet). `pip install scikit-learn --no-build-isolation` would then reuse the system numpy and scipy and only try to build scikit-learn from source.

Labels: Bug, Needs Investigation
32-Bit Raspberry Pi OS Installation Issues with UV

### Describe the bug

When attempting to install scikit-learn==1.4.2 - 1.6.1 on Raspberry Pi OS Lite 32-Bit (Bookworm) or Raspberry Pi OS Lit 32-Bit (Bullseye) with UV, the following error is given:
```
  × Failed to download and build `scikit-learn==1.4.2`
  ├─▶ Failed to resolve requirements from `build-system.requires`
  ├─▶ No solution found when resolving: `setuptools`, `wheel`, `cython>=3.0.8`, `numpy==2.0.0rc1`, `scipy>=1.6.0`
  ╰─▶ Because there is no version of numpy==2.0.0rc1 and you require numpy==2.0.0rc1, we can conclude that your
      requirements are unsatisfiable.
```

If I had to guess, it's that the numpy==2.0.0rc1 is the issue, but I'm not sure.  

Bullseye is also on Python 3.9 so the last version we can install is v1.6.1.  



### Steps/Code to Reproduce

```bash
# 1. Install UV
# 2. Create Virtual Environment
uv venv --system-site-packages test 
# 3. Start venv
source test/bin/activate
# 4. Install scikit-learn
uv pip install scikit-learn==1.6.1
```

### Expected Results

Expect that it should install correctly without errors. 

### Actual Results

```
  × Failed to download and build `scikit-learn==1.4.2`
  ├─▶ Failed to resolve requirements from `build-system.requires`
  ├─▶ No solution found when resolving: `setuptools`, `wheel`, `cython>=3.0.8`, `numpy==2.0.0rc1`, `scipy>=1.6.0`
  ╰─▶ Because there is no version of numpy==2.0.0rc1 and you require numpy==2.0.0rc1, we can conclude that your
      requirements are unsatisfiable.
```

### Versions

```shell
1.4.2
1.6.0
1.6.1
```

COMMENT:
Thank you!  You have gone above and beyond.  The --system-site-packages doesn't seem to do the trick on it's own, but I will give the --no-build-isolation a shot and see if that helps.

Labels: Bug, Needs Investigation
Add free-threading wheel for Linux arm64 (aarch64)

### Describe the workflow you want to enable

I am a maintainer for the third-party package [fastcan](https://github.com/scikit-learn-contrib/fastcan). I tested the package on the free-threading Python (cp313t), and found scikit-learn missing a wheel for Linux arm64 (aarch64) on PyPI.

I would like to have the official release wheel rather than building it from source.

### Describe your proposed solution

I tested scikit-learn on my own fork, and the free-threading wheel for Linux arm64 (scikit_learn-1.8.dev0-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl) can be successfully built. So I suppose that wheel is just mistakenly missed.

Just add that wheel in wheel.yml should be fine.

### Describe alternatives you've considered, if relevant

_No response_

### Additional context

_No response_

COMMENT:
numpy and scipy have a Linux arm64 free-threaded wheel so I guess it would make sense to have one for scikit-learn as well.

Labels: New Feature
Doc website incorrectly flags stable as unstable

### Describe the bug

Current website gives:
![Image](https://github.com/user-attachments/assets/78ec363e-92cf-4a3f-afc5-68639078d9b3)

I tried having a look on how to fix this, but went in a rabbit hole that the version switcher is generated by "list_versions.py" in the circle-ci scripts and this exceeded the time that I have. IMHO, such automation is over-engineered and does not make things more reliable, as we are seeing currently

### Steps/Code to Reproduce

Go to https://scikit-learn.org/stable/

### Expected Results

Not having the banner on top

### Actual Results

The banner of the top of the website displays

### Versions

```shell
stable
```

COMMENT:
It looks like bad timing on our side sending the mail for the release: there is an extra CD on the repository of the documentation that needed a couple of more minutes to update the website.

The process is finished and the banner disappeared for 1.7 so everything should be fine.

Labels: Bug, Needs Triage
Add option to return final cross-validation score in SequentialFeatureSelector

### Describe the workflow you want to enable

Currently, when using `SequentialFeatureSelector`, it internally performs cross-validation to decide which features to select, based on the scoring function. However, the final cross-validation score (e.g., recall) is not returned by the SFS object.



### Describe your proposed solution

Add an attribute (e.g., `final_cv_score_`) that stores the mean cross-validation score of the final model with the selected features. This would avoid having to run another cross-validation externally to get the final performance score.

### Describe alternatives you've considered, if relevant

_No response_

### Additional context

This feature would be especially useful when the scoring metric is expensive to compute, as it would avoid redundant cross-validation runs.

COMMENT:
Hey i gotch you, You need to calculate the final_cv_score_ in the SequentialFeatureSelector, so do you want the cv score for each epoch of the model or you need an entire cv score

Case 1) If you want and final_cv_score__ for each epoch you need to modify the scklearn code and add the accuracy field in it.

Case 2) If you want overall fianl_cv_score_ for entire model then use the accuracy_Score form the sklearn.metrics 
You can get the predicted metrics from the method **get_support** the you can calulate the fianl_cv_score_


If you want modified SequentialFeatureSelector code with the field final_cv_score_ please check my github.

Labels: New Feature
Add option to return final cross-validation score in SequentialFeatureSelector

### Describe the workflow you want to enable

Currently, when using `SequentialFeatureSelector`, it internally performs cross-validation to decide which features to select, based on the scoring function. However, the final cross-validation score (e.g., recall) is not returned by the SFS object.



### Describe your proposed solution

Add an attribute (e.g., `final_cv_score_`) that stores the mean cross-validation score of the final model with the selected features. This would avoid having to run another cross-validation externally to get the final performance score.

### Describe alternatives you've considered, if relevant

_No response_

### Additional context

This feature would be especially useful when the scoring metric is expensive to compute, as it would avoid redundant cross-validation runs.

COMMENT:
I think this sounds like a reasonable feature to add.

I tried to look around existing estimators to see what name is used for the fitted parameter. In `TunedThresholdClassifier` and `GridSearchCV` it is called `best_score_`. On the one hand it would be nice to have something consistent, on the other hand maybe here it isn't really a "best score"? Maybe something to address in a discussion in a PR.

Labels: New Feature
Feat: DummyClassifier strategy that produces randomized probabilities

### Describe the workflow you want to enable

# Motivation

The `dummy` module is fantastic for testing pipelines all the way up through enterprise scales. The [strategies](https://github.com/scikit-learn/scikit-learn/blob/98ed9dc73/sklearn/dummy.py#L374) offered in the `DummyClassifier` are excellent for testing corner cases. However, the strategies offered fall short when testing pipelines that include downstream tasks that depend on moments of the predicted probabilities (e.g. gains charts).

This is because the existing strategies do not include sampling _random probabilities_.

## Proposed API:

Consider adding a new strategy with a name like `uniform-proba` or `score-random` or something similar that results in this behavior for binary classification:

```python
print(DummyClassifier(strategy="uniform-proba").fit(X, y).predict_proba(X))
"""
[[0.5651713  0.4348287 ]
 [0.36557341 0.63442659]
 [0.42386353 0.57613647]
 ...
 [0.30348692 0.69651308]
 [0.59589879 0.40410121]
 [0.32664176 0.67335824]]
"""
```

### Describe your proposed solution

## Proposed implementation

I had something like this in mind:
```python
class DummyClassifier(MultiOutputMixin, ClassifierMixin, BaseEstimator):
    ...

    def predict_proba(self, X):
        ...
        for k in range(self.n_outputs_):
            if self._strategy == "uniform-proba":
                out = rs.dirichlet([1] * n_classes_[k], size=n_samples)
                out = out.astype(np.float64)
            ...
```

Similar to the `"stratified"` strategy, this simple implementation relies on `numpy.random`, in this case the [`dirichlet`](https://numpy.org/doc/2.0/reference/random/generated/numpy.random.RandomState.dirichlet.html) distribution. By setting all the `alpha`s to 1, we are specifying that the probabilities of each class are equally distributed -- in contrast, the `"stratified"` strategy effectively samples from a dirichlet distribution with one alpha equal to 1 and the rest equal to 0.


### Describe alternatives you've considered, if relevant

_No response_

### Additional context

I am happy to make the PR. The biggest question is what the strategy string should be.

Thank you for reading 🙏.

COMMENT:
I think this could be useful. What to call the strategy and which strategy to use.

Labels: New Feature, Needs Decision - Include Feature
Feat: DummyClassifier strategy that produces randomized probabilities

### Describe the workflow you want to enable

# Motivation

The `dummy` module is fantastic for testing pipelines all the way up through enterprise scales. The [strategies](https://github.com/scikit-learn/scikit-learn/blob/98ed9dc73/sklearn/dummy.py#L374) offered in the `DummyClassifier` are excellent for testing corner cases. However, the strategies offered fall short when testing pipelines that include downstream tasks that depend on moments of the predicted probabilities (e.g. gains charts).

This is because the existing strategies do not include sampling _random probabilities_.

## Proposed API:

Consider adding a new strategy with a name like `uniform-proba` or `score-random` or something similar that results in this behavior for binary classification:

```python
print(DummyClassifier(strategy="uniform-proba").fit(X, y).predict_proba(X))
"""
[[0.5651713  0.4348287 ]
 [0.36557341 0.63442659]
 [0.42386353 0.57613647]
 ...
 [0.30348692 0.69651308]
 [0.59589879 0.40410121]
 [0.32664176 0.67335824]]
"""
```

### Describe your proposed solution

## Proposed implementation

I had something like this in mind:
```python
class DummyClassifier(MultiOutputMixin, ClassifierMixin, BaseEstimator):
    ...

    def predict_proba(self, X):
        ...
        for k in range(self.n_outputs_):
            if self._strategy == "uniform-proba":
                out = rs.dirichlet([1] * n_classes_[k], size=n_samples)
                out = out.astype(np.float64)
            ...
```

Similar to the `"stratified"` strategy, this simple implementation relies on `numpy.random`, in this case the [`dirichlet`](https://numpy.org/doc/2.0/reference/random/generated/numpy.random.RandomState.dirichlet.html) distribution. By setting all the `alpha`s to 1, we are specifying that the probabilities of each class are equally distributed -- in contrast, the `"stratified"` strategy effectively samples from a dirichlet distribution with one alpha equal to 1 and the rest equal to 0.


### Describe alternatives you've considered, if relevant

_No response_

### Additional context

I am happy to make the PR. The biggest question is what the strategy string should be.

Thank you for reading 🙏.

COMMENT:
Thanks, @betatim. Do you recommend I create a PR or wait for more discussion?

Labels: New Feature, Needs Decision - Include Feature
Feat: DummyClassifier strategy that produces randomized probabilities

### Describe the workflow you want to enable

# Motivation

The `dummy` module is fantastic for testing pipelines all the way up through enterprise scales. The [strategies](https://github.com/scikit-learn/scikit-learn/blob/98ed9dc73/sklearn/dummy.py#L374) offered in the `DummyClassifier` are excellent for testing corner cases. However, the strategies offered fall short when testing pipelines that include downstream tasks that depend on moments of the predicted probabilities (e.g. gains charts).

This is because the existing strategies do not include sampling _random probabilities_.

## Proposed API:

Consider adding a new strategy with a name like `uniform-proba` or `score-random` or something similar that results in this behavior for binary classification:

```python
print(DummyClassifier(strategy="uniform-proba").fit(X, y).predict_proba(X))
"""
[[0.5651713  0.4348287 ]
 [0.36557341 0.63442659]
 [0.42386353 0.57613647]
 ...
 [0.30348692 0.69651308]
 [0.59589879 0.40410121]
 [0.32664176 0.67335824]]
"""
```

### Describe your proposed solution

## Proposed implementation

I had something like this in mind:
```python
class DummyClassifier(MultiOutputMixin, ClassifierMixin, BaseEstimator):
    ...

    def predict_proba(self, X):
        ...
        for k in range(self.n_outputs_):
            if self._strategy == "uniform-proba":
                out = rs.dirichlet([1] * n_classes_[k], size=n_samples)
                out = out.astype(np.float64)
            ...
```

Similar to the `"stratified"` strategy, this simple implementation relies on `numpy.random`, in this case the [`dirichlet`](https://numpy.org/doc/2.0/reference/random/generated/numpy.random.RandomState.dirichlet.html) distribution. By setting all the `alpha`s to 1, we are specifying that the probabilities of each class are equally distributed -- in contrast, the `"stratified"` strategy effectively samples from a dirichlet distribution with one alpha equal to 1 and the rest equal to 0.


### Describe alternatives you've considered, if relevant

_No response_

### Additional context

I am happy to make the PR. The biggest question is what the strategy string should be.

Thank you for reading 🙏.

COMMENT:
To be honest, I don't know. If you are ok investing a bit of time to make a PR that would be good, though it could be wasted if people don't like the idea.

@ogrisel do you have an opinion on this or know who we could ask?

Labels: New Feature, Needs Decision - Include Feature
Feat: DummyClassifier strategy that produces randomized probabilities

### Describe the workflow you want to enable

# Motivation

The `dummy` module is fantastic for testing pipelines all the way up through enterprise scales. The [strategies](https://github.com/scikit-learn/scikit-learn/blob/98ed9dc73/sklearn/dummy.py#L374) offered in the `DummyClassifier` are excellent for testing corner cases. However, the strategies offered fall short when testing pipelines that include downstream tasks that depend on moments of the predicted probabilities (e.g. gains charts).

This is because the existing strategies do not include sampling _random probabilities_.

## Proposed API:

Consider adding a new strategy with a name like `uniform-proba` or `score-random` or something similar that results in this behavior for binary classification:

```python
print(DummyClassifier(strategy="uniform-proba").fit(X, y).predict_proba(X))
"""
[[0.5651713  0.4348287 ]
 [0.36557341 0.63442659]
 [0.42386353 0.57613647]
 ...
 [0.30348692 0.69651308]
 [0.59589879 0.40410121]
 [0.32664176 0.67335824]]
"""
```

### Describe your proposed solution

## Proposed implementation

I had something like this in mind:
```python
class DummyClassifier(MultiOutputMixin, ClassifierMixin, BaseEstimator):
    ...

    def predict_proba(self, X):
        ...
        for k in range(self.n_outputs_):
            if self._strategy == "uniform-proba":
                out = rs.dirichlet([1] * n_classes_[k], size=n_samples)
                out = out.astype(np.float64)
            ...
```

Similar to the `"stratified"` strategy, this simple implementation relies on `numpy.random`, in this case the [`dirichlet`](https://numpy.org/doc/2.0/reference/random/generated/numpy.random.RandomState.dirichlet.html) distribution. By setting all the `alpha`s to 1, we are specifying that the probabilities of each class are equally distributed -- in contrast, the `"stratified"` strategy effectively samples from a dirichlet distribution with one alpha equal to 1 and the rest equal to 0.


### Describe alternatives you've considered, if relevant

_No response_

### Additional context

I am happy to make the PR. The biggest question is what the strategy string should be.

Thank you for reading 🙏.

COMMENT:
Looks like the author of #31488 eagerly knocked this out! We just need an approving reviewer.

Labels: New Feature, Needs Decision - Include Feature
Feat: DummyClassifier strategy that produces randomized probabilities

### Describe the workflow you want to enable

# Motivation

The `dummy` module is fantastic for testing pipelines all the way up through enterprise scales. The [strategies](https://github.com/scikit-learn/scikit-learn/blob/98ed9dc73/sklearn/dummy.py#L374) offered in the `DummyClassifier` are excellent for testing corner cases. However, the strategies offered fall short when testing pipelines that include downstream tasks that depend on moments of the predicted probabilities (e.g. gains charts).

This is because the existing strategies do not include sampling _random probabilities_.

## Proposed API:

Consider adding a new strategy with a name like `uniform-proba` or `score-random` or something similar that results in this behavior for binary classification:

```python
print(DummyClassifier(strategy="uniform-proba").fit(X, y).predict_proba(X))
"""
[[0.5651713  0.4348287 ]
 [0.36557341 0.63442659]
 [0.42386353 0.57613647]
 ...
 [0.30348692 0.69651308]
 [0.59589879 0.40410121]
 [0.32664176 0.67335824]]
"""
```

### Describe your proposed solution

## Proposed implementation

I had something like this in mind:
```python
class DummyClassifier(MultiOutputMixin, ClassifierMixin, BaseEstimator):
    ...

    def predict_proba(self, X):
        ...
        for k in range(self.n_outputs_):
            if self._strategy == "uniform-proba":
                out = rs.dirichlet([1] * n_classes_[k], size=n_samples)
                out = out.astype(np.float64)
            ...
```

Similar to the `"stratified"` strategy, this simple implementation relies on `numpy.random`, in this case the [`dirichlet`](https://numpy.org/doc/2.0/reference/random/generated/numpy.random.RandomState.dirichlet.html) distribution. By setting all the `alpha`s to 1, we are specifying that the probabilities of each class are equally distributed -- in contrast, the `"stratified"` strategy effectively samples from a dirichlet distribution with one alpha equal to 1 and the rest equal to 0.


### Describe alternatives you've considered, if relevant

_No response_

### Additional context

I am happy to make the PR. The biggest question is what the strategy string should be.

Thank you for reading 🙏.

COMMENT:
It will always give a ROC AUC score of around 0.5. The most useful application of `DummyClassifier` is for model selection and comparisons. Wouldn't the `uniform-proba` strategy be a bit redundant in this case?

Labels: New Feature, Needs Decision - Include Feature
Feat: DummyClassifier strategy that produces randomized probabilities

### Describe the workflow you want to enable

# Motivation

The `dummy` module is fantastic for testing pipelines all the way up through enterprise scales. The [strategies](https://github.com/scikit-learn/scikit-learn/blob/98ed9dc73/sklearn/dummy.py#L374) offered in the `DummyClassifier` are excellent for testing corner cases. However, the strategies offered fall short when testing pipelines that include downstream tasks that depend on moments of the predicted probabilities (e.g. gains charts).

This is because the existing strategies do not include sampling _random probabilities_.

## Proposed API:

Consider adding a new strategy with a name like `uniform-proba` or `score-random` or something similar that results in this behavior for binary classification:

```python
print(DummyClassifier(strategy="uniform-proba").fit(X, y).predict_proba(X))
"""
[[0.5651713  0.4348287 ]
 [0.36557341 0.63442659]
 [0.42386353 0.57613647]
 ...
 [0.30348692 0.69651308]
 [0.59589879 0.40410121]
 [0.32664176 0.67335824]]
"""
```

### Describe your proposed solution

## Proposed implementation

I had something like this in mind:
```python
class DummyClassifier(MultiOutputMixin, ClassifierMixin, BaseEstimator):
    ...

    def predict_proba(self, X):
        ...
        for k in range(self.n_outputs_):
            if self._strategy == "uniform-proba":
                out = rs.dirichlet([1] * n_classes_[k], size=n_samples)
                out = out.astype(np.float64)
            ...
```

Similar to the `"stratified"` strategy, this simple implementation relies on `numpy.random`, in this case the [`dirichlet`](https://numpy.org/doc/2.0/reference/random/generated/numpy.random.RandomState.dirichlet.html) distribution. By setting all the `alpha`s to 1, we are specifying that the probabilities of each class are equally distributed -- in contrast, the `"stratified"` strategy effectively samples from a dirichlet distribution with one alpha equal to 1 and the rest equal to 0.


### Describe alternatives you've considered, if relevant

_No response_

### Additional context

I am happy to make the PR. The biggest question is what the strategy string should be.

Thank you for reading 🙏.

COMMENT:
@glevv good question -- please see my original post for an example. Some performance metrics such as a gains chart depends on there being high entropy in the predicted probabilities. The `uniform` is not high entropy enough to test these.

Labels: New Feature, Needs Decision - Include Feature