Talip7/scikit-learn-issues-multilabel huggingface dataset:
DOC the pipeline user guide should include same estimators to demonstrate pipeline construction

### Describe the issue linked to the documentation

In the  [user guide for pipelines](https://scikit-learn.org/dev/modules/compose.html) the demonstration of the construction of a pipeline includes two examples:

1. Directly creating a new instance of `Pipeline`.
2. Using the utility function `make_pipeline`.

Each example uses different lists of estimators, whereas it would be clearer if both examples used the same estimators.

### Suggest a potential alternative/fix

Both examples should use the same estimators when creating a Pipeline, namely the combination of PCA and SVC as in the first example.

In the file doc/modules/compose.rst lines 68-72 should be replaced with the following
`>>> make_pipeline(PCA(), SVC())`
`Pipeline(steps=[('reduce_dim', PCA()), ('clf', SVC())])`

COMMENT:
I think the issue here is not whether to use `Pipeline` or `make_pipeline`, rather to use the same sub-estimators in both cases so that the user can compare?

Labels: Documentation
DOC the pipeline user guide should include same estimators to demonstrate pipeline construction

### Describe the issue linked to the documentation

In the  [user guide for pipelines](https://scikit-learn.org/dev/modules/compose.html) the demonstration of the construction of a pipeline includes two examples:

1. Directly creating a new instance of `Pipeline`.
2. Using the utility function `make_pipeline`.

Each example uses different lists of estimators, whereas it would be clearer if both examples used the same estimators.

### Suggest a potential alternative/fix

Both examples should use the same estimators when creating a Pipeline, namely the combination of PCA and SVC as in the first example.

In the file doc/modules/compose.rst lines 68-72 should be replaced with the following
`>>> make_pipeline(PCA(), SVC())`
`Pipeline(steps=[('reduce_dim', PCA()), ('clf', SVC())])`

COMMENT:
> I think the issue here is not whether to use Pipeline or make_pipeline, rather to use the same sub-estimators in both cases so that the user can compare?

I agree, that is the issue. I'm okay with the proposed change.

Labels: Documentation
DOC the pipeline user guide should include same estimators to demonstrate pipeline construction

### Describe the issue linked to the documentation

In the  [user guide for pipelines](https://scikit-learn.org/dev/modules/compose.html) the demonstration of the construction of a pipeline includes two examples:

1. Directly creating a new instance of `Pipeline`.
2. Using the utility function `make_pipeline`.

Each example uses different lists of estimators, whereas it would be clearer if both examples used the same estimators.

### Suggest a potential alternative/fix

Both examples should use the same estimators when creating a Pipeline, namely the combination of PCA and SVC as in the first example.

In the file doc/modules/compose.rst lines 68-72 should be replaced with the following
`>>> make_pipeline(PCA(), SVC())`
`Pipeline(steps=[('reduce_dim', PCA()), ('clf', SVC())])`

COMMENT:
@adrinjalali check out the PR :)

Labels: Documentation
Scikit learn wheel failing to compile on Debain

### Describe the bug

Wheel is failing to compile
Previously it was working with same versions

<img width="1364" alt="image" src="https://github.com/scikit-learn/scikit-learn/assets/104883828/6605bb18-07e1-4600-9722-780ab6660120">



<img width="1369" alt="image" src="https://github.com/scikit-learn/scikit-learn/assets/104883828/d60ff82b-319c-427f-95d5-81741f86bd5b">


### Steps/Code to Reproduce

pip version 22.0.4, 23.1.2
Python 3.9.5

gcc is already the newest version (4:8.3.0-1).

### Expected Results

scikit-learn should compile and install properly

### Actual Results

scikit learn is failing to compile

### Versions

```shell
scikit-learn==0.23.1
scipy==1.7.0
numpy==1.22.0
joblib==1.2.0
threadpoolctl==3.1.0


pip version 22.0.4, 23.1.2
Python 3.9.5

gcc is already the newest version (4:8.3.0-1).
```

COMMENT:
Duplicate of https://github.com/scikit-learn/scikit-learn/issues/26858

Labels: Bug, Needs Triage
Scikit learn wheel failing to compile on Debain

### Describe the bug

Wheel is failing to compile
Previously it was working with same versions

<img width="1364" alt="image" src="https://github.com/scikit-learn/scikit-learn/assets/104883828/6605bb18-07e1-4600-9722-780ab6660120">



<img width="1369" alt="image" src="https://github.com/scikit-learn/scikit-learn/assets/104883828/d60ff82b-319c-427f-95d5-81741f86bd5b">


### Steps/Code to Reproduce

pip version 22.0.4, 23.1.2
Python 3.9.5

gcc is already the newest version (4:8.3.0-1).

### Expected Results

scikit-learn should compile and install properly

### Actual Results

scikit learn is failing to compile

### Versions

```shell
scikit-learn==0.23.1
scipy==1.7.0
numpy==1.22.0
joblib==1.2.0
threadpoolctl==3.1.0


pip version 22.0.4, 23.1.2
Python 3.9.5

gcc is already the newest version (4:8.3.0-1).
```

COMMENT:
scikit-learn: 1.3.0 and Python 3.11.4 have the same issue. And how to fix it? Thank you!

Labels: Bug, Needs Triage
Is this behavior a bug?: f1_score([1,0,0], [0,1,0], zero_division=1.0) returns 1.0 not 0.0

### Describe the bug

Thank you for the update in https://github.com/scikit-learn/scikit-learn/pull/25531

In scikit-learn 1.3.0, there seems to be a bug in the `zero_division` argument of the `f1_score`.
It appears to be degrading comparing with scikit-learn 1.2.2.

### Steps/Code to Reproduce

```python
>>> from sklearn.metrics import f1_score
>>> f1_score([1,0,0], [0,1,0])
0.0
>>> f1_score([1,0,0], [0,1,0], zero_division=1.0)
1.0
```

### Expected Results

Returns 0.0 not 1.0.

In scikit-learn 1.2.2

```python
>>> from sklearn.metrics import f1_score
>>> f1_score([1,0,0], [0,1,0])
0.0
>>> f1_score([1,0,0], [0,1,0], zero_division=1.0)
0.0
```

---

```
>>> confusion_matrix([1,0,0], [0,1,0])
array([[1, 1],
       [1, 0]])
```

- precision 0.0
- recall 0.0
- -> f1_score should be 0.0 to show model's low performance

### Actual Results

Returns 1.0

---

Other case (OK)

```python
>>> f1_score([0,0,0], [0,0,0])  # raise UndefinedMetricWarning
0.0
>>> f1_score([0,0,0], [0,0,0], zero_division=1)
1.0
```

### Versions

```shell
System:
    python: 3.9.16 (main, Jan  3 2023, 22:16:38)  [Clang 14.0.0 (clang-1400.0.29.202)]
executable: /.../sci13/bin/python
   machine: macOS-12.6.6-arm64-arm-64bit

Python dependencies:
      sklearn: 1.3.0
          pip: 23.2
   setuptools: 68.0.0
        numpy: 1.25.1
        scipy: 1.11.1
       Cython: None
       pandas: None
   matplotlib: None
       joblib: 1.3.1
threadpoolctl: 3.2.0

Built with OpenMP: True

threadpoolctl info:
       user_api: openmp
   internal_api: openmp
    num_threads: 10
         prefix: libomp
       filepath: /.../sci13/lib/python3.9/site-packages/sklearn/.dylibs/libomp.dylib
        version: None

       user_api: blas
   internal_api: openblas
    num_threads: 10
         prefix: libopenblas
       filepath: /.../sci13/lib/python3.9/site-packages/numpy/.dylibs/libopenblas64_.0.dylib
        version: 0.3.23
threading_layer: pthreads
   architecture: armv8

       user_api: blas
   internal_api: openblas
    num_threads: 10
         prefix: libopenblas
       filepath: /.../sci13/lib/python3.9/site-packages/scipy/.dylibs/libopenblas.0.dylib
        version: 0.3.21.dev
threading_layer: pthreads
   architecture: armv8
```

COMMENT:
`zero_division=1.0` means that if you are a case that triggers a division by zero, then the score returned is `1.0`. It looks that this is exactly the expected behaviour.

Labels: Bug, Needs Info
Is this behavior a bug?: f1_score([1,0,0], [0,1,0], zero_division=1.0) returns 1.0 not 0.0

### Describe the bug

Thank you for the update in https://github.com/scikit-learn/scikit-learn/pull/25531

In scikit-learn 1.3.0, there seems to be a bug in the `zero_division` argument of the `f1_score`.
It appears to be degrading comparing with scikit-learn 1.2.2.

### Steps/Code to Reproduce

```python
>>> from sklearn.metrics import f1_score
>>> f1_score([1,0,0], [0,1,0])
0.0
>>> f1_score([1,0,0], [0,1,0], zero_division=1.0)
1.0
```

### Expected Results

Returns 0.0 not 1.0.

In scikit-learn 1.2.2

```python
>>> from sklearn.metrics import f1_score
>>> f1_score([1,0,0], [0,1,0])
0.0
>>> f1_score([1,0,0], [0,1,0], zero_division=1.0)
0.0
```

---

```
>>> confusion_matrix([1,0,0], [0,1,0])
array([[1, 1],
       [1, 0]])
```

- precision 0.0
- recall 0.0
- -> f1_score should be 0.0 to show model's low performance

### Actual Results

Returns 1.0

---

Other case (OK)

```python
>>> f1_score([0,0,0], [0,0,0])  # raise UndefinedMetricWarning
0.0
>>> f1_score([0,0,0], [0,0,0], zero_division=1)
1.0
```

### Versions

```shell
System:
    python: 3.9.16 (main, Jan  3 2023, 22:16:38)  [Clang 14.0.0 (clang-1400.0.29.202)]
executable: /.../sci13/bin/python
   machine: macOS-12.6.6-arm64-arm-64bit

Python dependencies:
      sklearn: 1.3.0
          pip: 23.2
   setuptools: 68.0.0
        numpy: 1.25.1
        scipy: 1.11.1
       Cython: None
       pandas: None
   matplotlib: None
       joblib: 1.3.1
threadpoolctl: 3.2.0

Built with OpenMP: True

threadpoolctl info:
       user_api: openmp
   internal_api: openmp
    num_threads: 10
         prefix: libomp
       filepath: /.../sci13/lib/python3.9/site-packages/sklearn/.dylibs/libomp.dylib
        version: None

       user_api: blas
   internal_api: openblas
    num_threads: 10
         prefix: libopenblas
       filepath: /.../sci13/lib/python3.9/site-packages/numpy/.dylibs/libopenblas64_.0.dylib
        version: 0.3.23
threading_layer: pthreads
   architecture: armv8

       user_api: blas
   internal_api: openblas
    num_threads: 10
         prefix: libopenblas
       filepath: /.../sci13/lib/python3.9/site-packages/scipy/.dylibs/libopenblas.0.dylib
        version: 0.3.21.dev
threading_layer: pthreads
   architecture: armv8
```

COMMENT:
I think actually the crux of this issue is more related to the discussion in https://github.com/scikit-learn/scikit-learn/issues/27047. @ftnext I'm going to close this issue for now and suggest you comment and discuss on the linked issue. Let me know if you have any questions/concerns :)

Labels: Bug, Needs Info
DOC Link to headers mis-poisitioned

### Describe the issue linked to the documentation

Link to a header in a page, e.g., the 'regression' subheading: https://scikit-learn.org/1.2/modules/linear_model.html#regression directs a position a bit further down the page from the header. Tested on firefox and chromium.

![image](https://github.com/scikit-learn/scikit-learn/assets/23182829/a83fef95-911d-4816-a2e5-87f7fddace7c)

Potentially this is caused by the navbar, i.e. the header would start at the top of the page if there was no navbar.

This may be unique to my system and happy to close if others can't replicate.

### Suggest a potential alternative/fix

_No response_

COMMENT:
Is it the same on the generated docs here? https://github.com/scikit-learn/scikit-learn/pull/26809

Labels: Documentation, Needs Triage
DOC Link to headers mis-poisitioned

### Describe the issue linked to the documentation

Link to a header in a page, e.g., the 'regression' subheading: https://scikit-learn.org/1.2/modules/linear_model.html#regression directs a position a bit further down the page from the header. Tested on firefox and chromium.

![image](https://github.com/scikit-learn/scikit-learn/assets/23182829/a83fef95-911d-4816-a2e5-87f7fddace7c)

Potentially this is caused by the navbar, i.e. the header would start at the top of the page if there was no navbar.

This may be unique to my system and happy to close if others can't replicate.

### Suggest a potential alternative/fix

_No response_

COMMENT:
Good point, it is not the case with pydata theme.

Labels: Documentation, Needs Triage
DOC Link to headers mis-poisitioned

### Describe the issue linked to the documentation

Link to a header in a page, e.g., the 'regression' subheading: https://scikit-learn.org/1.2/modules/linear_model.html#regression directs a position a bit further down the page from the header. Tested on firefox and chromium.

![image](https://github.com/scikit-learn/scikit-learn/assets/23182829/a83fef95-911d-4816-a2e5-87f7fddace7c)

Potentially this is caused by the navbar, i.e. the header would start at the top of the page if there was no navbar.

This may be unique to my system and happy to close if others can't replicate.

### Suggest a potential alternative/fix

_No response_

COMMENT:
Ah I accidentally was looking at an older version of the docs, works fine on dev and stable. Sorry for noise

Labels: Documentation, Needs Triage
Exception when transforming LabelEncoder with keyword argument

### Describe the bug

The transform method of LabelEncoder raises an exception when providing `y` with a keyword argument.

I mentioned this in discussion #26841 but I am more and more certain this is a bug. And even if it isn't and there is some good reason it fails, the error message is completely unclear since it refers to a parameter that is not present in the method.

### Steps/Code to Reproduce

```python
from sklearn.preprocessing import LabelEncoder

le = LabelEncoder().fit_transform(y=[0, 2, 2, 0])
```

### Expected Results

Normal output of the transform method. Same as when calling `LabelEncoder().fit_transform([0, 1, 2])` (withoyt `y=`), which in the above example would be `array([0, 1, 1, 0], dtype=int64)`.

### Actual Results

![image](https://github.com/scikit-learn/scikit-learn/assets/32366550/2a9311d7-56f6-420b-9708-66584c029283)


### Versions

```shell
System:
    python: 3.10.9 (tags/v3.10.9:1dd9be6, Dec  6 2022, 20:01:21) [MSC v.1934 64 bit (AMD64)]
executable: C:\repos\dblib\venv\Scripts\python.exe
   machine: Windows-10-10.0.22621-SP0

Python dependencies:
      sklearn: 1.3.0
          pip: 23.2
   setuptools: 65.5.1
        numpy: 1.25.1
        scipy: 1.11.1
       Cython: None
       pandas: 1.4.4
   matplotlib: None
       joblib: 1.3.1
threadpoolctl: 3.2.0

Built with OpenMP: True

threadpoolctl info:
       user_api: openmp
   internal_api: openmp
    num_threads: 8
         prefix: vcomp
       filepath: C:\repos\dblib\venv\Lib\site-packages\sklearn\.libs\vcomp140.dll
        version: None

       user_api: blas
   internal_api: openblas
    num_threads: 8
         prefix: libopenblas
       filepath: C:\repos\dblib\venv\Lib\site-packages\numpy\.libs\libopenblas64__v0.3.23-gcc_10_3_0.dll
        version: 0.3.23
threading_layer: pthreads
   architecture: SkylakeX

       user_api: blas
   internal_api: openblas
    num_threads: 8
         prefix: libopenblas
       filepath: C:\repos\dblib\venv\Lib\site-packages\scipy.libs\libopenblas_v0.3.20-571-g3dec11c6-gcc_10_3_0-c2315440d6b6cef5037bad648efc8c59.dll
        version: 0.3.21.dev
threading_layer: pthreads
   architecture: SkylakeX
```

COMMENT:
This might  be related to the implementation of the  `__init_subclass__` method of `_SetOutputMixin`, `LabelEncoder` inherits from. It favours the parent's class `fit_transform` method over the child class'es implementation of this method.

@adrinjalali, your help is needed here. I have played with  `__init_subclass__`  and found out that mapping `fit_transform` to `fit_transfrom` (instead of to `transform`) gets us rid of the error message. Like this:

```
sklearn/utils/_set_output.py (l. 195-199)
# Mapping from method to key in configurations
        method_to_key = {
            "transform": "transform",
            "fit_transform": "fit_transform",
        }
```

But honestly, I barely understand and cannot judge the side effects.

Labels: Bug
Exception when transforming LabelEncoder with keyword argument

### Describe the bug

The transform method of LabelEncoder raises an exception when providing `y` with a keyword argument.

I mentioned this in discussion #26841 but I am more and more certain this is a bug. And even if it isn't and there is some good reason it fails, the error message is completely unclear since it refers to a parameter that is not present in the method.

### Steps/Code to Reproduce

```python
from sklearn.preprocessing import LabelEncoder

le = LabelEncoder().fit_transform(y=[0, 2, 2, 0])
```

### Expected Results

Normal output of the transform method. Same as when calling `LabelEncoder().fit_transform([0, 1, 2])` (withoyt `y=`), which in the above example would be `array([0, 1, 1, 0], dtype=int64)`.

### Actual Results

![image](https://github.com/scikit-learn/scikit-learn/assets/32366550/2a9311d7-56f6-420b-9708-66584c029283)


### Versions

```shell
System:
    python: 3.10.9 (tags/v3.10.9:1dd9be6, Dec  6 2022, 20:01:21) [MSC v.1934 64 bit (AMD64)]
executable: C:\repos\dblib\venv\Scripts\python.exe
   machine: Windows-10-10.0.22621-SP0

Python dependencies:
      sklearn: 1.3.0
          pip: 23.2
   setuptools: 65.5.1
        numpy: 1.25.1
        scipy: 1.11.1
       Cython: None
       pandas: 1.4.4
   matplotlib: None
       joblib: 1.3.1
threadpoolctl: 3.2.0

Built with OpenMP: True

threadpoolctl info:
       user_api: openmp
   internal_api: openmp
    num_threads: 8
         prefix: vcomp
       filepath: C:\repos\dblib\venv\Lib\site-packages\sklearn\.libs\vcomp140.dll
        version: None

       user_api: blas
   internal_api: openblas
    num_threads: 8
         prefix: libopenblas
       filepath: C:\repos\dblib\venv\Lib\site-packages\numpy\.libs\libopenblas64__v0.3.23-gcc_10_3_0.dll
        version: 0.3.23
threading_layer: pthreads
   architecture: SkylakeX

       user_api: blas
   internal_api: openblas
    num_threads: 8
         prefix: libopenblas
       filepath: C:\repos\dblib\venv\Lib\site-packages\scipy.libs\libopenblas_v0.3.20-571-g3dec11c6-gcc_10_3_0-c2315440d6b6cef5037bad648efc8c59.dll
        version: 0.3.21.dev
threading_layer: pthreads
   architecture: SkylakeX
```

COMMENT:
This one's not me 😁 it's @thomasjpfan 😝 

The issue's coming from this wrapping function:

https://github.com/scikit-learn/scikit-learn/blob/3ef1cd84c49603ab047aa1beebf7be5ea4d498d7/sklearn/utils/_set_output.py#L138-L153

It's hardcoding `X`, which it shouldn't.

Labels: Bug
v0.24.X fails to build because of new Cython 3.0.0 release

### Describe the bug

The build requirements in `pyproject.toml` specify a minimum Cython version but no maximum version.
https://github.com/scikit-learn/scikit-learn/blob/4e679023eb63fff9aa611ed7189fad7581b742a0/pyproject.toml#L6

The recent release of Cython 3.0.0 is not compatible with the `0.24.X` `scikit-learn` code.
https://github.com/cython/cython/releases/tag/3.0.0

### Steps/Code to Reproduce

```sh
git clone git@github.com:scikit-learn/scikit-learn.git
git checkout 0.24.X
pip3 install --user cython==3.0.0
pip3 install --user -v --no-use-pep517 --no-build-isolation .
```

### Expected Results

I expect the package to build successfully.

### Actual Results

Excerpt of output:
```
    Error compiling Cython file:
    ------------------------------------------------------------
    ...
            if n_used_bins <= 1:
                free(cat_infos)
                return

            qsort(cat_infos, n_used_bins, sizeof(categorical_info),
                  compare_cat_infos)
                  ^
    ------------------------------------------------------------

    sklearn/ensemble/_hist_gradient_boosting/splitting.pyx:912:14: Cannot assign type 'int (const void *, const void *) except? -1 nogil' to 'int (*)(const void *, const void *) noexcept nogil'
    Traceback (most recent call last):
      File "/home/nmclean/.local/lib/python3.10/site-packages/Cython/Build/Dependencies.py", line 1325, in cythonize_one_helper
        return cythonize_one(*m)
      File "/home/nmclean/.local/lib/python3.10/site-packages/Cython/Build/Dependencies.py", line 1301, in cythonize_one
        raise CompileError(None, pyx_file)
    Cython.Compiler.Errors.CompileError: sklearn/ensemble/_hist_gradient_boosting/splitting.pyx

```


### Versions

```shell
0.24.2
```

COMMENT:
I think 0.24.x is no longer under active development.

Labels: Bug, Needs Triage
v0.24.X fails to build because of new Cython 3.0.0 release

### Describe the bug

The build requirements in `pyproject.toml` specify a minimum Cython version but no maximum version.
https://github.com/scikit-learn/scikit-learn/blob/4e679023eb63fff9aa611ed7189fad7581b742a0/pyproject.toml#L6

The recent release of Cython 3.0.0 is not compatible with the `0.24.X` `scikit-learn` code.
https://github.com/cython/cython/releases/tag/3.0.0

### Steps/Code to Reproduce

```sh
git clone git@github.com:scikit-learn/scikit-learn.git
git checkout 0.24.X
pip3 install --user cython==3.0.0
pip3 install --user -v --no-use-pep517 --no-build-isolation .
```

### Expected Results

I expect the package to build successfully.

### Actual Results

Excerpt of output:
```
    Error compiling Cython file:
    ------------------------------------------------------------
    ...
            if n_used_bins <= 1:
                free(cat_infos)
                return

            qsort(cat_infos, n_used_bins, sizeof(categorical_info),
                  compare_cat_infos)
                  ^
    ------------------------------------------------------------

    sklearn/ensemble/_hist_gradient_boosting/splitting.pyx:912:14: Cannot assign type 'int (const void *, const void *) except? -1 nogil' to 'int (*)(const void *, const void *) noexcept nogil'
    Traceback (most recent call last):
      File "/home/nmclean/.local/lib/python3.10/site-packages/Cython/Build/Dependencies.py", line 1325, in cythonize_one_helper
        return cythonize_one(*m)
      File "/home/nmclean/.local/lib/python3.10/site-packages/Cython/Build/Dependencies.py", line 1301, in cythonize_one
        raise CompileError(None, pyx_file)
    Cython.Compiler.Errors.CompileError: sklearn/ensemble/_hist_gradient_boosting/splitting.pyx

```


### Versions

```shell
0.24.2
```

COMMENT:
We only support the latest release.

Labels: Bug, Needs Triage