RFC: Breaking Changes for Version 2

A while ago we talked about the possibility of a version 2 with breaking changes. Specifically, this came up in the context of SLEP006: metadata routing, but there are other things we have wanted to break which we can do all in a single release. In this issue we can talk about the possibility of such a release, and maybe a few things we'd like to include in it.

I'll try to summarize the challenges of keeping backward compatibility (BC) in the context of SLEP006:

- `MetaEstimator(Estimator()).fit(X, y, sample_weight)` will raise according to SLEP006 since `sample_weight` is not requested by any object. For backward compatibility, during the transition period, it'll only warn and assume `sample_weight` is requested by `Estimator()`.
- What should the behavior of `GridSearchCV(Estimator(), scorer=scorer).fit(X, y, sample_weight)` be during the transition period? If we keep backward compatibility, it should warn (whatever the warning be), route `sample_weight` to `Estimator`, but not to the `scorer`. And that's only the case because we're keeping BC. From the user's perspective, it's very weird.
- `Pipeline` ATM in certain methods like `fit`, `fit_transform`, `predict`, routes `*_params` to the `fit/etc` of the last estimator only. And `decision_function` and `transform`, `score_samples` have no routing at all. Keeping this BC, proves to be challenging, and a bit nasty. ref: #24270
- In quite a few meta-estimators, we check if the sub-estimator has `sample_weight` in the signature of `fit`, and we pass the given sample weight to it if that's the case, and not if that's not the case. With routing, we would have a much better idea of when to pass sample weight and when not, but if we're keeping BC, it's really challenging to see if we should forward sample weights or not. Both AdaBoost (#24026) and Bagging (#24250) have been very challenging, to the point that we might end up having to check if a sub-estimator is a meta-estimator itself or not, and check signature of sub-estimator's `fit`, and check the given routing info to keep BC.

I'm pretty sure there are other issues we haven't foreseen, and they'll come up as we work on this project. We thought it'd be easy once we get to this point, but BC has proven to make it very tricky and has stalled the progress.

All of the above is adding substantial complexity which is probably error prone, and buggy. We have had to spend quite a bit of time every time we go back to review those bits to understand why we've done what we've done. Even as a temporary solution they're not very maintainable.

My proposal here is to have a version 2 which is not BC with previous releases in certain ways, and target a few breaking changes for it. We can aim to have the release in October 2023 or April/May 2024 as the version 2.

cc @scikit-learn/core-devs

COMMENT:
Things which will NOT break:

```py
Estimator().fit(X, y, sample_weight)
```

for all estimators (not meta-estimators), no matter whether they inhering from `BaseEstimator` or not.

Also, no code will break if there are no metadata (e.g. `sample_weight` passed to `fit`). So a complex pipeline like [this example](https://scikit-learn.org/stable/auto_examples/compose/plot_column_transformer.html#sphx-glr-auto-examples-compose-plot-column-transformer-py) still works.

What breaks:

```py
GridSearchCV(estimator=Estimator(), param_grid=grid).fit(X, y, sample_weight)
```

It will raise with `"Metadata (sample_weight) is provided but not explicitly requested"`, and it would need to be fixed as:

```py
GridSearchCV(
	estimator=Estimator().set_fit_request(sample_weight=True),
	param_grid=grid
).fit(X, y, sample_weight)
```

For `Pipeline`, passing metadata to steps completely changes:

```py
pipe = Pipeline([('scaler', StandardScaler()), ('svc', SVC())])
pipe.fit(X_train, y_train, svc__sample_weight=sw)
```

will raise. Instead, the code becomes:

```py
pipe = Pipeline(
    [
        ("scaler", StandardScaler().set_fit_request(sample_weight=False)),
        ("svc", SVC().set_fit_request(sample_weight=True)),
    ]
)
pipe.fit(X_train, y_train, sample_weight=sw)
```

For other meta-estimators, it's case by case, for example for `AdaBoostClassifier`, it'll be:

```py
AdaBoostClassifier(SVC()).fit(X, y)
```
should probably now raise, and the user needs to say:

```py
AdaBoostClassifier(SVC().set_fit_request(sample_weight=True)).fit(X, y)
```
to support passing `sample_weight` to the learner. Note that this is very specific to `AdaBoostClassifier` for the way it works.

Another meta-estimator such as `BaggingClassifier`, would also break, but would be a lot more consistent, since right now we check for the signature of `fit` of the given estimator to `BaggingClassifier`, and that decides whether we should pass `sample_weight` to it or not, and with this breaking change, the user needs to define the request values, and that's used to route `sample_weight` instead.

Labels: RFC, Breaking Change