Talip7/scikit-learn-issues-multilabel huggingface dataset:
DOC Link Visualization tools to their respective interpretation in the User Guide

### Describe the issue linked to the documentation

As of today, some of our [Display objects](https://scikit-learn.org/dev/visualizations.html#display-objects) point towards the [`Visualizations`](https://scikit-learn.org/dev/visualizations.html) section of the User Guide, some of them point toward the respective plotted function, some of them do both.

As sometimes users want to know how to interpret the plot and sometimes they want to understand the plot API, we've resorted to linking both, e.g. for the [RocCurveDisplay](https://scikit-learn.org/dev/modules/generated/sklearn.metrics.RocCurveDisplay.html) we have:

```
    For general information regarding `scikit-learn` visualization tools, see
    the :ref:`Visualization Guide <visualizations>`.
    For guidance on interpreting these plots, refer to the :ref:`Model
    Evaluation Guide <roc_metrics>`.
```

Contributors willing to address this issue, please fix **one** of the following listed Display Objects **per pull request**.

- [x] [inspection.PartialDependenceDisplay](https://scikit-learn.org/dev/modules/generated/sklearn.inspection.PartialDependenceDisplay.html) points to [`partial-dependence`](https://scikit-learn.org/dev/modules/partial_dependence.html#partial-dependence). It should point [`Visualizations`](https://scikit-learn.org/dev/visualizations.html) as well. #31313

- [x] [metrics.ConfusionMatrixDisplay](https://scikit-learn.org/dev/modules/generated/sklearn.metrics.ConfusionMatrixDisplay.html) points only to point [`Visualizations`](https://scikit-learn.org/dev/visualizations.html). It should point to [`confusion-matrix`](https://scikit-learn.org/dev/modules/model_evaluation.html#confusion-matrix) as well. #31306

- [x] [metrics.DetCurveDisplay](https://scikit-learn.org/dev/modules/generated/sklearn.metrics.DetCurveDisplay.html) points to [`det-curve`](https://scikit-learn.org/dev/modules/model_evaluation.html#det-curve). It should point [`Visualizations`](https://scikit-learn.org/dev/visualizations.html) as well. #31307


- [x] [metrics.PrecisionRecallDisplay](https://scikit-learn.org/dev/modules/generated/sklearn.metrics.PrecisionRecallDisplay.html) points only to point [`Visualizations`](https://scikit-learn.org/dev/visualizations.html). It should point to [`precision-recall-f-measure-metrics`](https://scikit-learn.org/dev/modules/model_evaluation.html#precision-recall-f-measure-metrics) as well. #31308

Thanks for your help!

### Suggest a potential alternative/fix

_No response_

COMMENT:
Hey, I would like to work on the issue (specifcally metrics.ConfusionMatrixDisplay ) @ArturoAmorQ

Labels: Documentation
DOC Link Visualization tools to their respective interpretation in the User Guide

### Describe the issue linked to the documentation

As of today, some of our [Display objects](https://scikit-learn.org/dev/visualizations.html#display-objects) point towards the [`Visualizations`](https://scikit-learn.org/dev/visualizations.html) section of the User Guide, some of them point toward the respective plotted function, some of them do both.

As sometimes users want to know how to interpret the plot and sometimes they want to understand the plot API, we've resorted to linking both, e.g. for the [RocCurveDisplay](https://scikit-learn.org/dev/modules/generated/sklearn.metrics.RocCurveDisplay.html) we have:

```
    For general information regarding `scikit-learn` visualization tools, see
    the :ref:`Visualization Guide <visualizations>`.
    For guidance on interpreting these plots, refer to the :ref:`Model
    Evaluation Guide <roc_metrics>`.
```

Contributors willing to address this issue, please fix **one** of the following listed Display Objects **per pull request**.

- [x] [inspection.PartialDependenceDisplay](https://scikit-learn.org/dev/modules/generated/sklearn.inspection.PartialDependenceDisplay.html) points to [`partial-dependence`](https://scikit-learn.org/dev/modules/partial_dependence.html#partial-dependence). It should point [`Visualizations`](https://scikit-learn.org/dev/visualizations.html) as well. #31313

- [x] [metrics.ConfusionMatrixDisplay](https://scikit-learn.org/dev/modules/generated/sklearn.metrics.ConfusionMatrixDisplay.html) points only to point [`Visualizations`](https://scikit-learn.org/dev/visualizations.html). It should point to [`confusion-matrix`](https://scikit-learn.org/dev/modules/model_evaluation.html#confusion-matrix) as well. #31306

- [x] [metrics.DetCurveDisplay](https://scikit-learn.org/dev/modules/generated/sklearn.metrics.DetCurveDisplay.html) points to [`det-curve`](https://scikit-learn.org/dev/modules/model_evaluation.html#det-curve). It should point [`Visualizations`](https://scikit-learn.org/dev/visualizations.html) as well. #31307


- [x] [metrics.PrecisionRecallDisplay](https://scikit-learn.org/dev/modules/generated/sklearn.metrics.PrecisionRecallDisplay.html) points only to point [`Visualizations`](https://scikit-learn.org/dev/visualizations.html). It should point to [`precision-recall-f-measure-metrics`](https://scikit-learn.org/dev/modules/model_evaluation.html#precision-recall-f-measure-metrics) as well. #31308

Thanks for your help!

### Suggest a potential alternative/fix

_No response_

COMMENT:
Hey @ArturoAmorQ I would like to work specifically on [inspection.PartialDependenceDisplay](https://scikit-learn.org/dev/modules/generated/sklearn.inspection.PartialDependenceDisplay.html)

Labels: Documentation
DOC Link Visualization tools to their respective interpretation in the User Guide

### Describe the issue linked to the documentation

As of today, some of our [Display objects](https://scikit-learn.org/dev/visualizations.html#display-objects) point towards the [`Visualizations`](https://scikit-learn.org/dev/visualizations.html) section of the User Guide, some of them point toward the respective plotted function, some of them do both.

As sometimes users want to know how to interpret the plot and sometimes they want to understand the plot API, we've resorted to linking both, e.g. for the [RocCurveDisplay](https://scikit-learn.org/dev/modules/generated/sklearn.metrics.RocCurveDisplay.html) we have:

```
    For general information regarding `scikit-learn` visualization tools, see
    the :ref:`Visualization Guide <visualizations>`.
    For guidance on interpreting these plots, refer to the :ref:`Model
    Evaluation Guide <roc_metrics>`.
```

Contributors willing to address this issue, please fix **one** of the following listed Display Objects **per pull request**.

- [x] [inspection.PartialDependenceDisplay](https://scikit-learn.org/dev/modules/generated/sklearn.inspection.PartialDependenceDisplay.html) points to [`partial-dependence`](https://scikit-learn.org/dev/modules/partial_dependence.html#partial-dependence). It should point [`Visualizations`](https://scikit-learn.org/dev/visualizations.html) as well. #31313

- [x] [metrics.ConfusionMatrixDisplay](https://scikit-learn.org/dev/modules/generated/sklearn.metrics.ConfusionMatrixDisplay.html) points only to point [`Visualizations`](https://scikit-learn.org/dev/visualizations.html). It should point to [`confusion-matrix`](https://scikit-learn.org/dev/modules/model_evaluation.html#confusion-matrix) as well. #31306

- [x] [metrics.DetCurveDisplay](https://scikit-learn.org/dev/modules/generated/sklearn.metrics.DetCurveDisplay.html) points to [`det-curve`](https://scikit-learn.org/dev/modules/model_evaluation.html#det-curve). It should point [`Visualizations`](https://scikit-learn.org/dev/visualizations.html) as well. #31307


- [x] [metrics.PrecisionRecallDisplay](https://scikit-learn.org/dev/modules/generated/sklearn.metrics.PrecisionRecallDisplay.html) points only to point [`Visualizations`](https://scikit-learn.org/dev/visualizations.html). It should point to [`precision-recall-f-measure-metrics`](https://scikit-learn.org/dev/modules/model_evaluation.html#precision-recall-f-measure-metrics) as well. #31308

Thanks for your help!

### Suggest a potential alternative/fix

_No response_

COMMENT:
Hey @ArturoAmorQ  I would like to work on the issue, specifically [metrics.PrecisionRecallDisplay](https://scikit-learn.org/dev/modules/generated/sklearn.metrics.PrecisionRecallDisplay.html)

Labels: Documentation
DOC Link Visualization tools to their respective interpretation in the User Guide

### Describe the issue linked to the documentation

As of today, some of our [Display objects](https://scikit-learn.org/dev/visualizations.html#display-objects) point towards the [`Visualizations`](https://scikit-learn.org/dev/visualizations.html) section of the User Guide, some of them point toward the respective plotted function, some of them do both.

As sometimes users want to know how to interpret the plot and sometimes they want to understand the plot API, we've resorted to linking both, e.g. for the [RocCurveDisplay](https://scikit-learn.org/dev/modules/generated/sklearn.metrics.RocCurveDisplay.html) we have:

```
    For general information regarding `scikit-learn` visualization tools, see
    the :ref:`Visualization Guide <visualizations>`.
    For guidance on interpreting these plots, refer to the :ref:`Model
    Evaluation Guide <roc_metrics>`.
```

Contributors willing to address this issue, please fix **one** of the following listed Display Objects **per pull request**.

- [x] [inspection.PartialDependenceDisplay](https://scikit-learn.org/dev/modules/generated/sklearn.inspection.PartialDependenceDisplay.html) points to [`partial-dependence`](https://scikit-learn.org/dev/modules/partial_dependence.html#partial-dependence). It should point [`Visualizations`](https://scikit-learn.org/dev/visualizations.html) as well. #31313

- [x] [metrics.ConfusionMatrixDisplay](https://scikit-learn.org/dev/modules/generated/sklearn.metrics.ConfusionMatrixDisplay.html) points only to point [`Visualizations`](https://scikit-learn.org/dev/visualizations.html). It should point to [`confusion-matrix`](https://scikit-learn.org/dev/modules/model_evaluation.html#confusion-matrix) as well. #31306

- [x] [metrics.DetCurveDisplay](https://scikit-learn.org/dev/modules/generated/sklearn.metrics.DetCurveDisplay.html) points to [`det-curve`](https://scikit-learn.org/dev/modules/model_evaluation.html#det-curve). It should point [`Visualizations`](https://scikit-learn.org/dev/visualizations.html) as well. #31307


- [x] [metrics.PrecisionRecallDisplay](https://scikit-learn.org/dev/modules/generated/sklearn.metrics.PrecisionRecallDisplay.html) points only to point [`Visualizations`](https://scikit-learn.org/dev/visualizations.html). It should point to [`precision-recall-f-measure-metrics`](https://scikit-learn.org/dev/modules/model_evaluation.html#precision-recall-f-measure-metrics) as well. #31308

Thanks for your help!

### Suggest a potential alternative/fix

_No response_

COMMENT:
Hey @ArturoAmorQ I would like to work on the issue, specifically [metrics.DetCurveDisplay](https://scikit-learn.org/dev/modules/generated/sklearn.metrics.DetCurveDisplay.html)

Labels: Documentation
DOC Link Visualization tools to their respective interpretation in the User Guide

### Describe the issue linked to the documentation

As of today, some of our [Display objects](https://scikit-learn.org/dev/visualizations.html#display-objects) point towards the [`Visualizations`](https://scikit-learn.org/dev/visualizations.html) section of the User Guide, some of them point toward the respective plotted function, some of them do both.

As sometimes users want to know how to interpret the plot and sometimes they want to understand the plot API, we've resorted to linking both, e.g. for the [RocCurveDisplay](https://scikit-learn.org/dev/modules/generated/sklearn.metrics.RocCurveDisplay.html) we have:

```
    For general information regarding `scikit-learn` visualization tools, see
    the :ref:`Visualization Guide <visualizations>`.
    For guidance on interpreting these plots, refer to the :ref:`Model
    Evaluation Guide <roc_metrics>`.
```

Contributors willing to address this issue, please fix **one** of the following listed Display Objects **per pull request**.

- [x] [inspection.PartialDependenceDisplay](https://scikit-learn.org/dev/modules/generated/sklearn.inspection.PartialDependenceDisplay.html) points to [`partial-dependence`](https://scikit-learn.org/dev/modules/partial_dependence.html#partial-dependence). It should point [`Visualizations`](https://scikit-learn.org/dev/visualizations.html) as well. #31313

- [x] [metrics.ConfusionMatrixDisplay](https://scikit-learn.org/dev/modules/generated/sklearn.metrics.ConfusionMatrixDisplay.html) points only to point [`Visualizations`](https://scikit-learn.org/dev/visualizations.html). It should point to [`confusion-matrix`](https://scikit-learn.org/dev/modules/model_evaluation.html#confusion-matrix) as well. #31306

- [x] [metrics.DetCurveDisplay](https://scikit-learn.org/dev/modules/generated/sklearn.metrics.DetCurveDisplay.html) points to [`det-curve`](https://scikit-learn.org/dev/modules/model_evaluation.html#det-curve). It should point [`Visualizations`](https://scikit-learn.org/dev/visualizations.html) as well. #31307


- [x] [metrics.PrecisionRecallDisplay](https://scikit-learn.org/dev/modules/generated/sklearn.metrics.PrecisionRecallDisplay.html) points only to point [`Visualizations`](https://scikit-learn.org/dev/visualizations.html). It should point to [`precision-recall-f-measure-metrics`](https://scikit-learn.org/dev/modules/model_evaluation.html#precision-recall-f-measure-metrics) as well. #31308

Thanks for your help!

### Suggest a potential alternative/fix

_No response_

COMMENT:
Thanks to all the contributors. Closing as completed 🚀

Labels: Documentation
Reference `ValidationCurveDisplay` from `validation_curve`'s docstring in a "See also section"

### Describe the issue linked to the documentation

The docstring of `validation_curve` should point to the `ValidationCurveDisplay.from_estimator` factory method as a complementary tool that both computes the curves points and display them using matplotlib.

If you want to open a PR for this, please review some "See also" sections in other sections using `git grep` or the search feature of your IDE or github code search:

https://github.com/search?q=repo%3Ascikit-learn%2Fscikit-learn+%22See+also%22+language%3APython+path%3A%2F%5Esklearn%5C%2F%2F&type=code

COMMENT:
Hey @ArturoAmorQ I would like to work on the issue,

Labels: Documentation
Reference `ValidationCurveDisplay` from `validation_curve`'s docstring in a "See also section"

### Describe the issue linked to the documentation

The docstring of `validation_curve` should point to the `ValidationCurveDisplay.from_estimator` factory method as a complementary tool that both computes the curves points and display them using matplotlib.

If you want to open a PR for this, please review some "See also" sections in other sections using `git grep` or the search feature of your IDE or github code search:

https://github.com/search?q=repo%3Ascikit-learn%2Fscikit-learn+%22See+also%22+language%3APython+path%3A%2F%5Esklearn%5C%2F%2F&type=code

COMMENT:
Addressed in https://github.com/scikit-learn/scikit-learn/pull/31314

Labels: Documentation
`_safe_indexing` triggers `SettingWithCopyWarning` when used with `slice`

### Describe the bug

Here's something I noticed while looking into https://github.com/scikit-learn/scikit-learn/pull/31127

The test
```
pytest sklearn/utils/tests/test_indexing.py::test_safe_indexing_pandas_no_settingwithcopy_warning
```
checks that a copy is produced, and that no `SettingWithCopyWarning` is produced

Indeed, no copy is raised, but why is using `_safe_indexing` with a slice allowed to not make a copy? Is this intentional?

Based on responses, I can suggest what to do instead in https://github.com/scikit-learn/scikit-learn/pull/31127

(I am a little surprised that this always makes copies, given that a lot of the discussion in https://github.com/scikit-learn/scikit-learn/issues/28341 centered around wanting to avoid copies)

### Steps/Code to Reproduce

```python
import numpy as np

from sklearn.utils import _safe_indexing
import pandas as pd

X = pd.DataFrame({"a": [1, 2, 3], "b": [3, 4, 5]})
subset = _safe_indexing(X, slice(0, 2), axis=0)
subset.iloc[0, 0] = 10
```

### Expected Results

No `SettingWithCopyWarning`

### Actual Results

```
/home/marcogorelli/scikit-learn-dev/t.py:13: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  subset.iloc[0, 0] = 10
```

### Versions

```shell
System:
    python: 3.11.11 (main, Dec  4 2024, 08:55:07) [GCC 11.4.0]
executable: /home/marcogorelli/scikit-learn-dev/.venv/bin/python
   machine: Linux-5.15.167.4-microsoft-standard-WSL2-x86_64-with-glibc2.35

Python dependencies:
      sklearn: 1.7.dev0
          pip: 24.2
   setuptools: None
        numpy: 2.1.0
        scipy: 1.14.0
       Cython: 3.0.11
       pandas: 2.2.2
   matplotlib: None
       joblib: 1.4.2
threadpoolctl: 3.5.0

Built with OpenMP: True

threadpoolctl info:
       user_api: blas
   internal_api: openblas
    num_threads: 16
         prefix: libscipy_openblas
       filepath: /home/marcogorelli/scikit-learn-dev/.venv/lib/python3.11/site-packages/numpy.libs/libscipy_openblas64_-ff651d7f.so
        version: 0.3.27
threading_layer: pthreads
   architecture: SkylakeX

       user_api: blas
   internal_api: openblas
    num_threads: 16
         prefix: libscipy_openblas
       filepath: /home/marcogorelli/scikit-learn-dev/.venv/lib/python3.11/site-packages/scipy.libs/libscipy_openblas-c128ec02.so
        version: 0.3.27.dev
threading_layer: pthreads
   architecture: SkylakeX

       user_api: openmp
   internal_api: openmp
    num_threads: 16
         prefix: libgomp
       filepath: /usr/lib/x86_64-linux-gnu/libgomp.so.1.0.0
        version: None
```

COMMENT:
based on git logs for related functionality, I'm going to tag @glemaitre @ogrisel @lorentzenchr  @jeremiedbb to ask what the indended behaviour is

Labels: Bug
`_safe_indexing` triggers `SettingWithCopyWarning` when used with `slice`

### Describe the bug

Here's something I noticed while looking into https://github.com/scikit-learn/scikit-learn/pull/31127

The test
```
pytest sklearn/utils/tests/test_indexing.py::test_safe_indexing_pandas_no_settingwithcopy_warning
```
checks that a copy is produced, and that no `SettingWithCopyWarning` is produced

Indeed, no copy is raised, but why is using `_safe_indexing` with a slice allowed to not make a copy? Is this intentional?

Based on responses, I can suggest what to do instead in https://github.com/scikit-learn/scikit-learn/pull/31127

(I am a little surprised that this always makes copies, given that a lot of the discussion in https://github.com/scikit-learn/scikit-learn/issues/28341 centered around wanting to avoid copies)

### Steps/Code to Reproduce

```python
import numpy as np

from sklearn.utils import _safe_indexing
import pandas as pd

X = pd.DataFrame({"a": [1, 2, 3], "b": [3, 4, 5]})
subset = _safe_indexing(X, slice(0, 2), axis=0)
subset.iloc[0, 0] = 10
```

### Expected Results

No `SettingWithCopyWarning`

### Actual Results

```
/home/marcogorelli/scikit-learn-dev/t.py:13: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  subset.iloc[0, 0] = 10
```

### Versions

```shell
System:
    python: 3.11.11 (main, Dec  4 2024, 08:55:07) [GCC 11.4.0]
executable: /home/marcogorelli/scikit-learn-dev/.venv/bin/python
   machine: Linux-5.15.167.4-microsoft-standard-WSL2-x86_64-with-glibc2.35

Python dependencies:
      sklearn: 1.7.dev0
          pip: 24.2
   setuptools: None
        numpy: 2.1.0
        scipy: 1.14.0
       Cython: 3.0.11
       pandas: 2.2.2
   matplotlib: None
       joblib: 1.4.2
threadpoolctl: 3.5.0

Built with OpenMP: True

threadpoolctl info:
       user_api: blas
   internal_api: openblas
    num_threads: 16
         prefix: libscipy_openblas
       filepath: /home/marcogorelli/scikit-learn-dev/.venv/lib/python3.11/site-packages/numpy.libs/libscipy_openblas64_-ff651d7f.so
        version: 0.3.27
threading_layer: pthreads
   architecture: SkylakeX

       user_api: blas
   internal_api: openblas
    num_threads: 16
         prefix: libscipy_openblas
       filepath: /home/marcogorelli/scikit-learn-dev/.venv/lib/python3.11/site-packages/scipy.libs/libscipy_openblas-c128ec02.so
        version: 0.3.27.dev
threading_layer: pthreads
   architecture: SkylakeX

       user_api: openmp
   internal_api: openmp
    num_threads: 16
         prefix: libgomp
       filepath: /usr/lib/x86_64-linux-gnu/libgomp.so.1.0.0
        version: None
```

COMMENT:
Can I contribute to this issue?

Labels: Bug
`_safe_indexing` triggers `SettingWithCopyWarning` when used with `slice`

### Describe the bug

Here's something I noticed while looking into https://github.com/scikit-learn/scikit-learn/pull/31127

The test
```
pytest sklearn/utils/tests/test_indexing.py::test_safe_indexing_pandas_no_settingwithcopy_warning
```
checks that a copy is produced, and that no `SettingWithCopyWarning` is produced

Indeed, no copy is raised, but why is using `_safe_indexing` with a slice allowed to not make a copy? Is this intentional?

Based on responses, I can suggest what to do instead in https://github.com/scikit-learn/scikit-learn/pull/31127

(I am a little surprised that this always makes copies, given that a lot of the discussion in https://github.com/scikit-learn/scikit-learn/issues/28341 centered around wanting to avoid copies)

### Steps/Code to Reproduce

```python
import numpy as np

from sklearn.utils import _safe_indexing
import pandas as pd

X = pd.DataFrame({"a": [1, 2, 3], "b": [3, 4, 5]})
subset = _safe_indexing(X, slice(0, 2), axis=0)
subset.iloc[0, 0] = 10
```

### Expected Results

No `SettingWithCopyWarning`

### Actual Results

```
/home/marcogorelli/scikit-learn-dev/t.py:13: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  subset.iloc[0, 0] = 10
```

### Versions

```shell
System:
    python: 3.11.11 (main, Dec  4 2024, 08:55:07) [GCC 11.4.0]
executable: /home/marcogorelli/scikit-learn-dev/.venv/bin/python
   machine: Linux-5.15.167.4-microsoft-standard-WSL2-x86_64-with-glibc2.35

Python dependencies:
      sklearn: 1.7.dev0
          pip: 24.2
   setuptools: None
        numpy: 2.1.0
        scipy: 1.14.0
       Cython: 3.0.11
       pandas: 2.2.2
   matplotlib: None
       joblib: 1.4.2
threadpoolctl: 3.5.0

Built with OpenMP: True

threadpoolctl info:
       user_api: blas
   internal_api: openblas
    num_threads: 16
         prefix: libscipy_openblas
       filepath: /home/marcogorelli/scikit-learn-dev/.venv/lib/python3.11/site-packages/numpy.libs/libscipy_openblas64_-ff651d7f.so
        version: 0.3.27
threading_layer: pthreads
   architecture: SkylakeX

       user_api: blas
   internal_api: openblas
    num_threads: 16
         prefix: libscipy_openblas
       filepath: /home/marcogorelli/scikit-learn-dev/.venv/lib/python3.11/site-packages/scipy.libs/libscipy_openblas-c128ec02.so
        version: 0.3.27.dev
threading_layer: pthreads
   architecture: SkylakeX

       user_api: openmp
   internal_api: openmp
    num_threads: 16
         prefix: libgomp
       filepath: /usr/lib/x86_64-linux-gnu/libgomp.so.1.0.0
        version: None
```

COMMENT:
Hmm, yeah it sounds odd to me that the output of `_safe_indexing` would be something we can't modify (i.e. get a warning / error). So to me this is a fix we could do.

Also note https://github.com/scikit-learn/scikit-learn/issues/27439, i.e. it really is treated as public and most probably should be public.

Labels: Bug