Theoretical Guarantees of Learning Ensembling Strategies with Applications to Time Series Forecasting