Talip7/scikit-learn-issues-multilabel huggingface dataset:
Anaconda new ToS causing CI failures

New Anaconda ToS: https://www.anaconda.com/legal/terms/terms-of-service , effective 15 July 2025, is causing the follow error in our CIs:

```
CondaToSNonInteractiveError: Terms of Service have not been accepted for the following channels. Please accept or remove them before proceeding:
    • https://repo.anaconda.com/pkgs/main
    • https://repo.anaconda.com/pkgs/r

To accept a channel's Terms of Service, run the following and replace `CHANNEL` with the channel name/URL:
    ‣ conda tos accept --override-channels --channel CHANNEL

To remove channels with rejected Terms of Service, run the following and replace `CHANNEL` with the channel name/URL:
    ‣ conda config --remove channels CHANNEL
```

We can use [`conda-anaconda-tos`](https://www.anaconda.com/docs/getting-started/tos-plugin) or potentially switch to miniforge ?

@scikit-learn/core-devs @scikit-learn/communication-team @scikit-learn/documentation-team 

(Of interest here is corresponding issue in pytorch https://github.com/pytorch/pytorch/issues/158438)

COMMENT:
I had this issue yesterday in Azure DevOps Pipelines, and I ran it again today and it worked normally. 

I now see notices about accepting TOS during install.... 

`CI detected...
By accessing https://repo.anaconda.com/pkgs/main via CI for this repository you
acknowledge and agree to the Terms of Service:
ANACONDA TERMS OF SERVICE
Effective Date: July 15, 2025
[..]
`

Labels: High Priority
Anaconda new ToS causing CI failures

New Anaconda ToS: https://www.anaconda.com/legal/terms/terms-of-service , effective 15 July 2025, is causing the follow error in our CIs:

```
CondaToSNonInteractiveError: Terms of Service have not been accepted for the following channels. Please accept or remove them before proceeding:
    • https://repo.anaconda.com/pkgs/main
    • https://repo.anaconda.com/pkgs/r

To accept a channel's Terms of Service, run the following and replace `CHANNEL` with the channel name/URL:
    ‣ conda tos accept --override-channels --channel CHANNEL

To remove channels with rejected Terms of Service, run the following and replace `CHANNEL` with the channel name/URL:
    ‣ conda config --remove channels CHANNEL
```

We can use [`conda-anaconda-tos`](https://www.anaconda.com/docs/getting-started/tos-plugin) or potentially switch to miniforge ?

@scikit-learn/core-devs @scikit-learn/communication-team @scikit-learn/documentation-team 

(Of interest here is corresponding issue in pytorch https://github.com/pytorch/pytorch/issues/158438)

COMMENT:
> Miniforge isn't affected by this, since the conda-anaconda-tos packages isn't installed with it, wondering if there is some overlap between Azure's conda that is installed by default and the Miniforge you tried.

Understood, but I could not make miniforge work for my Windows tests, so I reverted to the Miniconda 25.5.1 preinstalled on the Azure images.

Labels: High Priority
Anaconda new ToS causing CI failures

New Anaconda ToS: https://www.anaconda.com/legal/terms/terms-of-service , effective 15 July 2025, is causing the follow error in our CIs:

```
CondaToSNonInteractiveError: Terms of Service have not been accepted for the following channels. Please accept or remove them before proceeding:
    • https://repo.anaconda.com/pkgs/main
    • https://repo.anaconda.com/pkgs/r

To accept a channel's Terms of Service, run the following and replace `CHANNEL` with the channel name/URL:
    ‣ conda tos accept --override-channels --channel CHANNEL

To remove channels with rejected Terms of Service, run the following and replace `CHANNEL` with the channel name/URL:
    ‣ conda config --remove channels CHANNEL
```

We can use [`conda-anaconda-tos`](https://www.anaconda.com/docs/getting-started/tos-plugin) or potentially switch to miniforge ?

@scikit-learn/core-devs @scikit-learn/communication-team @scikit-learn/documentation-team 

(Of interest here is corresponding issue in pytorch https://github.com/pytorch/pytorch/issues/158438)

COMMENT:
@jezdez: Since I have your attention, the failing version says
```
To remove channels with rejected Terms of Service, run the following and replace `CHANNEL` with the channel name/URL:
    ‣ conda config --remove channels CHANNEL
```
but
```shell
conda config --remove channels main
conda config --remove channels r
```
fails with
```output
CondaKeyError: 'channels': value 'main' not present in config
CondaKeyError: 'channels': value 'r' not present in config
```
and 
```shell
conda config --remove channels defaults
```
just doesn't work. I cannot figure out how to remove `defaults` from the Azure images.

Labels: High Priority
Anaconda new ToS causing CI failures

New Anaconda ToS: https://www.anaconda.com/legal/terms/terms-of-service , effective 15 July 2025, is causing the follow error in our CIs:

```
CondaToSNonInteractiveError: Terms of Service have not been accepted for the following channels. Please accept or remove them before proceeding:
    • https://repo.anaconda.com/pkgs/main
    • https://repo.anaconda.com/pkgs/r

To accept a channel's Terms of Service, run the following and replace `CHANNEL` with the channel name/URL:
    ‣ conda tos accept --override-channels --channel CHANNEL

To remove channels with rejected Terms of Service, run the following and replace `CHANNEL` with the channel name/URL:
    ‣ conda config --remove channels CHANNEL
```

We can use [`conda-anaconda-tos`](https://www.anaconda.com/docs/getting-started/tos-plugin) or potentially switch to miniforge ?

@scikit-learn/core-devs @scikit-learn/communication-team @scikit-learn/documentation-team 

(Of interest here is corresponding issue in pytorch https://github.com/pytorch/pytorch/issues/158438)

COMMENT:
@guyer That's interesting; I've asked internally what's going on with that. Thanks for posting. BTW, in case you have feedback, we also have an issue tracker on https://github.com/anaconda/conda-anaconda-tos (for future reference).

Labels: High Priority
Anaconda new ToS causing CI failures

New Anaconda ToS: https://www.anaconda.com/legal/terms/terms-of-service , effective 15 July 2025, is causing the follow error in our CIs:

```
CondaToSNonInteractiveError: Terms of Service have not been accepted for the following channels. Please accept or remove them before proceeding:
    • https://repo.anaconda.com/pkgs/main
    • https://repo.anaconda.com/pkgs/r

To accept a channel's Terms of Service, run the following and replace `CHANNEL` with the channel name/URL:
    ‣ conda tos accept --override-channels --channel CHANNEL

To remove channels with rejected Terms of Service, run the following and replace `CHANNEL` with the channel name/URL:
    ‣ conda config --remove channels CHANNEL
```

We can use [`conda-anaconda-tos`](https://www.anaconda.com/docs/getting-started/tos-plugin) or potentially switch to miniforge ?

@scikit-learn/core-devs @scikit-learn/communication-team @scikit-learn/documentation-team 

(Of interest here is corresponding issue in pytorch https://github.com/pytorch/pytorch/issues/158438)

COMMENT:
> I had this issue yesterday in Azure DevOps Pipelines, and I ran it again today and it worked normally.
> 
> I now see notices about accepting TOS during install....
> 
> `CI detected... By accessing https://repo.anaconda.com/pkgs/main via CI for this repository you acknowledge and agree to the Terms of Service: ANACONDA TERMS OF SERVICE Effective Date: July 15, 2025 [..] `

That's what should have happened automatically to have a smooth experience and we tried to anticipate CI systems in https://github.com/anaconda/conda-anaconda-tos/issues/48, sadly we were wrong and missed a few, fixed in https://github.com/anaconda/conda-anaconda-tos/issues/231

Labels: High Priority
Anaconda new ToS causing CI failures

New Anaconda ToS: https://www.anaconda.com/legal/terms/terms-of-service , effective 15 July 2025, is causing the follow error in our CIs:

```
CondaToSNonInteractiveError: Terms of Service have not been accepted for the following channels. Please accept or remove them before proceeding:
    • https://repo.anaconda.com/pkgs/main
    • https://repo.anaconda.com/pkgs/r

To accept a channel's Terms of Service, run the following and replace `CHANNEL` with the channel name/URL:
    ‣ conda tos accept --override-channels --channel CHANNEL

To remove channels with rejected Terms of Service, run the following and replace `CHANNEL` with the channel name/URL:
    ‣ conda config --remove channels CHANNEL
```

We can use [`conda-anaconda-tos`](https://www.anaconda.com/docs/getting-started/tos-plugin) or potentially switch to miniforge ?

@scikit-learn/core-devs @scikit-learn/communication-team @scikit-learn/documentation-team 

(Of interest here is corresponding issue in pytorch https://github.com/pytorch/pytorch/issues/158438)

COMMENT:
> Thanks for posting. BTW, in case you have feedback, we also have an issue tracker on https://github.com/anaconda/conda-anaconda-tos (for future reference).

Thanks, I'll post any followup there.

Labels: High Priority
y_pred changed to y_true in RocCurveDisplay.from_predictions, but not in DetCurveDisplay.from_predictions

The parameter `y_pred` was deprecated in `RocCurveDisplay.from_predictions` and replaced by `y_score`. Although the  `y_pred` parameter in `DetCurveDisplay.from_predictions`  has an identical docstring (except for details about the name change), it was not renamed. 

It seems to me that both signatures should match in that regard.

I'm not sure if it applies to other binary display parameters, but this relates to https://github.com/scikit-learn/scikit-learn/issues/30717.

COMMENT:
Hey @dprov I have raised a PR to fix this

Labels: API
y_pred changed to y_true in RocCurveDisplay.from_predictions, but not in DetCurveDisplay.from_predictions

The parameter `y_pred` was deprecated in `RocCurveDisplay.from_predictions` and replaced by `y_score`. Although the  `y_pred` parameter in `DetCurveDisplay.from_predictions`  has an identical docstring (except for details about the name change), it was not renamed. 

It seems to me that both signatures should match in that regard.

I'm not sure if it applies to other binary display parameters, but this relates to https://github.com/scikit-learn/scikit-learn/issues/30717.

COMMENT:
Thanks for the report @dprov. It was done for `RocCurveDisplay` because there was an inconsistency between `RocCurveDisplay.from_predictions` and the function `roc_curve`, see https://github.com/scikit-learn/scikit-learn/issues/29823. `DetCurveDisplay` has the same inconsistency so I agree that we should change it. Looking at other displays for binary classif, I found that `PrecisionRecallDisplay` is also inconsistent.

Labels: API
y_pred changed to y_true in RocCurveDisplay.from_predictions, but not in DetCurveDisplay.from_predictions

The parameter `y_pred` was deprecated in `RocCurveDisplay.from_predictions` and replaced by `y_score`. Although the  `y_pred` parameter in `DetCurveDisplay.from_predictions`  has an identical docstring (except for details about the name change), it was not renamed. 

It seems to me that both signatures should match in that regard.

I'm not sure if it applies to other binary display parameters, but this relates to https://github.com/scikit-learn/scikit-learn/issues/30717.

COMMENT:
Hi @jeremiedbb , I did see that `PrecisionRecallDisplay ` had that inconsistency as well. However because the docstring mentioned only estimated probabilities - contrary to `RocCurveDisplay` and `DetCurveDisplay ` who mention non-thresholded measure of decisions - I thought it made snese to keep it like that. Please let me know if it something I should add to my PR.

Labels: API
y_pred changed to y_true in RocCurveDisplay.from_predictions, but not in DetCurveDisplay.from_predictions

The parameter `y_pred` was deprecated in `RocCurveDisplay.from_predictions` and replaced by `y_score`. Although the  `y_pred` parameter in `DetCurveDisplay.from_predictions`  has an identical docstring (except for details about the name change), it was not renamed. 

It seems to me that both signatures should match in that regard.

I'm not sure if it applies to other binary display parameters, but this relates to https://github.com/scikit-learn/scikit-learn/issues/30717.

COMMENT:
@luiser1401, ``PrecisionRecallDisplay`` mentions "Estimated probabilities or output of decision function." and `precision_recall_curve` has a `y_score` parameter so we should make it consistent as well. It can be done in your existing PR or a separate one, as you prefer.

Labels: API
y_pred changed to y_true in RocCurveDisplay.from_predictions, but not in DetCurveDisplay.from_predictions

The parameter `y_pred` was deprecated in `RocCurveDisplay.from_predictions` and replaced by `y_score`. Although the  `y_pred` parameter in `DetCurveDisplay.from_predictions`  has an identical docstring (except for details about the name change), it was not renamed. 

It seems to me that both signatures should match in that regard.

I'm not sure if it applies to other binary display parameters, but this relates to https://github.com/scikit-learn/scikit-learn/issues/30717.

COMMENT:
@jeremiedbb will do it in the existing PR

Labels: API
y_pred changed to y_true in RocCurveDisplay.from_predictions, but not in DetCurveDisplay.from_predictions

The parameter `y_pred` was deprecated in `RocCurveDisplay.from_predictions` and replaced by `y_score`. Although the  `y_pred` parameter in `DetCurveDisplay.from_predictions`  has an identical docstring (except for details about the name change), it was not renamed. 

It seems to me that both signatures should match in that regard.

I'm not sure if it applies to other binary display parameters, but this relates to https://github.com/scikit-learn/scikit-learn/issues/30717.

COMMENT:
@jeremiedbb all done now, could you review my PR please? #31764

Labels: API
In Balltree, filter out/mask specific points in query

### Describe the workflow you want to enable

I would like to be able to query nearest points within a Balltree but excluding some of them.
E.g. I create a Balltree on 60k points. I want to find the k nearest neighbour points but within a subset of the 60k points. 
Example case: I have N clusters of points. I build a Balltree with all the points of the N clusters (e.g. 60k points). Then I want to find for each of the points of a given cluster the closest point from the other clusters (i.e. excluding itself).

### Describe your proposed solution

 I would like to pass an extra mask argument (e.g. array of 60k elements) to the query with True for the points in the other clusters and False for the points in the specific cluster.

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

_No response_

### Additional context

_No response_

COMMENT:
Hi @sdementen,

I'm not sure I understand precisely what you're asking. Please provide code or pseudo-code and/or concrete example of the kind of result you expect.

The `query` method of BallTree returns the indices (and distances) of the k nearest neighbors for each data point:
```py
import numpy as np
from sklearn.neighbors import BallTree

X = np.random.RandomState(0).random_sample((10, 3))
tree = BallTree(X, leaf_size=2)
dist, ind = tree.query(X, k=3)
print(ind)
[[0 3 1]
 [1 7 0]
 [2 6 0]
 [3 0 1]
 [4 3 8]
 [5 1 7]
 [6 2 7]
 [7 1 0]
 [8 3 4]
 [9 7 1]]
```
Each row gives the indices of the 3 closest neighbors to that point, the first one always being the point itself. If you want to exclude the point itself, just mask the indices array:
```
print(ind[:,1:]
[[3 1]
 [7 0]
 [6 0]
 [0 1]
 [3 8]
 [1 7]
 [2 7]
 [1 0]
 [3 4]
 [7 1]]
```
But maybe I'm missing your point.

Labels: New Feature
In Balltree, filter out/mask specific points in query

### Describe the workflow you want to enable

I would like to be able to query nearest points within a Balltree but excluding some of them.
E.g. I create a Balltree on 60k points. I want to find the k nearest neighbour points but within a subset of the 60k points. 
Example case: I have N clusters of points. I build a Balltree with all the points of the N clusters (e.g. 60k points). Then I want to find for each of the points of a given cluster the closest point from the other clusters (i.e. excluding itself).

### Describe your proposed solution

 I would like to pass an extra mask argument (e.g. array of 60k elements) to the query with True for the points in the other clusters and False for the points in the specific cluster.

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

_No response_

### Additional context

_No response_

COMMENT:
Sorry for not being clear, here is the example:
```python
import numpy as np
from sklearn.neighbors import BallTree

N_groups = 10
N_points_per_group = 5
D = 3

# create N_groups centers
X = np.random.RandomState(0).random_sample((N_groups, D))

# create per group, N_points_per_group points around each center by adding a small random perturbation
X = X[:,np.newaxis,:] + np.random.RandomState(0).random_sample((N_groups,N_points_per_group, D))*.05

# create a BallTree from all the points of all the groups
tree = BallTree(X.reshape((-1,D)))

# for each group, I want to find the closest point in the BallTree that is not in the group itself
# in the case here, I need to query N_points_per_group+1 to get it because the first N_points_per_group closest points are within the same group (starting by the point itself)
for i in range(N_groups):
    print(f"Group {i}:")
    dist, ind = tree.query(X[i], k=N_points_per_group+1)
    print(ind)
    break

Group 0:
[[ 0  3  1  2  4 15]
 [ 1  0  3  2  4 15]
 [ 2  0  3  1  4 15]
 [ 3  0  1  2  4 15]
 [ 4  3  0  1  2 15]]
```

As we can see the first closest N_points_per_group are all points in the group. I would like to exclude them by doing something like
```python
for i in range(N_groups):
    print(f"Group {i}:")
    mask_points_to_exclude = np.isin(X.reshape((-1, D)), (X[i])).all(axis=1)
    dist, ind = tree.query(X[i], k=1, exclude=mask_points_to_exclude)
    print(ind)
    break
Group 0:
[[15]
 [15]
 [15]
 [15]
 [15]]
```

Is it clearer ?

Labels: New Feature
In Balltree, filter out/mask specific points in query

### Describe the workflow you want to enable

I would like to be able to query nearest points within a Balltree but excluding some of them.
E.g. I create a Balltree on 60k points. I want to find the k nearest neighbour points but within a subset of the 60k points. 
Example case: I have N clusters of points. I build a Balltree with all the points of the N clusters (e.g. 60k points). Then I want to find for each of the points of a given cluster the closest point from the other clusters (i.e. excluding itself).

### Describe your proposed solution

 I would like to pass an extra mask argument (e.g. array of 60k elements) to the query with True for the points in the other clusters and False for the points in the specific cluster.

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

_No response_

### Additional context

_No response_

COMMENT:
Thanks for the details. What you're asking doesn't fit very well with the tree design. To be efficient a new tree with the excluded points should be created. Otherwise it would be equivalent to querying all points and then mask yourself the query result afterwards.

Here's a simple solution (if I got it right this time):
```py
import numpy as np
from sklearn.neighbors import BallTree

N_groups = 10
N_points_per_group = 5
D = 3
groups = np.arange(N_groups)

# create N_groups centers
X = np.random.RandomState(0).random_sample((N_groups, D))

# create per group, N_points_per_group points around each center by adding a small random perturbation
X = X[:,np.newaxis,:] + np.random.RandomState(0).random_sample((N_groups,N_points_per_group, D))*.05

# create a BallTree from all the points of all the groups
tree = BallTree(X.reshape((-1,D)))  # this is not needed anymore

# for each group, I want to find the closest point in the BallTree that is not in the group itself
# in the case here, I need to query k=2 to get it because the first one is always the point itself
for i in range(N_groups):
    print(f"Group {i}:")
    new_tree = BallTree(X[groups != i].reshape(-1, D))
    dist, ind = tree.query(X[i], k=2)
    print(ind[:,[1]])  # only the 2nd column
    break

Group 0:
[[3]
 [0]
 [0]
 [0]
 [3]]

```
Note that it's the index in `X[groups != i]`, not in `X` so you still need to map it back to the original array

Labels: New Feature
In Balltree, filter out/mask specific points in query

### Describe the workflow you want to enable

I would like to be able to query nearest points within a Balltree but excluding some of them.
E.g. I create a Balltree on 60k points. I want to find the k nearest neighbour points but within a subset of the 60k points. 
Example case: I have N clusters of points. I build a Balltree with all the points of the N clusters (e.g. 60k points). Then I want to find for each of the points of a given cluster the closest point from the other clusters (i.e. excluding itself).

### Describe your proposed solution

 I would like to pass an extra mask argument (e.g. array of 60k elements) to the query with True for the points in the other clusters and False for the points in the specific cluster.

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

_No response_

### Additional context

_No response_

COMMENT:
I am going to close this because it looks more like a usage question than a feature request.

Labels: New Feature
In Balltree, filter out/mask specific points in query

### Describe the workflow you want to enable

I would like to be able to query nearest points within a Balltree but excluding some of them.
E.g. I create a Balltree on 60k points. I want to find the k nearest neighbour points but within a subset of the 60k points. 
Example case: I have N clusters of points. I build a Balltree with all the points of the N clusters (e.g. 60k points). Then I want to find for each of the points of a given cluster the closest point from the other clusters (i.e. excluding itself).

### Describe your proposed solution

 I would like to pass an extra mask argument (e.g. array of 60k elements) to the query with True for the points in the other clusters and False for the points in the specific cluster.

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

_No response_

### Additional context

_No response_

COMMENT:
@lesteve it is a usage that is not practical (=takes minutes instead of seconds) today that can be made practical by the new feature.
so it is not a feature that make it only clearer to write code, it makes a use case possible

Labels: New Feature