Talip7/scikit-learn-issues-multilabel huggingface dataset:
Example change produces warnings in documentation

### Describe the issue linked to the documentation

The tutorial about [Unsupervised learning](https://scikit-learn.org/dev/tutorial/statistical_inference/unsupervised_learning.html) in the development version is missing images from the K-means clustering example. This is not the case for the stable version.
The changes in https://github.com/scikit-learn/scikit-learn/pull/24692 join all the plots in one figure.

### Suggest a potential alternative/fix

We already had a similar issue in the past, https://github.com/scikit-learn/scikit-learn/issues/22061, and it was decided to regenerate the images.
My opinion is that getting rid of the links to the missing images should be enough in this case.

COMMENT:
I will take this issue since we need to rework the documentation to avoid redundant example.

Labels: Documentation
Graph metaestimators with a builder API

### Describe the workflow you want to enable

I recently added a new project to scikit-learn-contrib called [skdag](https://github.com/scikit-learn-contrib/skdag) , which allows the construction of workflows as DAGs (directed acyclic graphs), wrapped up in the interface of a metaestimator.

I wanted to allow the project more time to see how it gets adopted before suggesting to include it as a new type of metaestimator in sklearn. However I saw that you already had a similar proposition in #16301 so wanted to make you aware that an actual implementation exists that may provide a useful starting point for you.

If there is an interest now or in the future, I'd be happy to help merge or adapt skdag code to fit in with your plans for sklearn.

### Describe your proposed solution

Skdag implements DAGs with a metaestimator interface. This provides a single utility that acts as a drop-in replacement for pipelines, column transformers, feature unions and stacking estimators. It also allows more complex workflows and visualisations of the workflows.

See the project documentation for more details: https://skdag.readthedocs.io/

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

_No response_

### Additional context

_No response_

COMMENT:
@amueller this may be relevant for you given references to your interest in DAGs.

Labels: New Feature
Graph metaestimators with a builder API

### Describe the workflow you want to enable

I recently added a new project to scikit-learn-contrib called [skdag](https://github.com/scikit-learn-contrib/skdag) , which allows the construction of workflows as DAGs (directed acyclic graphs), wrapped up in the interface of a metaestimator.

I wanted to allow the project more time to see how it gets adopted before suggesting to include it as a new type of metaestimator in sklearn. However I saw that you already had a similar proposition in #16301 so wanted to make you aware that an actual implementation exists that may provide a useful starting point for you.

If there is an interest now or in the future, I'd be happy to help merge or adapt skdag code to fit in with your plans for sklearn.

### Describe your proposed solution

Skdag implements DAGs with a metaestimator interface. This provides a single utility that acts as a drop-in replacement for pipelines, column transformers, feature unions and stacking estimators. It also allows more complex workflows and visualisations of the workflows.

See the project documentation for more details: https://skdag.readthedocs.io/

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

_No response_

### Additional context

_No response_

COMMENT:
Thanks for letting know about this. It's indeed an extension of @jnothman's proposal in #16301.

I personally think that scikit-learn would benefit from such a builder API for metaestimators such as `ColumnTransformer` and `Pipeline`).

However I am not sure how I feel about the readability of the named dependencies but it's nice to have a working proof of concept.

Labels: New Feature
Graph metaestimators with a builder API

### Describe the workflow you want to enable

I recently added a new project to scikit-learn-contrib called [skdag](https://github.com/scikit-learn-contrib/skdag) , which allows the construction of workflows as DAGs (directed acyclic graphs), wrapped up in the interface of a metaestimator.

I wanted to allow the project more time to see how it gets adopted before suggesting to include it as a new type of metaestimator in sklearn. However I saw that you already had a similar proposition in #16301 so wanted to make you aware that an actual implementation exists that may provide a useful starting point for you.

If there is an interest now or in the future, I'd be happy to help merge or adapt skdag code to fit in with your plans for sklearn.

### Describe your proposed solution

Skdag implements DAGs with a metaestimator interface. This provides a single utility that acts as a drop-in replacement for pipelines, column transformers, feature unions and stacking estimators. It also allows more complex workflows and visualisations of the workflows.

See the project documentation for more details: https://skdag.readthedocs.io/

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

_No response_

### Additional context

_No response_

COMMENT:
I like this a lot, though I think it would take a little getting used to for newcomers to DAGSs. I see it as a bit different to what I proposed, including the unification of ColumnTransformer and Pipeline, and the explicit factory pattern with `make_dag`. I had not intended to introduce new estimators.

Labels: New Feature
Graph metaestimators with a builder API

### Describe the workflow you want to enable

I recently added a new project to scikit-learn-contrib called [skdag](https://github.com/scikit-learn-contrib/skdag) , which allows the construction of workflows as DAGs (directed acyclic graphs), wrapped up in the interface of a metaestimator.

I wanted to allow the project more time to see how it gets adopted before suggesting to include it as a new type of metaestimator in sklearn. However I saw that you already had a similar proposition in #16301 so wanted to make you aware that an actual implementation exists that may provide a useful starting point for you.

If there is an interest now or in the future, I'd be happy to help merge or adapt skdag code to fit in with your plans for sklearn.

### Describe your proposed solution

Skdag implements DAGs with a metaestimator interface. This provides a single utility that acts as a drop-in replacement for pipelines, column transformers, feature unions and stacking estimators. It also allows more complex workflows and visualisations of the workflows.

See the project documentation for more details: https://skdag.readthedocs.io/

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

_No response_

### Additional context

_No response_

COMMENT:
Thanks for the feedback all. I'm not a fan of exposing the factory mechanics myself but this is an early version and I wanted to just get something out there that works and proves the concept reasonably well. I hope to remove the need for creating a separate factory method in the future so users can focus on nothing more than defining their workflows.

Labels: New Feature
error message improvement

### Describe the workflow you want to enable

Hi, 

I think that this error message is misleading
https://github.com/scikit-learn/scikit-learn/blob/02ebf9e68fe1fc7687d9e1047b9e465ae0fd945e/sklearn/model_selection/_search_successive_halving.py#L186

I am basically following the example here
https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.HalvingGridSearchCV.html#sklearn.model_selection.HalvingGridSearchCV

so I have the same `resource` 

from that message, it seems that the problem is `max_resources`, while it is actually `resource`

what do you think? 

### Describe your proposed solution

you could for instance swap them:

                    " resource can only  be 'n_samples'  if max_resources='auto'"


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

_No response_

### Additional context

_No response_

COMMENT:
Hi @ggrrll, can you give a reproducible example ? I'm not sure to understand what parameters you used and what's the result you expect

Labels: Documentation
error message improvement

### Describe the workflow you want to enable

Hi, 

I think that this error message is misleading
https://github.com/scikit-learn/scikit-learn/blob/02ebf9e68fe1fc7687d9e1047b9e465ae0fd945e/sklearn/model_selection/_search_successive_halving.py#L186

I am basically following the example here
https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.HalvingGridSearchCV.html#sklearn.model_selection.HalvingGridSearchCV

so I have the same `resource` 

from that message, it seems that the problem is `max_resources`, while it is actually `resource`

what do you think? 

### Describe your proposed solution

you could for instance swap them:

                    " resource can only  be 'n_samples'  if max_resources='auto'"


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

_No response_

### Additional context

_No response_

COMMENT:
hi @jeremiedbb , 

as I mentioned before, I was following the example from the docs , so with ` resource='n_estimators',`  and no max assigned (auto)

the error raises correctly, according to the logic of the code, but the message is wrong, in my opinion

Labels: Documentation
error message improvement

### Describe the workflow you want to enable

Hi, 

I think that this error message is misleading
https://github.com/scikit-learn/scikit-learn/blob/02ebf9e68fe1fc7687d9e1047b9e465ae0fd945e/sklearn/model_selection/_search_successive_halving.py#L186

I am basically following the example here
https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.HalvingGridSearchCV.html#sklearn.model_selection.HalvingGridSearchCV

so I have the same `resource` 

from that message, it seems that the problem is `max_resources`, while it is actually `resource`

what do you think? 

### Describe your proposed solution

you could for instance swap them:

                    " resource can only  be 'n_samples'  if max_resources='auto'"


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

_No response_

### Additional context

_No response_

COMMENT:
I agree, we can switch the formulation of the error message. Would you like to submit a PR ?

Labels: Documentation
error message improvement

### Describe the workflow you want to enable

Hi, 

I think that this error message is misleading
https://github.com/scikit-learn/scikit-learn/blob/02ebf9e68fe1fc7687d9e1047b9e465ae0fd945e/sklearn/model_selection/_search_successive_halving.py#L186

I am basically following the example here
https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.HalvingGridSearchCV.html#sklearn.model_selection.HalvingGridSearchCV

so I have the same `resource` 

from that message, it seems that the problem is `max_resources`, while it is actually `resource`

what do you think? 

### Describe your proposed solution

you could for instance swap them:

                    " resource can only  be 'n_samples'  if max_resources='auto'"


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

_No response_

### Additional context

_No response_

COMMENT:
Ok sure -- I will

Labels: Documentation
error message improvement

### Describe the workflow you want to enable

Hi, 

I think that this error message is misleading
https://github.com/scikit-learn/scikit-learn/blob/02ebf9e68fe1fc7687d9e1047b9e465ae0fd945e/sklearn/model_selection/_search_successive_halving.py#L186

I am basically following the example here
https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.HalvingGridSearchCV.html#sklearn.model_selection.HalvingGridSearchCV

so I have the same `resource` 

from that message, it seems that the problem is `max_resources`, while it is actually `resource`

what do you think? 

### Describe your proposed solution

you could for instance swap them:

                    " resource can only  be 'n_samples'  if max_resources='auto'"


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

_No response_

### Additional context

_No response_

COMMENT:
Fixed by #24781

Labels: Documentation
DOC Adjusted_rand_score not obvious in the graph

### Describe the issue linked to the documentation

In the example "Adjustment for chance in clustering performance evaluation", there are four different scores in the graph legend, but the graph shows only three lines. The blue line `adjusted_rand_score` seems to be very close to the green line, making it difficult to identify. 

<https://scikit-learn.org/stable/auto_examples/cluster/plot_adjusted_for_chance_measures.html>

### Suggest a potential alternative/fix

There are several ways to improve the graph, including but are not limited to:

- Explain where exactly the blue line `adjusted_rand_score` is located in the graph.
- Plot either the `adjusted_rand_score` or the `ami_score` (green line), but not both.
- Create a separate graph to showcase where the blue and green lines differ.

COMMENT:
You can also play with the data so that those two scores are not almost identical, that'd fix the plotting issue.

That example can also use some change in the colors so that it's more colorblind friendly.

The example can also be improved by adding sections and descriptions in the middle of the example as well as on top.

Thanks for pointing it out. Would you like to send a PR with potential fixes?

Labels: Documentation
DOC Adjusted_rand_score not obvious in the graph

### Describe the issue linked to the documentation

In the example "Adjustment for chance in clustering performance evaluation", there are four different scores in the graph legend, but the graph shows only three lines. The blue line `adjusted_rand_score` seems to be very close to the green line, making it difficult to identify. 

<https://scikit-learn.org/stable/auto_examples/cluster/plot_adjusted_for_chance_measures.html>

### Suggest a potential alternative/fix

There are several ways to improve the graph, including but are not limited to:

- Explain where exactly the blue line `adjusted_rand_score` is located in the graph.
- Plot either the `adjusted_rand_score` or the `ami_score` (green line), but not both.
- Create a separate graph to showcase where the blue and green lines differ.

COMMENT:
@adrinjalali The issue has been fixed for the latest version, so I moved the legend to improve graph readability. See PR #24785. 

https://github.com/scikit-learn/scikit-learn/blob/main/examples/cluster/plot_adjusted_for_chance_measures.py

Labels: Documentation
MLPEstimator do not report the proper `n_iter_` after successive call of `fit`

### Describe the bug

It seems that `MLPRegressor` and `MLPClassifier` does not take into account `max_iter` with `warm_start`.

### Steps/Code to Reproduce


```python
model = MLPRegressor(warm_start=True, early_stopping=True, max_iter=10)
model.fit(X_iris, y_iris)
assert model.n_iter_ <= 10
model.set_params(max_iter=20)
model.fit(X_iris, y_iris)
assert model.n_iter_ <= 20
```

You can also try `MLPClassifier` which leads to over iterating.

### Expected Results

`n_iter_ <= 20`

### Actual Results

```pytb
    def test_xxx():
        model = MLPRegressor(warm_start=True, early_stopping=False, max_iter=10)
        model.fit(X_iris, y_iris)
        assert model.n_iter_ <= 10
        model.set_params(max_iter=20)
        model.fit(X_iris, y_iris)
>       assert model.n_iter_ <= 20
E       assert 30 <= 20
E        +  where 30 = MLPRegressor(max_iter=20, warm_start=True).n_iter_
```

### Versions

```shell
System:
    python: 3.8.12 | packaged by conda-forge | (default, Sep 16 2021, 01:38:21)  [Clang 11.1.0 ]
executable: /Users/glemaitre/mambaforge/envs/dev/bin/python
   machine: macOS-12.6-arm64-arm-64bit

Python dependencies:
      sklearn: 1.2.dev0
          pip: 21.3
   setuptools: 58.2.0
        numpy: 1.21.6
        scipy: 1.8.0
       Cython: 0.29.24
       pandas: 1.5.0
   matplotlib: 3.4.3
       joblib: 1.2.0
threadpoolctl: 2.2.0

Built with OpenMP: True

threadpoolctl info:
       user_api: blas
   internal_api: openblas
         prefix: libopenblas
       filepath: /Users/glemaitre/mambaforge/envs/dev/lib/libopenblas_vortexp-r0.3.18.dylib
        version: 0.3.18
threading_layer: openmp
   architecture: VORTEX
    num_threads: 8

       user_api: openmp
   internal_api: openmp
         prefix: libomp
       filepath: /Users/glemaitre/mambaforge/envs/dev/lib/libomp.dylib
        version: None
    num_threads: 8
```

COMMENT:
Note that LBFGS solver works as expected.

Labels: Bug, module:neural_network
MLPEstimator do not report the proper `n_iter_` after successive call of `fit`

### Describe the bug

It seems that `MLPRegressor` and `MLPClassifier` does not take into account `max_iter` with `warm_start`.

### Steps/Code to Reproduce


```python
model = MLPRegressor(warm_start=True, early_stopping=True, max_iter=10)
model.fit(X_iris, y_iris)
assert model.n_iter_ <= 10
model.set_params(max_iter=20)
model.fit(X_iris, y_iris)
assert model.n_iter_ <= 20
```

You can also try `MLPClassifier` which leads to over iterating.

### Expected Results

`n_iter_ <= 20`

### Actual Results

```pytb
    def test_xxx():
        model = MLPRegressor(warm_start=True, early_stopping=False, max_iter=10)
        model.fit(X_iris, y_iris)
        assert model.n_iter_ <= 10
        model.set_params(max_iter=20)
        model.fit(X_iris, y_iris)
>       assert model.n_iter_ <= 20
E       assert 30 <= 20
E        +  where 30 = MLPRegressor(max_iter=20, warm_start=True).n_iter_
```

### Versions

```shell
System:
    python: 3.8.12 | packaged by conda-forge | (default, Sep 16 2021, 01:38:21)  [Clang 11.1.0 ]
executable: /Users/glemaitre/mambaforge/envs/dev/bin/python
   machine: macOS-12.6-arm64-arm-64bit

Python dependencies:
      sklearn: 1.2.dev0
          pip: 21.3
   setuptools: 58.2.0
        numpy: 1.21.6
        scipy: 1.8.0
       Cython: 0.29.24
       pandas: 1.5.0
   matplotlib: 3.4.3
       joblib: 1.2.0
threadpoolctl: 2.2.0

Built with OpenMP: True

threadpoolctl info:
       user_api: blas
   internal_api: openblas
         prefix: libopenblas
       filepath: /Users/glemaitre/mambaforge/envs/dev/lib/libopenblas_vortexp-r0.3.18.dylib
        version: 0.3.18
threading_layer: openmp
   architecture: VORTEX
    num_threads: 8

       user_api: openmp
   internal_api: openmp
         prefix: libomp
       filepath: /Users/glemaitre/mambaforge/envs/dev/lib/libomp.dylib
        version: None
    num_threads: 8
```

COMMENT:
OK, the reason is that the `n_iter_` is not reset to `0` in the non-incremental case (calling `fit` instead of `partial_fit`.

Labels: Bug, module:neural_network
MLPEstimator do not report the proper `n_iter_` after successive call of `fit`

### Describe the bug

It seems that `MLPRegressor` and `MLPClassifier` does not take into account `max_iter` with `warm_start`.

### Steps/Code to Reproduce


```python
model = MLPRegressor(warm_start=True, early_stopping=True, max_iter=10)
model.fit(X_iris, y_iris)
assert model.n_iter_ <= 10
model.set_params(max_iter=20)
model.fit(X_iris, y_iris)
assert model.n_iter_ <= 20
```

You can also try `MLPClassifier` which leads to over iterating.

### Expected Results

`n_iter_ <= 20`

### Actual Results

```pytb
    def test_xxx():
        model = MLPRegressor(warm_start=True, early_stopping=False, max_iter=10)
        model.fit(X_iris, y_iris)
        assert model.n_iter_ <= 10
        model.set_params(max_iter=20)
        model.fit(X_iris, y_iris)
>       assert model.n_iter_ <= 20
E       assert 30 <= 20
E        +  where 30 = MLPRegressor(max_iter=20, warm_start=True).n_iter_
```

### Versions

```shell
System:
    python: 3.8.12 | packaged by conda-forge | (default, Sep 16 2021, 01:38:21)  [Clang 11.1.0 ]
executable: /Users/glemaitre/mambaforge/envs/dev/bin/python
   machine: macOS-12.6-arm64-arm-64bit

Python dependencies:
      sklearn: 1.2.dev0
          pip: 21.3
   setuptools: 58.2.0
        numpy: 1.21.6
        scipy: 1.8.0
       Cython: 0.29.24
       pandas: 1.5.0
   matplotlib: 3.4.3
       joblib: 1.2.0
threadpoolctl: 2.2.0

Built with OpenMP: True

threadpoolctl info:
       user_api: blas
   internal_api: openblas
         prefix: libopenblas
       filepath: /Users/glemaitre/mambaforge/envs/dev/lib/libopenblas_vortexp-r0.3.18.dylib
        version: 0.3.18
threading_layer: openmp
   architecture: VORTEX
    num_threads: 8

       user_api: openmp
   internal_api: openmp
         prefix: libomp
       filepath: /Users/glemaitre/mambaforge/envs/dev/lib/libomp.dylib
        version: None
    num_threads: 8
```

COMMENT:
Need to check if this is a bug or a feature cf. https://github.com/scikit-learn/scikit-learn/issues/16812

Labels: Bug, module:neural_network
MLPEstimator do not report the proper `n_iter_` after successive call of `fit`

### Describe the bug

It seems that `MLPRegressor` and `MLPClassifier` does not take into account `max_iter` with `warm_start`.

### Steps/Code to Reproduce


```python
model = MLPRegressor(warm_start=True, early_stopping=True, max_iter=10)
model.fit(X_iris, y_iris)
assert model.n_iter_ <= 10
model.set_params(max_iter=20)
model.fit(X_iris, y_iris)
assert model.n_iter_ <= 20
```

You can also try `MLPClassifier` which leads to over iterating.

### Expected Results

`n_iter_ <= 20`

### Actual Results

```pytb
    def test_xxx():
        model = MLPRegressor(warm_start=True, early_stopping=False, max_iter=10)
        model.fit(X_iris, y_iris)
        assert model.n_iter_ <= 10
        model.set_params(max_iter=20)
        model.fit(X_iris, y_iris)
>       assert model.n_iter_ <= 20
E       assert 30 <= 20
E        +  where 30 = MLPRegressor(max_iter=20, warm_start=True).n_iter_
```

### Versions

```shell
System:
    python: 3.8.12 | packaged by conda-forge | (default, Sep 16 2021, 01:38:21)  [Clang 11.1.0 ]
executable: /Users/glemaitre/mambaforge/envs/dev/bin/python
   machine: macOS-12.6-arm64-arm-64bit

Python dependencies:
      sklearn: 1.2.dev0
          pip: 21.3
   setuptools: 58.2.0
        numpy: 1.21.6
        scipy: 1.8.0
       Cython: 0.29.24
       pandas: 1.5.0
   matplotlib: 3.4.3
       joblib: 1.2.0
threadpoolctl: 2.2.0

Built with OpenMP: True

threadpoolctl info:
       user_api: blas
   internal_api: openblas
         prefix: libopenblas
       filepath: /Users/glemaitre/mambaforge/envs/dev/lib/libopenblas_vortexp-r0.3.18.dylib
        version: 0.3.18
threading_layer: openmp
   architecture: VORTEX
    num_threads: 8

       user_api: openmp
   internal_api: openmp
         prefix: libomp
       filepath: /Users/glemaitre/mambaforge/envs/dev/lib/libomp.dylib
        version: None
    num_threads: 8
```

COMMENT:
~~But with warm start, aren't you asking for 20 **more** iterations ? (leading to 30 in total)~~

EDIT: actually, thinking more about that I agree that it should be 20 in total (we are not doing incremental learning here)

Labels: Bug, module:neural_network