Add `class_weight` feature to KNeighbors, GradientBoosting and AdaBoost classifiers

### Describe the workflow you want to enable

I propose adding a `class_weight` parameter to the [KNeighborsClassifier](https://scikit-learn.org/stable/modules/generated/sklearn.neighbors.KNeighborsClassifier.html), [GradientBoostingClassifier](https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.GradientBoostingClassifier.html) and [AdaBoostClassifier](https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.AdaBoostClassifier.html) in Scikit-learn to handle class imbalances in datasets. Many real-world datasets suffer from class imbalance, which can lead to biased and suboptimal models. By including a `class_weight` parameter in these classifiers, users can easily adjust the importance of each class during training, allowing for better model performance in imbalanced scenarios.

### Describe your proposed solution

For each of the classifiers, I propose adding a `class_weight` parameter with the following options:

- `None`: No class weighting is applied (default behavior).
- `'balanced'`: Class weights are automatically computed based on the number of samples in each class.
- `{class_label: weight}`: A dictionary providing custom weights for each class.

The `class_weight` parameter should be used during the training phase to modify the loss function for the classifiers, accounting for the class weights provided. This modification will ensure that the model takes into consideration the class imbalance while training.

For MLPClassifier, this feature has been requested in issue #9113. Implementing this for the other classifiers will follow a similar pattern.

### Describe alternatives you've considered, if relevant

An alternative approach is to use resampling techniques to balance the dataset prior to training. However, this method can have some drawbacks, such as potential information loss in the case of under-sampling, or increased training time and overfitting risk in the case of over-sampling. Adding a `class_weight` parameter directly to the classifiers offers a more efficient and flexible way to handle class imbalance, without the need for preprocessing the data.

Another alternative is to use third-party libraries that offer implementations of these classifiers with built-in support for class weights. However, this may not be ideal for users who prefer to work exclusively with Scikit-learn or have constraints that prevent the use of additional libraries.

### Additional context

Some classifiers in Scikit-learn, such as the [RandomForestClassifier](https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.RandomForestClassifier.html) and [SVC](https://scikit-learn.org/stable/modules/generated/sklearn.svm.SVC.html), already support the `class_weight` parameter. Adding this functionality to the proposed classifiers would make the library more consistent and user-friendly.

This feature is also already proposed for the MLPClassifier, in:
- Issue: #9113
- PR: #25326

### Tracking

- [ ] KNeighborsClassifier
- [ ] GradientBoostingClassifier
- [ ] AdaBoostClassifier

COMMENT:
Thanks for your reply!

> It seems like providing class weights would maybe provide some "syntactic sugar", but is it worth the maintenance?

I think the most important added value is that by adding class weights to all classifiers, that is becomes consistent among them. That makes it easy to compare and try different methods while keeping the weightings consistant. [RandomForestClassifier](https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.RandomForestClassifier.html), [SVC](https://scikit-learn.org/stable/modules/generated/sklearn.svm.SVC.html), [DecisionTreeClassifier](https://scikit-learn.org/stable/modules/generated/sklearn.tree.DecisionTreeClassifier.html) and [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) for example already support a `class_weight` parameter.

If possible, this feature could also be abstracted as a superclass feature shared by all classifiers.

Labels: New Feature, module:ensemble