Simple Ensemble¶
Ensemble methods are simple and effective ways to improve the performance of machine learning models. They combine the outputs of multiple models to create a stronger model.
Examples¶
from fusion_bench.method import EnsembleAlgorithm
# Instantiate the EnsembleAlgorithm
algorithm = EnsembleAlgorithm()
# Assume we have a list of PyTorch models (nn.Module instances) that we want to ensemble.
models = [...]
# Run the algorithm on the models.
merged_model = algorithm.run(models)
Code Integration¶
Configuration template for the ensemble algorithm:
create a simple ensemble of CLIP-ViT models for image classification tasks.
fusion_bench \
method=ensemble/simple_ensemble \
modelpool=CLIPVisionModelPool/clip-vit-base-patch32_TA8 \
taskpool=CLIPVisionModelTaskPool/clip-vit-classification_TA8
References¶
SimpleEnsembleAlgorithm
¶
Bases: BaseAlgorithm
Source code in fusion_bench/method/ensemble.py
run(modelpool)
¶
Run the simple ensemble algorithm on the given model pool.
Parameters:
-
modelpool
¶BaseModelPool | List[Module]
) –The pool of models to ensemble.
Returns:
-
EnsembleModule
–The ensembled model.