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:
An alternative could be to add support for sample weights. This would enable the generic "I have weighted samples" use-case as well as this use case of wanting to assign weights to classes.

One thing to consider is: https://github.com/scikit-learn/scikit-learn/issues/25855 - this was an issue discussing how/if to add sample weight support to nearest neighbors estimators.

`GradientBoostingClassifier` and `AdaBoostClassifier` already support sample weights, so you could already perform class weighting via that. It seems like providing class weights would maybe provide some "syntactic sugar", but is it worth the maintenance?

Labels: New Feature, module:ensemble