Optimizing a Portfolio of Models

Microprediction
Geek Culture
Published in
7 min readFeb 16, 2022

--

In this colab notebook I provide an example of the use of the precise Python package (and PyPortfolioOpt) to create a diversified portfolio of scikit-learn models fitted using LazyPredict.

Background

For now, I’m content to draw the reader’s attention to the close parallels between financial portfolio construction and model ensembles. A linear combination of models is certainly akin to a portfolio of assets, insofar as the assessment is mathematically similar and sometimes, identical.

In the case of models assumed to be unbiased, we take an interest in the squared error of the combined model (or some similar metric). Likewise, in finance, we are sometimes interested in minimizing the variance of the value of a linear combination of securities (or, again, some proximate objective).

Interestingly both the forecasting literature and also the financial literature include the same stern empirical warning in different terminology. Over-concentration can hurt the long-term returns of a portfolio, just as over-reliance on a single model can hurt out-of-sample performance.

We also find empirical warnings in the literature about getting too fancy in the portfolio construction (analogously, the combining of expert opinions, or forecast models, or model outputs). The surprising difficulty in…

--

--