Issue with binary classifiers in _check_sample_weight_equivalence?

### Describe the bug

Hello, I tried to make my custom binary classifier pass the estimator checks with scikit-learn 1.6. The sample weight equivalence properties worked on <1.5 and not 1.6.

I think the issue is related to how the binary tag is enforced on the generated targets for the _check_sample_weight_equivalence : https://github.com/scikit-learn/scikit-learn/blob/9e78dca5e8ccad8b4e1f0d36e0e3e854f07e0aa5/sklearn/utils/estimator_checks.py#L1504

### Steps/Code to Reproduce

```python
from sklearn.linear_model import RidgeClassifier
from sklearn.utils.estimator_checks import (
    check_sample_weight_equivalence_on_dense_data,
)


class BinaryRidgeClassifier(RidgeClassifier):
    def __sklearn_tags__(self):
        tags = super().__sklearn_tags__()
        tags.classifier_tags.multi_class = False
        return tags


check_sample_weight_equivalence_on_dense_data("ridge", RidgeClassifier()) # pass
check_sample_weight_equivalence_on_dense_data("binary_ridge", BinaryRidgeClassifier()) # fails
```

### Expected Results

I would expect both to pass.

### Actual Results

From the following snippet, copy-pasted mostly from : https://github.com/scikit-learn/scikit-learn/blob/9e78dca5e8ccad8b4e1f0d36e0e3e854f07e0aa5/sklearn/utils/estimator_checks.py#L1504

```python
import numpy as np
from sklearn.base import BaseEstimator, ClassifierMixin
from sklearn.utils import shuffle
from sklearn.utils.estimator_checks import _enforce_estimator_tags_y


class BinaryClassifier(ClassifierMixin, BaseEstimator):
    def __sklearn_tags__(self):
        tags = super().__sklearn_tags__()
        tags.classifier_tags.multi_class = False
        return tags


rng = np.random.RandomState(42)
n_samples = 15
X = rng.rand(n_samples, n_samples * 2)
y = rng.randint(0, 3, size=n_samples)
# Use random integers (including zero) as weights.
sw = rng.randint(0, 5, size=n_samples)

X_weighted = X
y_weighted = y
# repeat samples according to weights
X_repeated = X_weighted.repeat(repeats=sw, axis=0)
y_repeated = y_weighted.repeat(repeats=sw)

X_weighted, y_weighted, sw = shuffle(X_weighted, y_weighted, sw, random_state=0)

print(y_weighted, y_repeated, y)

y_weighted = _enforce_estimator_tags_y(BinaryClassifier(), y_weighted)
y_repeated = _enforce_estimator_tags_y(BinaryClassifier(), y_repeated)

print(y_weighted, y_repeated, y)
```

With the shuffle, a 1 is found in the first element of y_weighted, and the classes 0 and 2 are merged by _enforce_estimator_tags_y, meanwhile in y_repeated, a 0 is found in the first element, and the class 1 and 2 are merged by _enforce_estimator_tags_y.

Is it normal?

Thank you :)

### Versions

```shell
System:
    python: 3.13.1 (main, Dec  3 2024, 17:59:52) [Clang 16.0.0 (clang-1600.0.26.4)]
executable: .venv/bin/python
   machine: macOS-15.2-arm64-arm-64bit-Mach-O

Python dependencies:
      sklearn: 1.6.0
          pip: None
   setuptools: None
        numpy: 2.2.2
        scipy: 1.15.1
       Cython: None
       pandas: 2.2.3
   matplotlib: 3.10.0
       joblib: 1.4.2
threadpoolctl: 3.5.0

Built with OpenMP: True

threadpoolctl info:
       user_api: openmp
   internal_api: openmp
    num_threads: 11
         prefix: libomp
       filepath: .venv/lib/python3.13/site-packages/sklearn/.dylibs/libomp.dylib
        version: None
```

COMMENT:
> We might need to define a custom fit method in the BinaryRidgeClassifier Class, to customize the default fitting parameters.

That could indeed be a short-term workaround. Alternatively, you can just mark this case as XFAIL in your testing infra with a link to this issue and hopefully, we will ship a fix in a future bugfix release.

Labels: Bug