How would you implement an ensemble of neural networks? I currently use a list like this:
list_of_models = [model] * num_model
I wonder if there’s a more ‘Pytorch-like’&efficient way to construct an ensemble? Thank you in advance.
How would you implement an ensemble of neural networks? I currently use a list like this:
list_of_models = [model] * num_model
I wonder if there’s a more ‘Pytorch-like’&efficient way to construct an ensemble? Thank you in advance.
I assume model
is an already initialized nn.Module
object. If that’s the case, note that you would create num_models
references to the same object and won’t create num_models
different model objects. To do the latter, you would need to initialize them: [MyModel() for _ in range(num_models)]
.
With that being said, I’m not aware of cleaner/better approach, so let’s wait for others to chime in.