Talip7/scikit-learn-issues-multilabel huggingface dataset:
MAINT Directly `cimport` interfaces from `std::algorithm`

Some Cython implementations use interfaces from the standard library of C++, namely `std::algorithm::move` and `std::algorithm::fill` from [`std::algorithm`](https://en.cppreference.com/w/cpp/algorithm/).

Before Cython 3, those interfaces had to be imported directly using the verbose syntax from Cython:
 - https://github.com/scikit-learn/scikit-learn/blob/5fc67aeb092d636895b599921283221a68c7a2ad/sklearn/metrics/_pairwise_distances_reduction/_radius_neighbors.pyx.tp#L22-L26
 - https://github.com/scikit-learn/scikit-learn/blob/5fc67aeb092d636895b599921283221a68c7a2ad/sklearn/metrics/_pairwise_distances_reduction/_middle_term_computer.pyx.tp#L28-L33

Cython 3 introduced the following line natively, for those interfaces. Those interfaces should now be `cimported` directly. That is one can replace the line shown above respectively with:

```cython
from libcpp.algorithm cimport move
from libcpp.algorithm cimport fill
```

I believe this is a good first Cython issue.

Any reader should feel free to pick it up. It might be possible that there is some context missing.

Please let me know if you need help. :slightly_smiling_face:

COMMENT:
I have made a PR https://github.com/scikit-learn/scikit-learn/pull/27699
I hope that is ok, this is my first PR so I apologise for any errors. Any feedback welcome

Labels: good first issue, cython
MAINT Directly `cimport` interfaces from `std::algorithm`

Some Cython implementations use interfaces from the standard library of C++, namely `std::algorithm::move` and `std::algorithm::fill` from [`std::algorithm`](https://en.cppreference.com/w/cpp/algorithm/).

Before Cython 3, those interfaces had to be imported directly using the verbose syntax from Cython:
 - https://github.com/scikit-learn/scikit-learn/blob/5fc67aeb092d636895b599921283221a68c7a2ad/sklearn/metrics/_pairwise_distances_reduction/_radius_neighbors.pyx.tp#L22-L26
 - https://github.com/scikit-learn/scikit-learn/blob/5fc67aeb092d636895b599921283221a68c7a2ad/sklearn/metrics/_pairwise_distances_reduction/_middle_term_computer.pyx.tp#L28-L33

Cython 3 introduced the following line natively, for those interfaces. Those interfaces should now be `cimported` directly. That is one can replace the line shown above respectively with:

```cython
from libcpp.algorithm cimport move
from libcpp.algorithm cimport fill
```

I believe this is a good first Cython issue.

Any reader should feel free to pick it up. It might be possible that there is some context missing.

Please let me know if you need help. :slightly_smiling_face:

COMMENT:
Oh, I missed that. I thought we updated to Cython 3.X after the regressions were fixed.

I think maintaining code for Cython 0.29.X and Cython 3.X is costly. Since those maintainable changes aren't strictly required. I think we should wait for Cython 3.X to be used by default everywhere.

What do you think?

Labels: good first issue, cython
MAINT Directly `cimport` interfaces from `std::algorithm`

Some Cython implementations use interfaces from the standard library of C++, namely `std::algorithm::move` and `std::algorithm::fill` from [`std::algorithm`](https://en.cppreference.com/w/cpp/algorithm/).

Before Cython 3, those interfaces had to be imported directly using the verbose syntax from Cython:
 - https://github.com/scikit-learn/scikit-learn/blob/5fc67aeb092d636895b599921283221a68c7a2ad/sklearn/metrics/_pairwise_distances_reduction/_radius_neighbors.pyx.tp#L22-L26
 - https://github.com/scikit-learn/scikit-learn/blob/5fc67aeb092d636895b599921283221a68c7a2ad/sklearn/metrics/_pairwise_distances_reduction/_middle_term_computer.pyx.tp#L28-L33

Cython 3 introduced the following line natively, for those interfaces. Those interfaces should now be `cimported` directly. That is one can replace the line shown above respectively with:

```cython
from libcpp.algorithm cimport move
from libcpp.algorithm cimport fill
```

I believe this is a good first Cython issue.

Any reader should feel free to pick it up. It might be possible that there is some context missing.

Please let me know if you need help. :slightly_smiling_face:

COMMENT:
Is there a reason to support more than one version of cython? I think the cython dependency is different from Numpy or scipy in that the choice of cython version doesn't impact users. Whether you can install a particular version of scikit-learn or not does not depend on the version of cython. (Maybe this is not quite true for those who build scikit-learn from source)

The current minimum version of 0.29.x is the previous "major release" of cython, basically like 3.x now. 

This makes me think we should only support one version and that in the past we've also only supported one version.

If there are problems with cython 3 (say the performance regressions come back) then we will have to implement a fix, but that is life.

Labels: good first issue, cython
MAINT Directly `cimport` interfaces from `std::algorithm`

Some Cython implementations use interfaces from the standard library of C++, namely `std::algorithm::move` and `std::algorithm::fill` from [`std::algorithm`](https://en.cppreference.com/w/cpp/algorithm/).

Before Cython 3, those interfaces had to be imported directly using the verbose syntax from Cython:
 - https://github.com/scikit-learn/scikit-learn/blob/5fc67aeb092d636895b599921283221a68c7a2ad/sklearn/metrics/_pairwise_distances_reduction/_radius_neighbors.pyx.tp#L22-L26
 - https://github.com/scikit-learn/scikit-learn/blob/5fc67aeb092d636895b599921283221a68c7a2ad/sklearn/metrics/_pairwise_distances_reduction/_middle_term_computer.pyx.tp#L28-L33

Cython 3 introduced the following line natively, for those interfaces. Those interfaces should now be `cimported` directly. That is one can replace the line shown above respectively with:

```cython
from libcpp.algorithm cimport move
from libcpp.algorithm cimport fill
```

I believe this is a good first Cython issue.

Any reader should feel free to pick it up. It might be possible that there is some context missing.

Please let me know if you need help. :slightly_smiling_face:

COMMENT:
> Is there a reason to support more than one version of cython? I think the cython dependency is different from Numpy or scipy in that the choice of cython version doesn't impact users. Whether you can install a particular version of scikit-learn or not does not depend on the version of cython. (Maybe this is not quite true for those who build scikit-learn from source)

I agree with your analysis. I also do not think there's a reason to support multiple major versions of Cython.

> This makes me think we should only support one version and that in the past we've also only supported one version.

I also think we only must support one version of Cython, but we are not pressured to. I am not sure whether all the bugs fixes of Cython 3.X.X will be backported to Cython 0.29.X.

For instance, https://github.com/cython/cython/issues/5230 (which was originally met in scikit-learn) just got addressed, but I wonder whether its solution (https://github.com/cython/cython/pull/5233) will be ported to 0.29.X (I am invoking @da-woods to know more about Cython's policy :pray:).

I think the upgrade to Cython 3 must be considered with the release of NumPy 2. To me, this necessitates a comprehensive understanding of the changes for the compilation.

Labels: good first issue, cython
MAINT Directly `cimport` interfaces from `std::algorithm`

Some Cython implementations use interfaces from the standard library of C++, namely `std::algorithm::move` and `std::algorithm::fill` from [`std::algorithm`](https://en.cppreference.com/w/cpp/algorithm/).

Before Cython 3, those interfaces had to be imported directly using the verbose syntax from Cython:
 - https://github.com/scikit-learn/scikit-learn/blob/5fc67aeb092d636895b599921283221a68c7a2ad/sklearn/metrics/_pairwise_distances_reduction/_radius_neighbors.pyx.tp#L22-L26
 - https://github.com/scikit-learn/scikit-learn/blob/5fc67aeb092d636895b599921283221a68c7a2ad/sklearn/metrics/_pairwise_distances_reduction/_middle_term_computer.pyx.tp#L28-L33

Cython 3 introduced the following line natively, for those interfaces. Those interfaces should now be `cimported` directly. That is one can replace the line shown above respectively with:

```cython
from libcpp.algorithm cimport move
from libcpp.algorithm cimport fill
```

I believe this is a good first Cython issue.

Any reader should feel free to pick it up. It might be possible that there is some context missing.

Please let me know if you need help. :slightly_smiling_face:

COMMENT:
Given the remark of the current development of Cython given in https://github.com/cython/cython/pull/5233#issuecomment-1862890612, I am in favor of now using Cython 3 and I think we should update scikit-learns' build system accordingly.

What do you think?

Labels: good first issue, cython
MAINT Directly `cimport` interfaces from `std::algorithm`

Some Cython implementations use interfaces from the standard library of C++, namely `std::algorithm::move` and `std::algorithm::fill` from [`std::algorithm`](https://en.cppreference.com/w/cpp/algorithm/).

Before Cython 3, those interfaces had to be imported directly using the verbose syntax from Cython:
 - https://github.com/scikit-learn/scikit-learn/blob/5fc67aeb092d636895b599921283221a68c7a2ad/sklearn/metrics/_pairwise_distances_reduction/_radius_neighbors.pyx.tp#L22-L26
 - https://github.com/scikit-learn/scikit-learn/blob/5fc67aeb092d636895b599921283221a68c7a2ad/sklearn/metrics/_pairwise_distances_reduction/_middle_term_computer.pyx.tp#L28-L33

Cython 3 introduced the following line natively, for those interfaces. Those interfaces should now be `cimported` directly. That is one can replace the line shown above respectively with:

```cython
from libcpp.algorithm cimport move
from libcpp.algorithm cimport fill
```

I believe this is a good first Cython issue.

Any reader should feel free to pick it up. It might be possible that there is some context missing.

Please let me know if you need help. :slightly_smiling_face:

COMMENT:
I would say, open a PR bumping the minimum cython version and see what happens?

Quickly looking at numpy and scipy, they require Cython 3 on `main` but not on their latest release (see https://github.com/numpy/numpy/blob/aa78349ca935d58d2903af3db278858613ee8910/pyproject.toml#L5 and https://github.com/scipy/scipy/blob/60de9b912acef5ba794de177416d6fb7d29486e6/pyproject.toml#L14), so I think it's fine for scikit-learn to do the same.

Side-comment: we are using Cython 3 already but we also make sure that our code compiles with Cython 0.29.33.

Labels: good first issue, cython
MAINT Directly `cimport` interfaces from `std::algorithm`

Some Cython implementations use interfaces from the standard library of C++, namely `std::algorithm::move` and `std::algorithm::fill` from [`std::algorithm`](https://en.cppreference.com/w/cpp/algorithm/).

Before Cython 3, those interfaces had to be imported directly using the verbose syntax from Cython:
 - https://github.com/scikit-learn/scikit-learn/blob/5fc67aeb092d636895b599921283221a68c7a2ad/sklearn/metrics/_pairwise_distances_reduction/_radius_neighbors.pyx.tp#L22-L26
 - https://github.com/scikit-learn/scikit-learn/blob/5fc67aeb092d636895b599921283221a68c7a2ad/sklearn/metrics/_pairwise_distances_reduction/_middle_term_computer.pyx.tp#L28-L33

Cython 3 introduced the following line natively, for those interfaces. Those interfaces should now be `cimported` directly. That is one can replace the line shown above respectively with:

```cython
from libcpp.algorithm cimport move
from libcpp.algorithm cimport fill
```

I believe this is a good first Cython issue.

Any reader should feel free to pick it up. It might be possible that there is some context missing.

Please let me know if you need help. :slightly_smiling_face:

COMMENT:
@Lambxx: are you interested in upgrading scikit-learn to use Cython 3 at minimum?

Labels: good first issue, cython
MAINT Directly `cimport` interfaces from `std::algorithm`

Some Cython implementations use interfaces from the standard library of C++, namely `std::algorithm::move` and `std::algorithm::fill` from [`std::algorithm`](https://en.cppreference.com/w/cpp/algorithm/).

Before Cython 3, those interfaces had to be imported directly using the verbose syntax from Cython:
 - https://github.com/scikit-learn/scikit-learn/blob/5fc67aeb092d636895b599921283221a68c7a2ad/sklearn/metrics/_pairwise_distances_reduction/_radius_neighbors.pyx.tp#L22-L26
 - https://github.com/scikit-learn/scikit-learn/blob/5fc67aeb092d636895b599921283221a68c7a2ad/sklearn/metrics/_pairwise_distances_reduction/_middle_term_computer.pyx.tp#L28-L33

Cython 3 introduced the following line natively, for those interfaces. Those interfaces should now be `cimported` directly. That is one can replace the line shown above respectively with:

```cython
from libcpp.algorithm cimport move
from libcpp.algorithm cimport fill
```

I believe this is a good first Cython issue.

Any reader should feel free to pick it up. It might be possible that there is some context missing.

Please let me know if you need help. :slightly_smiling_face:

COMMENT:
I opened #28259 to gather feed-back on updating Cython minimum supported version to 3.0.8

Labels: good first issue, cython
MAINT Directly `cimport` interfaces from `std::algorithm`

Some Cython implementations use interfaces from the standard library of C++, namely `std::algorithm::move` and `std::algorithm::fill` from [`std::algorithm`](https://en.cppreference.com/w/cpp/algorithm/).

Before Cython 3, those interfaces had to be imported directly using the verbose syntax from Cython:
 - https://github.com/scikit-learn/scikit-learn/blob/5fc67aeb092d636895b599921283221a68c7a2ad/sklearn/metrics/_pairwise_distances_reduction/_radius_neighbors.pyx.tp#L22-L26
 - https://github.com/scikit-learn/scikit-learn/blob/5fc67aeb092d636895b599921283221a68c7a2ad/sklearn/metrics/_pairwise_distances_reduction/_middle_term_computer.pyx.tp#L28-L33

Cython 3 introduced the following line natively, for those interfaces. Those interfaces should now be `cimported` directly. That is one can replace the line shown above respectively with:

```cython
from libcpp.algorithm cimport move
from libcpp.algorithm cimport fill
```

I believe this is a good first Cython issue.

Any reader should feel free to pick it up. It might be possible that there is some context missing.

Please let me know if you need help. :slightly_smiling_face:

COMMENT:
@jjerphan I'm a first-timer and would also like to contribute to this issue. Is the issue regarding upgrading sklearn to use Cython 3 still open?

Labels: good first issue, cython
MAINT Directly `cimport` interfaces from `std::algorithm`

Some Cython implementations use interfaces from the standard library of C++, namely `std::algorithm::move` and `std::algorithm::fill` from [`std::algorithm`](https://en.cppreference.com/w/cpp/algorithm/).

Before Cython 3, those interfaces had to be imported directly using the verbose syntax from Cython:
 - https://github.com/scikit-learn/scikit-learn/blob/5fc67aeb092d636895b599921283221a68c7a2ad/sklearn/metrics/_pairwise_distances_reduction/_radius_neighbors.pyx.tp#L22-L26
 - https://github.com/scikit-learn/scikit-learn/blob/5fc67aeb092d636895b599921283221a68c7a2ad/sklearn/metrics/_pairwise_distances_reduction/_middle_term_computer.pyx.tp#L28-L33

Cython 3 introduced the following line natively, for those interfaces. Those interfaces should now be `cimported` directly. That is one can replace the line shown above respectively with:

```cython
from libcpp.algorithm cimport move
from libcpp.algorithm cimport fill
```

I believe this is a good first Cython issue.

Any reader should feel free to pick it up. It might be possible that there is some context missing.

Please let me know if you need help. :slightly_smiling_face:

COMMENT:
Hi @jatindyerawadekar,

Good to know that you are interested. Unfortunately this is already being addressed by https://github.com/scikit-learn/scikit-learn/pull/28284. I would recommend looking at the "good first issue" label in the issue tracker.

Labels: good first issue, cython
MAINT Directly `cimport` interfaces from `std::algorithm`

Some Cython implementations use interfaces from the standard library of C++, namely `std::algorithm::move` and `std::algorithm::fill` from [`std::algorithm`](https://en.cppreference.com/w/cpp/algorithm/).

Before Cython 3, those interfaces had to be imported directly using the verbose syntax from Cython:
 - https://github.com/scikit-learn/scikit-learn/blob/5fc67aeb092d636895b599921283221a68c7a2ad/sklearn/metrics/_pairwise_distances_reduction/_radius_neighbors.pyx.tp#L22-L26
 - https://github.com/scikit-learn/scikit-learn/blob/5fc67aeb092d636895b599921283221a68c7a2ad/sklearn/metrics/_pairwise_distances_reduction/_middle_term_computer.pyx.tp#L28-L33

Cython 3 introduced the following line natively, for those interfaces. Those interfaces should now be `cimported` directly. That is one can replace the line shown above respectively with:

```cython
from libcpp.algorithm cimport move
from libcpp.algorithm cimport fill
```

I believe this is a good first Cython issue.

Any reader should feel free to pick it up. It might be possible that there is some context missing.

Please let me know if you need help. :slightly_smiling_face:

COMMENT:
FYI We're now using cython=3.0.8 on the `main` branch, this work can now start.

Labels: good first issue, cython
MAINT Directly `cimport` interfaces from `std::algorithm`

Some Cython implementations use interfaces from the standard library of C++, namely `std::algorithm::move` and `std::algorithm::fill` from [`std::algorithm`](https://en.cppreference.com/w/cpp/algorithm/).

Before Cython 3, those interfaces had to be imported directly using the verbose syntax from Cython:
 - https://github.com/scikit-learn/scikit-learn/blob/5fc67aeb092d636895b599921283221a68c7a2ad/sklearn/metrics/_pairwise_distances_reduction/_radius_neighbors.pyx.tp#L22-L26
 - https://github.com/scikit-learn/scikit-learn/blob/5fc67aeb092d636895b599921283221a68c7a2ad/sklearn/metrics/_pairwise_distances_reduction/_middle_term_computer.pyx.tp#L28-L33

Cython 3 introduced the following line natively, for those interfaces. Those interfaces should now be `cimported` directly. That is one can replace the line shown above respectively with:

```cython
from libcpp.algorithm cimport move
from libcpp.algorithm cimport fill
```

I believe this is a good first Cython issue.

Any reader should feel free to pick it up. It might be possible that there is some context missing.

Please let me know if you need help. :slightly_smiling_face:

COMMENT:
This work was started with https://github.com/scikit-learn/scikit-learn/pull/27699, please do coordinate with @Lambxx.

Labels: good first issue, cython
MAINT Directly `cimport` interfaces from `std::algorithm`

Some Cython implementations use interfaces from the standard library of C++, namely `std::algorithm::move` and `std::algorithm::fill` from [`std::algorithm`](https://en.cppreference.com/w/cpp/algorithm/).

Before Cython 3, those interfaces had to be imported directly using the verbose syntax from Cython:
 - https://github.com/scikit-learn/scikit-learn/blob/5fc67aeb092d636895b599921283221a68c7a2ad/sklearn/metrics/_pairwise_distances_reduction/_radius_neighbors.pyx.tp#L22-L26
 - https://github.com/scikit-learn/scikit-learn/blob/5fc67aeb092d636895b599921283221a68c7a2ad/sklearn/metrics/_pairwise_distances_reduction/_middle_term_computer.pyx.tp#L28-L33

Cython 3 introduced the following line natively, for those interfaces. Those interfaces should now be `cimported` directly. That is one can replace the line shown above respectively with:

```cython
from libcpp.algorithm cimport move
from libcpp.algorithm cimport fill
```

I believe this is a good first Cython issue.

Any reader should feel free to pick it up. It might be possible that there is some context missing.

Please let me know if you need help. :slightly_smiling_face:

COMMENT:
@Lambxx I'm now continuing work on #26032 and saw this was still not merged. Are you interested in continuing the work?, or I can submit a quick PR to patch the code very quickly?

Otherwise, I'm also happy to review it if you submit a revised PR

Labels: good first issue, cython
NSE Equation used for R2

https://github.com/scikit-learn/scikit-learn/blame/093e0cf14aff026cca6097e8c42f83b735d26358/sklearn/metrics/_regression.py#L830-L838

The equation used for the R2 score is rather that of the [Nash–Sutcliffe model efficiency coefficient (NSE)](https://en.wikipedia.org/wiki/Nash%E2%80%93Sutcliffe_model_efficiency_coefficient) by [Nash & Sutcliffe (1970)](https://doi.org/10.1016/0022-1694(70)90255-6).

Reference:
- Nash, J.E., Sutcliffe, J.V., 1970. River flow forecasting through conceptual models part
      I — A discussion of principles. Journal of Hydrology 282-290.

COMMENT:
I opened an issue [here](https://github.com/BYU-Hydroinformatics/HydroErr/issues/10#issue-1966399945) where I compared a similar package for model evaluation. After digging into the source codes from both packages, I believe SKLearn's formula for r2 rather conforms to the NSE.

Labels: Needs Triage
NSE Equation used for R2

https://github.com/scikit-learn/scikit-learn/blame/093e0cf14aff026cca6097e8c42f83b735d26358/sklearn/metrics/_regression.py#L830-L838

The equation used for the R2 score is rather that of the [Nash–Sutcliffe model efficiency coefficient (NSE)](https://en.wikipedia.org/wiki/Nash%E2%80%93Sutcliffe_model_efficiency_coefficient) by [Nash & Sutcliffe (1970)](https://doi.org/10.1016/0022-1694(70)90255-6).

Reference:
- Nash, J.E., Sutcliffe, J.V., 1970. River flow forecasting through conceptual models part
      I — A discussion of principles. Journal of Hydrology 282-290.

COMMENT:
The definition is documented there: https://scikit-learn.org/stable/modules/model_evaluation.html#r2-score

Labels: Needs Triage
Callback API plan

The goal of this issue is to track the steps of the implementation of a callback API in scikit-learn.

This is being developed in the `callbacks` feature branch. The first PR to this branch is https://github.com/scikit-learn/scikit-learn/pull/27663 which implements the base infrastructure for the callbacks and a first callback (progress bars). Subsequent PRs will add more callbacks, mode doc, more tests, adapt estimators to support callbacks, ...

- [ ] Base infrastructure https://github.com/scikit-learn/scikit-learn/pull/27663

**Callbacks**
- [ ] Progress bars https://github.com/scikit-learn/scikit-learn/pull/27663
- [ ] Monitoring
- [ ] EarlyStopping
- [ ] Snapshots
- [ ] Verbose / Logging

**Doc**
- [ ] examples
- [ ] how to write a custom callback

**Adapt estimators**
*full list incoming*

COMMENT:
As callbacks affect all estimators and add to the API, a SLEP would not be wrong.

Labels: Meta-issue
Callback API plan

The goal of this issue is to track the steps of the implementation of a callback API in scikit-learn.

This is being developed in the `callbacks` feature branch. The first PR to this branch is https://github.com/scikit-learn/scikit-learn/pull/27663 which implements the base infrastructure for the callbacks and a first callback (progress bars). Subsequent PRs will add more callbacks, mode doc, more tests, adapt estimators to support callbacks, ...

- [ ] Base infrastructure https://github.com/scikit-learn/scikit-learn/pull/27663

**Callbacks**
- [ ] Progress bars https://github.com/scikit-learn/scikit-learn/pull/27663
- [ ] Monitoring
- [ ] EarlyStopping
- [ ] Snapshots
- [ ] Verbose / Logging

**Doc**
- [ ] examples
- [ ] how to write a custom callback

**Adapt estimators**
*full list incoming*

COMMENT:
@glemaitre meant that [one such callback could be a gradient tape](https://github.com/scikit-learn/scikit-learn/discussions/27465). I would currently need that (and might even be able to help implementing it).

Labels: Meta-issue