Learning weights of ensembles

We have a time series dataset (spatiotemporal, but not an image/video). The dataset is in 3D, where each (x,y,t) coordinate has a numeric value (such as the temperature of the sea at that location and at that specific point in time). So we can think of it as a matrix with a temporal component. The dataset is similar to this but with just one channel:
Dataset

We have the ground truth and two or more deepnets trained on data that approximate the ground truth. Can we learn the weights of an ensemble of the two/more models that would output a good approximation to the ground truth? Thanks!

Assuming that the weights in the ensemble should sum to 1, we can initialize a parameter a via nn.Parameter which represented the weight assigned to a model 1 (a) and the other model will have weight (1-a). We can then train the parameter with inputs as output of two models and true value as the ground truth, to find an optimal parameter,

Hi @arunppsg , thanks a lot for the response.

Is it possible to generalize it to more than two models? Let’s say if we had 5?

Thanks!

Maybe we can use nn.Parameter(5) for 5 weights from 5 models and then tune the parameters with additional constraints on the parameters such that sum of parameters is less than 1.