flexs.baselines.models.adaptive_ensemble¶
Defines the AdaptiveEnsemble model.
-
class
flexs.baselines.models.adaptive_ensemble.
AdaptiveEnsemble
(models, combine_with='sum', adapt_weights_with='r2_weights', adaptive_val_size=0.2)[source]¶ Bases:
flexs.model.Model
Ensemble class that weights individual model predictions adaptively, according to some reweighting function.
-
flexs.baselines.models.adaptive_ensemble.
r2_weights
(model_preds, labels)[source]¶ - Parameters
model_preds (
ndarray
) – A numpy array of shape (num_models, num_samples) containing model predictions.labels (
ndarray
) – A numpy array of true labels.
- Return type
ndarray
- Returns
A numpy array of shape (num_models,) containing $r^2$ scores for models.