Talip7/scikit-learn-issues-multilabel huggingface dataset:
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:
Hey again @glevv @betatim @ogrisel. I hope your summers/winters are going well. I'm interested to hear your thoughts on the feature or my justification above. Thank you!

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:
One thing I've been wondering is if this even needs to be a new strategy or if we can improve the uniform strategy by adding this behaviour? 

---

Lack of responses doesn't mean that people aren't interested or that this won't land. It is more likely that it this is interesting but too complex to get a quick decision and hence is on the "to do" list (which is infinitely long). It is a bit unsatisfying but I don't know a great solution to the problem :-/

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:
I am not sure if we need this. I don't think we have any estimator implemented scikit-learn  that has a `predict_proba` method that outputs non-deterministic values for a given `X_test` once fit is done on a particular `X_train, y_train` and a given value of `random_state` passed to the constructor. 

So I don't see the need for `DummyClassifier` to implement such a weird behavior that does not exist in any real concrete scikit-learn estimator.

I don't even know how to interpret what `predict_proba` output would represent in that 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:
The only case thing I have in mind is test-time random data augmentation or dropout in neural networks (+ averaging). This but this is not something implemented in scikit-learn (so far).

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:
Note, I acknowledge those problems are already present with the existing `DummyClassifier(strategy="uniform")`, but I am reluctant in expanding an existing problem.

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:
There is also so called [Golden Ratio Sequence/Noise](https://bartwronski.com/2016/10/30/dithering-part-two-golden-ratio-sequence-blue-noise-and-highpass-and-remap/) which is deterministic and has uniform distribution [0, 1]. It is also pretty simple to implement:
`np.modf(np.arange(len(X)*golden_ratio)[0]`,
where `golden_ratio` is `(1.0 + math.sqrt(5)) / 2`

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:
But if you shuffle the rows of `X_test` that will not result in the matching permutation of the predictions.

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:
Yes, this type of noise will be completely independent from the values of X, so I guess in this sense it is not a good option.

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:
For the use case described in https://github.com/scikit-learn/scikit-learn/issues/31462#issuecomment-2988860644, each row of `X_test` should have a different proba for the positive class (otherwise all the data points have the same risk level), so `DummyClassifier(strategy="prior")` is not suitable despite the fact that the proba of the positive class can be different from the proba of the negative class.

Labels: New Feature, Needs Decision - Include Feature
Spherical K-means support (unit norm centroids and input)

### Describe the workflow you want to enable

Hi,
I was wondering if there is—or has been—any initiative to support cosine similarity in the KMeans implementation (i.e., spherical KMeans). I find the algorithm quite useful and would be happy to propose an implementation. The addition should be relatively straightforward.

### Describe your proposed solution

Enable the use of cosine similarity with KMeans or implement a separate SphericalKMeans class.

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

_No response_

### Additional context

_No response_

COMMENT:
Hey I'd like to take up this @Radu1999

Labels: New Feature, Needs Decision - Include Feature