-learning models regularly outperform classical econometric methods . Tree-based models are the most successful in out-of-sample prediction for the financial and fiscal sectors. For the external sector, the signal extraction approach is most effective for sudden stops and Exchange Market Pressure (EMP) events in advanced economies (AEs), while a RF model is better for EMP events in emerging markets (EMs) and low-income countries (LICs). Pooling all countries improves the performance of fiscal and financial models . Pooling all country groups typically improves forecasting for
) from the original sample. The heterogeneity in variables is achieved by limiting the set of variables available to the algorithm to a small number m try of variables drawn randomly from the full set of variables. This random subset is redrawn at each split. On the one hand, this randomization implies that individual trees are poor representations of the data generating process. However, the diversity among the trees implies that model errors tend to offset each other. Hence, if the number of trees is sufficiently large, RF models can achieve predictive performance
and easiest models for textual analysis. Therefore, we use LR as our baseline model, complemented by the support-vector-machine (SVM) model and the random forest (RF) model. The LR is a probabilistic classifier that relies on supervised machine learning. Its goal is to train a classifier that can make a binary decision about the class of a new input observation, which in our case is to decide whether a paragraph is about spillovers or not. Consider an input paragraph x, which is typically vectorized and represented as [x 1 , x 2 ,..., x n ]. The classifier output
-of sample predictive performance of four RF estimated using the features selected by each algorithm against the RF estimated with the full set of variables. We check the statistical significance of the difference between the performance of each algorithm and the full RF model by calculating t-tests based on standard errors adjusted for two-way clustering (see Cameron, Gelbach, and Miller 2011 ). The main performance measure for these comparisons is the area under the receiver-operator curve (AUROC), although other measures such as of the log likelihood and mean squared