Machine learning predictions are typically interpreted as the sum of contributions of predictors. Yet, each out-of-sample prediction can also be expressed as a linear combination of in-sample values of the predicted variable, with weights corresponding to pairwise proximity scores between current and past economic events. While this dual route leads nowhere in some contexts (e.g., large cross-sectional datasets), it provides sparser interpretations in settings with many regressors and little training data-like macroeconomic forecasting. In this case, the sequence of contributions can be visualized as a time series, allowing analysts to explain predictions as quantifiable combinations of historical analogies. Moreover, the weights can be viewed as those of a data portfolio, inspiring new diagnostic measures such as forecast concentration, short position, and turnover. We show how weights can be retrieved seamlessly for (kernel) ridge regression, random forest, boosted trees, and neural networks. Then, we apply these tools to analyze post-pandemic forecasts of inflation, GDP growth, and recession probabilities. In all cases, the approach opens the black box from a new angle and demonstrates how machine learning models leverage history partly repeating itself.
翻译:机器学习预测通常被解释为预测变量贡献的总和。然而,每个样本外预测也可以表示为预测变量样本内值的线性组合,其权重对应于当前与过去经济事件之间的成对邻近度得分。尽管在某些情境下(例如大规模横截面数据集),这种双重路径并无实际意义,但在具有众多回归变量和少量训练数据(如宏观经济预测)的场景中,它能提供更稀疏的解释。在这种情况下,贡献序列可被可视化为时间序列,使分析者能够将预测解释为可量化的历史类比组合。此外,这些权重可被视为数据投资组合的权重,从而启发新的诊断指标,如预测集中度、空头头寸和换手率。我们展示了如何为(核)岭回归、随机森林、提升树和神经网络无缝提取权重。随后,我们应用这些工具分析疫情后通胀、GDP增长和衰退概率的预测。在所有案例中,该方法从新角度打开了黑箱,并展示了机器学习模型如何利用历史部分自我重复的特性。