市場觀點

Quant chart: From black box to glass box

作者

    Researcher
    Researcher

In the past five years, the application of machine learning (ML) techniques for predicting stock returns has seen a significant surge. Numerous studies have confirmed that ML-based alpha models often outperform traditional, linear models in predicting cross-sectional equity returns.1 However, ML techniques are often referred to as “black boxes.” Something goes in, something comes out, but the inner workings of the algorithms remain obscure. This is where tools like Shapley values come into play – they help to understand why machine-learning models make certain predictions.2

For every prediction an ML model makes, Shapley values indicate the contribution of each variable (feature) to the prediction (target). Imagine we’re predicting future stock returns, and the model predicts an outperformance of 4% for a particular stock. Shapley values allow us to attribute this for instance as follows: 2% due to value, 1% due to momentum, and 1% due to quality.

Figure 1: Shapley plots for a boosted regression tree model predicting one-month-ahead returns.

Source: Robeco, Refinitiv. The figure shows a Shapley scatter plot (left) and a Shapley dependence plot (right) for a boosted regression tree model predicting one-month ahead standardized returns. Shapley values are shown on the y-axis, with a Shapley value above 0 indicating that a feature has a positive impact on model predictions. The chart on the left shows the relation between distance-to-default and one-month-ahead returns. The chart on the right shows an interaction effect between short-term momentum (x-axis) and distance-to-default (color) for one-month-ahead returns. The boosted regression tree model is trained on one-month ahead relative returns. We include several dozen common as well as proprietary features whose ranks are cross-sectionally mapped into the [-1,1] interval. For missing values, the cross-sectional median is imputed. The model is trained on monthly data from January 1986 to December 2022, using all constituents of the MSCI World Index.

Furthermore, Shapley dependence plots can also illuminate the functional form between a feature and the target. Figure 1, for instance, illustrates potential nonlinearities and interaction effects in ML return prediction models. Shapley values are shown on the y-axis, with a Shapley value above 0 indicating that a feature has a positive impact on model predictions.

The chart on the left indicates a positive relationship between distance-to-default and expected returns. This pattern is consistent with the well-known low-risk effect, which suggests that higher risks are not necessarily rewarded with higher returns. However, this relationship is nonlinear: stocks closer to default exhibit a highly negative relation between distress risk and expected returns, while the relationship remains relatively flat for stocks far away from default.

Moreover, the chart on the right unveils an interaction effect between short-term momentum and distance-to-default.3 Generally, the Shapley plot indicates that stocks with high short-term momentum tend to have higher future returns. However, this effect is more pronounced for stocks with low distance-to-default (blue dots) than for stocks with high distance-to-default (red dots). This insight reveals that while stocks with low distance-to-default typically have lower expected returns, short-term momentum can discern between short-term winners and losers within this volatile group of stocks.

In conclusion, Shapley values play a pivotal role in transforming ML models from “black boxes” to “glass boxes.” The black boxes metaphor stems from the increased complexity of ML models and the difficulty in understanding the decision-making process behind predictions. Shapley values, however, quantify the contribution of each feature in the model to a specific prediction. They provide a transparent layer, allowing us to see and understand the impact and importance of individual variables on the predictions. This interpretability, akin to peering into a glass box, is paramount in assessing the trustworthiness of ML predictions and making informed investment decisions based on them.

Footnotes

1 See for instance, Gu, Kelly, and Xiu, 2020, “Empirical Asset Pricing via Machine Learning”, The Review of Financial Studies for the United States, Tobek and Hronec, 2021, “Does it pay to follow anomalies research? Machine learning approach with international evidence”, Journal of Financial Markets for developed markets, and Hanauer and Kalsbach, 2023, “Machine learning and the cross-section of emerging market stock returns”, Emerging Markets Review for emerging markets. For a discussion of the promises and pitfalls of ML, we also refer to and Leung, Lohre, Mischlich, Shea, and Stroh, 2021, “The Promises and Pitfalls of Machine Learning for Predicting Stock Returns”, The Journal of Financial Data Science, Blitz, Hoogteijling, and Lohre, 2023, “Researchers have just been scratching the surface of ML in asset management”, Robeco article, and Chen and Zhou, 2023, “Machine learning in finance: Why and how?”, Robeco article.
2 See Shapley, 1953. “A Value for n-person Games.” Contributions to the Theory of Games. Annals of Mathematical Studies.
3 Short-term momentum is a proprietary signal with a lookback of one month that captures systematic short-term momentum effects such as industry, country, and factor momentum.

Quant Charts

重要資料

本網站僅供《證券及期貨條例》(香港法例第571章)及其附屬法例所界定之專業投資者瀏覽及使用。 投資涉及風險。過往表現並不代表未來表現。本網站所載資料僅供參考之用,並不構成任何投資建議,亦非作出買賣任何證券或採納任何投資策略之要約或招攬。投資者不應僅憑本網站提供之資料作出投資決定,在作出任何投資決定前,應徵詢獨立意見(包括有關稅務影響之意見)。投資者應確保完全理解投資產品的相關風險,亦應考量自身投資目標及風險承受水平。投資乃閣下之個人決定。除非銷售投資產品的中介人已向閣下告知該投資產品適合閣下,並已解釋其符合閣下投資目標之原因,否則閣下不應投資。請參閱相關發售文件或其他法律文件,以獲取包括風險因素在內的進一步詳情。 本網站由荷寶投資管理香港有限公司發布,該公司受香港證券及期貨事務監察委員會(「證監會」)規管(中央編號:APU851)。本網站未經證監會審閱。 無法保證任何投資產品可實現其投資目標。概不就任何投資產品之表現或投資回報作任何聲明或承諾。投資的價值或會波動。本網站所載過往表現、推算或預測,均不應視作未來表現之保證或指標,且概不提供任何明示或暗示之保證。本網站內容建基於相信為可靠之來源,惟因應資料傳遞技術特性及須採用多項數據來源(包括第三方內容),故概不保證其準確性。所述觀點僅乃截至上述日期,或會隨市況變化而改變,可予更改而毋須另行通知。該等意見可能有別於其他荷寶投資專業人士之意見。因使用本材料或當中所載任何評論、意見或估算而引致之直接、間接或相應損失,荷寶概不承擔法律責任。荷寶並無責任更新本網站或任何網站內容。未經荷寶事先書面許可,不得複製、分發或刊發本網站任何材料。 除非另有說明,資料來源:荷寶。

警告 — 有不法分子在網站及社交媒體上冒用荷寳 了解更多