## 3. unFEAR: Unsupervised Feature Extraction Clustering for Crisis Regimes Classification

## Source details

**Canonical URL:** [3. unFEAR: Unsupervised Feature Extraction Clustering for Crisis Regimes Classification](https://www.imf.org/-/media/files/publications/wp/2020/english/wpiea2020262-print-pdf.pdf)

## Other formats

- [Markdown version](/-/media/files/publications/wp/2020/english/wpiea2020262-print-pdf.pdf.md)
- [Structured JSON version](/-/media/files/publications/wp/2020/english/wpiea2020262-print-pdf.pdf.json)

---

### Background and motivation
- Long-term output foregone from crises:
  - 5 percent for balance of payments crises;
  - 10 percent for banking crises;
  - 15 percent for twin crises.
- Typical recovery horizon: following a financial crisis, a country needs on average eight years to return to its pre-crisis level of income.
- Societal costs include declines in average life expectancy, drops in primary school enrollment, and increases in infant mortality.
- Macroprudential policy effectiveness requires tools targeting root causes; crisis prediction models should flag conditions that lead to crises.

### Conceptual innovation: unsupervised vs supervised approaches
- Supervised crisis prediction setup:
  - Observations at time t are labeled crisis/non-crisis based on whether a crisis occurs at t+n, with n typically one to two years for policy-oriented models.
  - Produces the "biased label problem": similar-feature observations can receive different labels if only one experiences a crisis in the forecasting horizon; supervised learners force separation between such observations.
- Unsupervised alternative:
  - Clusters are identified using the feature distribution P(x) rather than estimating P(y|x).
  - Clusters group observations with similar features; cluster crisis risk is the empirical crisis frequency among its observations.
  - Clusters interpreted as time-invariant economic regimes with different crisis propensities.
  - Advantages:
    - Requires fewer labeled examples to identify structure.
    - No need to split data into training/validation/test for cluster discovery.
    - Consistent with economic intuition that similar fundamentals may yield heterogeneous crisis realizations.

### The unFEAR method (overview)
- unFEAR: an unsupervised feature extraction clustering method for crisis-regime identification.
- Methodological building blocks:
  - Use of autoencoders for nonlinear dimensionality reduction and feature engineering.
  - Novel mode contrastive autoencoder (MCAE) to generate time-invariant, separable clusters.
  - Autoencoder-based imputation to handle missing data.
  - Clusters that mix crisis and non-crisis observations and are not tied to specific time periods, implying cluster-specific, time-invariant crisis-generating mechanisms.

### Practical use and policy relevance
- Two proposed approaches to assess crisis vulnerability after clustering:
  - Assign a country to its closest neighboring cluster and compute crisis vulnerability as the empirical crisis frequency in that cluster.
  - Fit separate supervised learning classifiers within each cluster (cluster-specific supervised approach).
- Macroprudential applications:
  - Project policy effects on fundamentals to determine potential migration to safer or riskier clusters.
  - Even with unchanged cluster assignment, a supervised classifier within the cluster can assess whether policies reduce or increase crisis risk.

### Data and empirical scope
- Application illustrated using a group of advanced economies.
- Dataset period: 1980 - 2018 (illustrative statement in overview); application sample covers 34 countries during 1970 - 2018.
- Sample size: 1,688 country-year observations with 75 attributes constructed from global, domestic economic, domestic financial, and other variables.
- Crisis labeling: a data point is labeled as a crisis if an economic crisis affects the country two years after the data point is observed. Crisis categories: external crisis, financial crisis, fiscal crisis, and real sector crisis. Labels are withheld during clustering and disclosed ex-post to assess cluster crisis frequency.

### Challenges in supervised crisis prediction highlighted
- Imbalanced data: non-crisis points comprise 90 percent and crisis points comprise 10 percent of the observations.
- Missing data: pervasive; only five variables have no missing values and for about two thirds of the variables (58) missing values could be found in as much as fifty percent of the data points.
- Extraneous information and multicollinearity: large covariate sets include irrelevant features and strongly dependent covariates.
- Biased label problem: identical-feature observations can have different labels due to luck or policy interventions not captured by features; worsens with longer forecasting horizons.

### Technical details: autoencoders and feature objectives
- Main tool: multilayer autoencoder neural networks.
- Objectives for transformed features:
  - Retain substantial variation from original data.
  - Produce transformed features where data points concentrate into several separable clusters.
- Training objective: minimize a regularized loss balancing reconstruction error and a clustering regularization term.

### Autoencoders: intuition and procedure
- Autoencoder structure:
  - Encoder g_encoder(x) → low-dimensional h; decoder g_decoder(h) → reconstructed x̃.
  - Reconstruction loss: L_reconstruct(x, x̃) = L(x, g_decoder(g_encoder(x))).
  - Stacking layers and introducing noise yields robust nonlinear dimensionality reduction.
- Missing data imputation with autoencoders:
  - Use Mean Squared Error (MSE) loss for reconstruction.
  - Procedure:
    - Draw samples randomly from non-missing data points.
    - Train an autoencoder on the random sample.
    - Use the estimated autoencoder to fill missing values.
  - Advantages over MICE: no need to specify regressors; data-driven weighting; exploits cross-attribute dependence.
  - Activation functions used: exponential linear unit (ELUs).
- Removing time trends: Boosted Autoencoder
  - Iterative multi-round procedure:
    - Round t: train autoencoder to reconstruct x → x̃.
    - Compute reconstruction error r_i = x_i − x̃_i.
    - Feed r_i as input to train next-round autoencoder.
  - Rationale: first pass captures time trends; residuals r_i have time trends removed while retaining other informative structure for clustering.

### Mode Contrastive Autoencoder (MCAE) for clustering
- Regularized autoencoder loss:
  - L_AE = L_reconstruct(x, x̃) + λ L_cluster(h, μ),
    - where h = g_encoder(x) and μ = (μ1,..., μK) are cluster centroids.
- Conditional probability of cluster membership:
  - P(μ_c | x_i) = (1 + || μ_c − g_encoder(x_i) ||^2)^(−1) / Σ_{j=1,...,K} (1 + || μ_j − g_encoder(x_j) ||^2)^(−1).
- MCAE clustering objective:
  - L_cluster = − Σ_i Σ_c I(x_i ∈ cluster c) log(P(μ_c | x_i; g)).
  - Mode contrastive loss:
    - L_MCAE = L_reconstruct(x_i, x̃_i) + λ (− Σ_{c} Σ_{i} I(x_i ∈ cluster c) log(P(μ_c | x_i; g))).
  - Optimization via EM-like iterations:
    - E-step: assign each x_i to c_i = arg max_{c} log(P(μ_c | x_i; g)).
    - M-step: update centroids μ_c to minimize L_MCAE given assignments.

### 4. Application: Identification of Economic Crisis Clusters

### Data and sample (application)
- Sample: 34 countries, period 1970 - 2018.
- Observations: 1,688 country-year data points with 75 attributes.
- Attributes include levels, differences, and HP trends of global variables (Oil prices; 3-month U.S. Treasury bill rate, constant maturity; 10-year U.S. real interest rate; Trade-weighted dollar index), domestic economic variables (GDP growth; Output gap; Inflation; Reserves; Total external debt; Debt revenue; Exports and Imports; Capital flows; Exchange rate vs U.S. dollar; Purchasing power parity; Real exchange rate; Terms of trade; Fiscal balance; Fiscal revenue; Fiscal expenses), domestic financial variables (Probability of default, banking sector; Probability of default, non-financial sector; Probability of default, non-bank financial sector; Investment grade securities share; Long-term bond yields; Stock prices; Price to income ratio housing; Price to rent ratio housing; Aggregate bank capitalization ratio; Bank assets to GDP ratio; Credit to GDP ratio; Loan to deposit ratio banking sector; Short-term deposit rates; Private sector indebtedness to GDP ratio; Financial access; Financial efficiency), and other variables (Natural disasters, material impact on GDP; Years elapsed since end of crisis episode; Cumulative number of crisis years).

### Feature representation and preprocessing
- Time detrending via autoencoder:
  - Standard autoencoder with five-dimensional hidden vector h trained on raw input x.
  - Residuals r = x − x̃ used for clustering.
  - K-means on residuals with initial K = 10 (scree plot basis) reduces time clustering; clusters include data points from different countries and mixed crisis/non-crisis labels.
- Balancing data: SMOTE applied to time-detrended residuals to create synthetic crisis points to mitigate dominance of non-crisis points.
  - Result: improved cluster separation and partial separation of crisis-labeled points.
- MCAE application:
  - Elbow method on mean squared distance for clusters 2 to 20; analysis based on nine clusters (no substantial gains beyond nine).
  - MCAE applied to first-pass residuals yields nine well differentiated clusters interpreted as economic regimes.
  - Clusters mix crisis and non-crisis points; some clusters safer than others but no risk-free cluster.

### Cluster crisis frequencies and key statistics (as reported)
- Table 2 summary (reproduced in source) reports counts and frequencies by cluster. Selected explicit figures highlighted in text:
  - Cluster 0:
    - Crisis data points = 190; Non-crisis data points = 24;
    - Empirical crisis frequency = 43 percent;
    - Shadow crisis frequency = 89 percent.
  - Cluster 1:
    - Crisis data points = 307; Non-crisis data points = 452;
    - Empirical crisis frequency = 6 percent;
    - Shadow crisis frequency = 40 percent.
  - Cluster 2:
    - Crisis data points = 211; Non-crisis data points = 14;
    - Empirical crisis frequency = 61 percent;
    - Shadow crisis frequency = 94 percent.
  - Cluster 3:
    - Crisis data points = 143; Non-crisis data points = 1003;
    - Empirical crisis frequency = 2 percent;
    - Shadow crisis frequency = 12 percent.
  - Cluster 4:
    - Crisis data points = 168; Non-crisis data points = 6;
    - Empirical crisis frequency = 71 percent;
    - Shadow crisis frequency = 97 percent.
  - Cluster 5:
    - Crisis data points = 232; Non-crisis data points = 33;
    - Empirical crisis frequency = 30 percent;
    - Shadow crisis frequency = 88 percent.
  - Cluster 6:
    - Crisis data points = 120; Non-crisis data points = 5;
    - Empirical crisis frequency = 71 percent;
    - Shadow crisis frequency = 96 percent.
  - Cluster 7:
    - Crisis data points = 94; Non-crisis data points = 0;
    - Empirical crisis frequency = 100 percent;
    - Shadow crisis frequency = 100 percent.
  - Cluster 8:
    - Crisis data points = 74; Non-crisis data points = 2;
    - Empirical crisis frequency = 85 percent;
    - Shadow crisis frequency = 97 percent.
- Notes on definitions:
  - Empirical frequency = ratio of observed crisis data points to total observed data points.
  - Shadow empirical frequency = ratio of observed crisis data points to total data points (observed + synthetic).
- Textual interpretation highlights:
  - Low empirical crisis frequency clusters: Cluster 1 = 6 percent empirical (shadow 40 percent); Cluster 3 = 2 percent empirical (shadow 12 percent).
  - From shadow frequency perspective only Cluster 1 can be characterized as low crisis risk (text discussion notes differences between empirical and shadow figures).
  - High empirical crisis frequency clusters include Clusters 0, 2, 4, 5, 6, 7, 8 with empirical frequencies ranging from 30 percent to 100 percent and shadow frequencies from 88 percent to 100 percent.
- Illustrative decomposition for Cluster 8 (empirical frequency = 85 percent):
  - Financial crisis risk = 24 percent (2/7 of 85 percent);
  - Exchange market pressure crisis = 24 percent;
  - Real sector crisis = 24 percent;
  - Fiscal sector crisis = 13 percent.
  - Source notes risk of simultaneous crises appears negligible in this decomposition.

### Crisis risk measurement and prediction using clusters
- Cluster assignment as crisis-risk measure:
  - A country’s fundamentals place it into a cluster; cluster empirical crisis frequency serves as a crisis risk metric and can be decomposed by crisis type.
- Two-stage modeling strategy:
  - Stage 1: unsupervised clustering via unFEAR to identify regimes.
  - Stage 2 (optional): fit supervised classification models within each cluster; cluster-specific models are simpler and potentially more precise than global models.
- Within-cluster analysis:
  - Some countries in the same cluster do not experience crises; comparing crisis vs non-crisis observations within a cluster can illuminate differentiating factors.

### Conclusions (as presented)
- Supervised learning crisis models suffer from the biased label problem, particularly with longer horizons.
- Unsupervised learning avoids the biased label problem by clustering on similarity of fundamentals.
- unFEAR introduces an unsupervised feature extraction clustering approach using a mode contrastive autoencoder that:
  - Identifies observation clusters,
  - Handles time effects and missing data efficiently,
  - Produces interpretable economic-regime clusters.
- Application to advanced economies identifies nine clusters (analysis described as eight in summary language in source) associated with economic regimes; only one cluster comprises most observations that could be considered low risk.
- Cluster assignments can be used to assess crisis risk and serve as building blocks for simpler, more precise supervised crisis prediction models.

*Italic source: Excerpt from "unFEAR: Unsupervised Feature Extraction Clustering for Crisis Regimes Classification" (selected pages).*

### 3.   unFEAR: Unsupervised Feature Extraction Clustering for

### 3.   unFEAR: Unsupervised Feature Extraction Clustering for Crisis Regimes Classification

### Background and motivation
- Economic crises impose long-term economic costs measured in terms of output foregone:
  - 5 percent for balance of payments crises;
  - 10 percent for banking crises;
  - 15 percent for twin crises.
- Following a financial crisis, a country needs on average eight years to return to its pre-crisis level of income.
- Societal costs include declines in average life expectancy, drops in primary school enrollment, and increases in infant mortality.
- Macroprudential policy effectiveness hinges on tools targeting root causes of crises; crisis prediction models should support such policy by flagging conditions that lead to crises.

### Conceptual innovation: unsupervised vs supervised approaches
- Typical machine learning crisis prediction models use a supervised framework:
  - Observations at time t are labeled as crisis or non-crisis based on whether a crisis occurs at t+n.
  - n typically ranges from one to two years for policy-oriented models.
- The supervised labeling approach generates the "biased label problem":
  - Two observations with similar economic and financial features can receive different labels if only one experiences a crisis in the forecasting horizon.
  - A supervised learner forces separation between such observations even if, from a vulnerability perspective, they belong to the same class.
- Unsupervised learning offers a solution:
  - It identifies clusters using the distribution of the features P(x) rather than estimating P(y|x).
  - Clusters group observations with similar features; crisis risk for a cluster is the empirical crisis frequency among its observations.
  - Clusters can be interpreted as time-invariant economic regimes, each with a different propensity to generate crises.
  - Advantages noted:
    - Requires fewer labeled examples than supervised learners to identify structure.
    - No need to split data into training, validation, and test sets for cluster discovery.
    - Consistent with economic intuition that similar fundamentals may yield heterogeneous crisis realizations.

### The unFEAR method (overview from available text)
- unFEAR is an unsupervised feature extraction clustering method designed to facilitate economic crisis prediction.
- Key methodological elements described:
  - Uses autoencoders to reduce dimensionality of the original economic and financial dataset rather than working with raw data.
  - Introduces a novel mode contrastive autoencoder to generate time-invariant clusters.
  - Handles missing data via autoencoder-based imputation (figure references indicate a missing-data imputation approach using autoencoders).
  - Produces clusters where crisis and non-crisis observations do not correspond to specific time periods, suggesting cluster-specific, time-invariant crisis-generating mechanisms.

### Practical use and policy relevance
- Once clusters are identified, two approaches to assess crisis vulnerability are proposed:
  - Assign a country to its closest neighboring cluster and compute crisis vulnerability as the empirical crisis frequency in that cluster.
  - Fit separate supervised learning classifiers within each cluster (a cluster-specific supervised approach).
- Potential macroprudential policy applications:
  - Analysts can project policy effects on fundamentals to determine whether a country may migrate to a safer or riskier cluster.
  - Even if cluster assignment remains unchanged, a supervised classifier estimated within the cluster can assess whether policies reduce or increase crisis risk.

### Data and empirical scope (as described)
- The paper illustrates unFEAR using a group of advanced economies.
- Dataset covers economic and financial variables for the period 1980 - 2018.

### Challenges in supervised crisis prediction highlighted
- Imbalanced data: crises are rare relative to non-crisis observations (imbalanced data).
- Missing data: many countries lack observations for several attributes, raising missing data issues and trade-offs among dropping attributes, dropping observations, or imputing values.
- Extraneous information and multicollinearity: large covariate sets may include irrelevant features and strongly dependent covariates, complicating estimation and interpretation.
- Biased label problem: long forecasting horizons mean identical-feature observations can have different labels due to external luck or policy interventions not captured by features.

### Conceptual implications
- Clusters found by unFEAR are interpreted as economic regimes with distinct crisis propensities.
- The unsupervised-first strategy: identify clusters using features alone, then (optionally) fit cluster-specific supervised classifiers to improve predictive or policy-relevant inference.

*Italic source: Excerpt from "unFEAR: Unsupervised Feature Extraction Clustering for Crisis Regimes Classification" (selected pages).*

### 3.  unFEAR: Unsupervised Feature Extraction Clustering for Crisis Regimes

### 3.  unFEAR: Unsupervised Feature Extraction Clustering for Crisis Regimes

### Classification: motivation and conceptual overview
- unFEAR is a two-step method:
  - First, perform feature engineering (feature learning/representation learning) to extract relevant information from the raw data set useful for clustering analysis.
  - Second, identify separate clusters and the corresponding data point assignments once an appropriate representation is built.
- Empirical issues with raw data that motivate feature engineering:
  - Raw data attributes do not generate separable clusters. Example: K-means on annual data with 75 attributes collected for 34 countries during the period 1970-2018 yields non-discriminatory clusters (illustrated via a two-dimensional t-SNE representation).
  - Raw data capture different time periods rather than different economic fundamentals (time clustering). Cluster labels overlap substantially with time labels (e.g., cluster 8 corresponds to the most recent data points).
  - Raw data tends to group data points corresponding to the same country (country bias); near neighbor points tend to correspond to the same country.
  - Raw data is imbalanced: non-crisis points comprise 90 percent and crisis points comprise 10 percent of the observations.
  - Missing data is pervasive: for all observed data points only five variables do not have any missing value and for about two thirds of the variables (58), missing values could be found in as much as fifty percent of the data points.
- Method design choices:
  - Use autoencoders for feature engineering with a loss function designed to address lack of separability, time clustering, and country clustering.
  - Use the Synthetic Minority Over-sampling Technique (SMOTE) to address the data imbalance issue (Chawla et al. 2002).

### Technical details: main tools and goals
- Main tool: Autoencoder (built from multilayer neural networks).
- Objectives for the transformed feature representation:
  - Retain a substantial amount of the variation in the original data set to remain informative.
  - Produce transformed features in which data points concentrate into several separable clusters.
- The autoencoder is trained by minimizing a regularized loss function balancing reconstruction error and a clustering regularization term.

### Multilayer neural networks (background)
- Network structure and notation:
  - Left-panel example: three layers — input x, hidden layer producing h = g1(x), and output y = g2(h). Functions g1 and g2 can be nonlinear. The number of hidden units is a tunable hyperparameter.
  - Multilayer (deep) networks stack hidden layers: hl = gl(hl−1) recursively, enabling capture of complex dependences.
- Role of multilayer networks in unFEAR:
  - Capture nonlinear relationships, joint probability distributions of attributes, enable missing data imputation, and remove time clustering effects.

### Understanding autoencoders (analogy with PCA)
- PCA view:
  - PCA encodes data via a projection matrix P into an orthogonal low-dimensional space h and decodes via P−1 to reconstruct x̃.
  - PCA retains components explaining a substantial amount of total variance.
- Autoencoder generalization:
  - Encoder g_encoder(x) produces h in a lower dimensional space: h = g_encoder(x).
  - Decoder g_decoder(h) reconstructs x̃ = g_decoder(h).
  - Loss function for reconstruction: L_reconstruct(x, x̃) = L(x, g_decoder(g_encoder(x))).
  - Optimization of the loss yields g_encoder that performs nonlinear dimensionality reduction; stacking layers and introducing noise yields robust transformations.
- Autoencoders exploit cross-attribute dependence to impute missing values.

### Missing data imputation with autoencoders
- Common imputation methods contrasted: median/mean imputation; resampling from empirical distribution; multivariate regression approaches like MICE.
- unFEAR approach:
  - Introduce autoencoder-based missing data imputation using the Mean Squared Error loss function (MSE) to measure reconstruction error.
  - Assumption: attributes in high-dimensional economic data exhibit dependence, enabling recovery of missing attribute values from observed ones.
  - Autoencoder advantages vs MICE:
    - Does not require specifying which attributes can be regressors; it automatically assigns higher weights to attributes with more observations.
    - Equivalent to a data-driven MICE combining resampling and dependence exploitation.
- Autoencoder imputation procedure:
  - First, draw samples randomly from the non-missing data points.
  - Second, train an autoencoder on the randomly drawn data sample.
  - Third, use the estimated autoencoder to fill the missing data values.
- Activation functions used in unFEAR autoencoders: exponential linear unit (ELUs) (Clevert et al., 2016); ELUs outperform ReLUs in convergence speed (Klambauer et al., 2017).
- Related methods: Markov Chain Monte Carlo variational autoencoder-based approach of Rezende et al. (2015) (mentioned as related).

### Removing time trends using autoencoders (Boosted Autoencoder)
- Problem: raw data exhibits time clusters/time trends; univariate detrending is burdensome in high-dimensional settings.
- Solution: Boosted Autoencoder — iterative procedure performed in several rounds:
  - Round t: train autoencoder to reconstruct x → x̃.
  - Compute reconstruction error r_i = x_i − x̃_i.
  - Feed r_i as input to train a new autoencoder in the next round.
- Rationale:
  - First pass learns projections containing time trends; reconstruction error r_i does not exhibit the time trend but retains other useful information.
  - Subsequent clustering exploits the information in these reconstruction errors to avoid time clustering effects.

### Unsupervised clustering using the mode contrastive autoncoder
- Goal: enforce separability in the encoded space while preserving sufficient reconstruction accuracy.
- Regularized autoencoder loss (notation):
  - L_AE = L_reconstruct(x, x̃) + λ L_cluster(h, μ),
    - where x = (x1,..., xN), λ is a weight tuning parameter, h = g_encoder(x), and μ = (μ1,..., μK) are cluster centroids.
- Conditional probability that data point x_i belongs to cluster c:
  - P(μ_c | x_i) = (1 + || μ_c − g_encoder(x_i) ||^2)^(−1) / Σ_{j=1,...,K} (1 + || μ_j − g_encoder(x_j) ||^2)^(−1).
- Clustering objective:
  - Desire P(μ_c | x_i) to be one-peaked (close to a delta distribution) so each transformed data point h_i is assigned to a single cluster.
  - Equivalent to K-means clustering by maximizing likelihood L(μ, g; x) = Π_{c=1..K} Π_{i=1..N} P(μ_c | x_i) P(x_i ∈ cluster c) (or its log-likelihood).
- Mode contrastive autoencoder (MCAE) specification:
  - Set L_cluster = − Σ_i Σ_c I(x_i ∈ cluster c) log(P(μ_c | x_i; g)).
  - Mode contrastive loss function:
    - L_MCAE = L_reconstruct(x_i, x̃_i) + λ (− Σ_{c} Σ_{i} I(x_i ∈ cluster c) log(P(μ_c | x_i; g))).
  - Implementation via expectation-maximization iterations:
    - E-step: given centroids μ and encoder g, assign each x_i to cluster c_i = arg max_{c∈(1,...,K)} log(P(μ_c | x_i; g)).
    - M-step: given cluster assignments, find new centroids μ_c, c = 1,...,K, that minimize L_MCAE.

*wpiea2020262-print-pdf - 3.  unFEAR: Unsupervised Feature Extraction Clustering for Crisis Regimes*

### 4. Application: Identification of Economic Crisis Clusters

### 4. Application: Identification of Economic Crisis Clusters

### Data and sample
- Sample covers 34 countries during the period 1970 - 2018.
- The data comprises 1688 data points where each data point is a country-year observation, with 75 attributes.
- Attributes are constructed using levels, differences, and Hodrick-Prescott trends of the following variables:
  - Global variables: Oil prices; 3-month U.S. Treasury bill rate, constant maturity; 10-year U.S. real interest rate; Trade-weighted dollar currency index, major currencies.
  - Domestic economic variables: GDP growth; Output gap; Inflation; Reserves; Total external debt; Debt revenue; Exports and Imports; Capital flows; Exchange rate against the U.S. dollar; Purchasing power parity; Real exchange rate; Terms of trade; Fiscal balance; Fiscal revenue; Fiscal expenses.
  - Domestic financial variables: Probability of default, banking sector; Probability of default, non-financial sector; Probability of default, non-bank financial sector; Investment grade securities, share in total stock of debt securities; Long-term bond yields; Stock prices; Price to income ratio, housing sector; Price to rent ratio, housing sector; Aggregate bank capitalization ratio; Bank assets to GDP ratio; Credit to GDP ratio; Loan to deposit ratio, banking sector; Short-term deposit rates; Private sector indebtedness to GDP ratio; Financial access; Financial efficiency in the financial sector.
  - Other variables: Natural disasters, material impact on GDP; Years elapsed since the end of a crisis episode; Cumulative number of years recorded as a crisis episode since country entered the database.
- Crisis labeling: A data point is labeled as a crisis if an economic crisis affects the country two years after the data point is observed. Crisis categories correspond to external crisis (Basu et al. (2017)), financial crisis (Laeven and Valencia (2017)), fiscal crisis (Medas et al. (2018)), and real sector crisis (Basu et al. (2017)). Labels are not used in clustering (to avoid biased label problem) but are disclosed ex-post to assess cluster crisis frequency.

### Feature representation and preprocessing
- Time detrending:
  - Implemented a standard autoencoder with five dimensional hidden vector h, trained on raw data input x.
  - Autoencoder residuals computed as r = x − x̃ (original minus reconstructed).
  - K-means clustering applied to residuals; initial number of clusters chosen as ten via a scree plot.
  - Result: residuals from the first pass tend to cluster but are not clearly separable; time clustering largely vanishes; clusters comprise data points from different countries and both crisis and non-crisis labels.
- Balancing data:
  - Addressed class imbalance via SMOTE to create synthetic crisis data points.
  - Rationale: even in unsupervised learning, a large proportion of no-crisis points can bias cluster identification toward non-crisis observations.
  - After SMOTE applied to time-detrended residuals, clusters show improved separation and crisis-labeled points start to separate from non-crisis points.
- Mode Contrastive Autoencoder (MCAE):
  - Standard autoencoder minimizes reconstruction loss without explicit encouragement of multicluster residual structure.
  - MCAE includes a negative log-likelihood term associated with cluster assignments (see equation (4) in source) to capture multicluster structure while minimizing residuals.
  - Number of clusters treated as hyperparameter; elbow method applied to scree plot of mean squared distance between data points and their centroids for clusters 2 to 20.
  - Analysis based on nine clusters (no substantial gains beyond nine).
  - MCAE applied to residuals from first-pass autoencoder yields nine well differentiated clusters, interpretable as different economic regimes.
  - MCAE clusters contain both crisis and non-crisis points — some clusters are safer (lower crisis frequency) than others; no risk-free clusters.
  - Examination of MCAE residuals indicates small separate residual groupings remain but overall unFEAR extracts an appropriate feature representation for recurrent economic regimes.

### Crisis risk measurement and prediction using clusters
- Approach:
  - A country’s economic fundamentals place it into one cluster; cluster crisis frequency serves as crisis risk measure and can be decomposed by crisis type.
  - unFEAR clustering can be used as a first stage; in a second stage, supervised classification models can be fitted to each cluster (simpler and more precise than a global model).
- Summary of cluster crisis frequencies (Table 2 reproduced as in source):
  - Cluster 0  Cluster 1  Cluster 2  Cluster 3  Cluster 4
  - Crisis data points190307211143168
  - Non-crisis data points244521410036
  - Empirical crisis frequency, in percent43661271
  - Shadow crisis frequency, in percent8940941297
  - Cluster 5  Cluster 6  Cluster 7  Cluster 8
  - Crisis data points2321209474
  - Non-crisis data points33502
  - Empirical crisis frequency, in percent307110085
  - Shadow crisis frequency, in percent889610097
  - Note (from table): "Crisis and non-crisis data points correspond to the number of data points, both observed and synthetic, classified as crisis and non-crisis respectively. Empirical frequency is the ratio of the number of observed crisis data points to the total number of observed data points, and the shadow empirical frequency is the ratio of the number of observed crisis data points to the total number of data points."
- Key empirical frequency findings (explicit percentages stated in text):
  - Low empirical crisis frequency clusters:
    - Cluster 1: empirical crisis frequency = 6 percent; shadow crisis frequency = 40 percent; non-crisis observations = 452, crisis observations = 307.
    - Cluster 3: empirical crisis frequency = 2 percent; shadow crisis frequency = 12 percent; non-crisis observations = 1003, crisis observations = 143.
  - From shadow crisis frequency perspective only Cluster 1 can be characterized as low crisis risk (12 percent reported earlier in text for shadow—note Table 2 shows 40 percent in-line; the source discusses shadow perspective characterization explicitly).
  - High empirical crisis frequency clusters (empirical and shadow frequencies given in text):
    - Cluster 0: empirical crisis frequency = 43 percent, shadow crisis frequency = 89 percent; non-crisis observations = 24, crisis observations = 190.
    - Cluster 2: empirical crisis frequency = 61 percent, shadow crisis frequency = 94 percent; non-crisis observations = 14, crisis observations = 211.
    - Cluster 4: empirical crisis frequency = 71 percent, shadow crisis frequency = 97 percent; non-crisis observations = 6, crisis observations = 168.
    - Cluster 5: empirical crisis frequency = 30 percent, shadow crisis frequency = 88 percent; non-crisis observations = 33, crisis observations = 232.
    - Cluster 6: empirical crisis frequency = 71 percent, shadow crisis frequency = 96 percent; non-crisis observations = 5, crisis observations = 120.
    - Cluster 7: empirical crisis frequency = 100 percent, shadow crisis frequency = 100 percent; non-crisis observations = 0, crisis observations = 94.
    - Cluster 8: empirical crisis frequency = 85 percent, shadow crisis frequency = 97 percent; non-crisis observations = 2, crisis observations = 74.
- Illustrative decomposition example (from text):
  - If a country is assigned to cluster 8 (empirical frequency = 85 percent), the decomposition reported in the source is: financial crisis risk 24 percent (2/7 of 85 percent), exchange market pressure crisis 24 percent, real sector crisis 24 percent, fiscal sector crisis 13 percent. The source notes the risk of simultaneous crises seems negligible.
- Additional observations and potential extensions:
  - Some countries in the same cluster do not experience crises; analyzing crisis vs. non-crisis observations within a cluster can help understand why.
  - Fitting supervised classification models within each cluster is relatively straightforward compared with fitting a global model; unFEAR can provide improved precision for crisis prediction by using cluster-specific supervised models.

### Conclusions (as presented in source)
- Supervised learning-based crisis prediction models face the biased label problem: countries with similar weak fundamentals may or may not experience a crisis because of luck or policy actions; problem worsens with longer prediction horizons.
- Unsupervised learning can avoid biased label problem by clustering countries on similarity of fundamentals.
- unFEAR introduced: an unsupervised feature extraction clustering method using a novel mode contrastive autoencoder able to identify observation clusters, handle time effects and missing data efficiently.
- Application to advanced economies suggests eight different clusters associated with economic regimes; only one cluster comprising most observations could be considered low risk.
- Cluster assignment serves to assess crisis risk and can be used as building blocks for simpler, more precise supervised crisis prediction models.

*Source: IMF Working Paper — 4. Application: Identification of Economic Crisis Clusters*

### References

### References

### Machine learning, deep learning, and neural network methods
- Alain, G., Y. Bengio. 2014. “What regularized auto-encoders learn from the data-generating distribution.”J. of Machine Learning Research15: 3743—3773.
- Arora, R., A. Basu, P. Mianjy, A. Mukherjee. 2018. “Understanding Deep Neural Networks with Rectified Linear Units.”International Conference on Learning Representations.
- Beutel, J., S. List, G. von Schweinitz. 2018. “An evaluation of early warning models for systemic banking crises: does machine learning improve predictions?” Discussion Paper No. 48/2018 (Frankfurt, Deutsche Bundesbank).
- Clevert, D.-A., T. Unterthiner, S. Hochreiter. 2016. “Fast and accurate deep network learning by exponential linear units (ELUs).”Fourth International Conference on Learning Representations.
- Goodfellow, I., Y. Bengio, a. Courville. 2016.Deep Learning. MIT Press.
- Klambauer, G., T. Unterthiner, A. Mayr. 2017. “Self-normalizing neural networks.”31st Conference on Neural Information Processing Systems (NIPS 2017). Long Beach, California.
- Pascanu, R., G. Montufar, Y. Bengio. 2014. “On the number of response regions of deep feed forward networks with piece-wise linear activations.”International Conference on Learning Representations.
- Rezende, D.J., Mohamed, S., Wierstra, D., 2014. Stochastic Backpropagation and Approximate Inference in Deep Generative Models. arXiv Prepr. arXiv1401.4082.
- Vincent, P., H. Larochelle, Y. Bengio, P.-A. Manzagol. 2010. “Stacked Denoising Autoencoders: Learning Useful Representations in a Deep Network with a Local Denoising Criterion.”The Journal of Machine Learning Research11: 3371-3408.
- Vincent, P., H. Larochelle, Y. Bengio, P.-A. Manzagol. 2008. “Extracting and composing robust features with denoising autoencoders.”Proceeding ICML ’08 Proceedings of the 25th international Conference on Machine learning.
- Xie, J., R. Girshick, A. Farhadi. 2016. “Unsupervised deep embedding for clustering analysis.”Proceeding ICML’16 Proceedings of the 33rd International Conference on International Conference on Machine Learning48: 478—487.
- Klambauer, G., T. Unterthiner, A. Mayr. 2017. “Self-normalizing neural networks.”31st Conference on Neural Information Processing Systems (NIPS 2017). Long Beach, California.
- de O?a, J., C. Garrido. 2014. “Extracting the contribution of independent variables in neural network models: a new approach to handle instability.”Neural Computation & Applicactions 25: 859.
- Holpainen, M., P. Sarlin. 2017. “Toward robust early-warning models: a horse race, ensembles and model uncertainty.”Quantitative Finance17(12): 1933—1963.
- Lang, J., T. Peltonen, P. Sarlin. 2018. “A framework for early-warning modeling with an application to banks.” ECB Working Paper 2182 (Frankfurt, European Central Bank).

### Early warning systems, crisis prediction, and systemic risk
- Ahuja, A., K. Wiseman, M. Syed. 2017. “Assessing country risk — selected approaches.” IMF Technical Notes and Manuals 17/08 (Washington: International Monetary Fund).
- Alessi, L. et al. 2014. “Comparing different early warning systems: results from a horse race competition among members of the Macro-prudential Research Network.” Mimeo.
- Basu, S., M. Chamon, C. Crowe. 2017. “A model to assess the probabilities of growth, fiscal, and financial crises.” IMF Working Paper WP/17/282.
- Babecky, J. T. Havranek, J. Mateju, M. Rusnak, KI. Smidkova, B. Vacisek. 2012. “Banking, debt, and currency crises: early warning indicators for developed countries.” ECB Working Paper 1485 (Frankfurt, European Central Bank).
- Berg, A., C. Pattillo. 1999. “Are currency crisis predictable? A test.”IMF Staff Papers46(2): 107–138.
- Chamon, M., C. Crowe. 2013. “Predictive indicators of financial crises.” In Caprio, G., T. Beck, S. Claessens, S. Schmukler (eds.).The Evidence and Impact of Financial Globalization(Academic Press).
- Christofides, C.T., T.S. Eicher, C. Papageorgiou. 2016. “Did established early warning signals predict the 2008 crisis?”European Economic Review81(1): 103—114.
- Kaminsky, G.L., S. Lizondo, C.M. Reinhart. 1998. “Leading indicators of currency crises.”IMF Staff Papers 45(1): 1—48.
- Laeven, L., F. Valencia. 2013. “Systemic banking crises: a new database.”IMF Economic Review61(2): 225—270
- Lang, J., T. Peltonen, P. Sarlin. 2018. “A framework for early-warning modeling with an application to banks.” ECB Working Paper 2182 (Frankfurt, European Central Bank).
- Holpainen, M., P. Sarlin. 2017. “Toward robust early-warning models: a horse race, ensembles and model uncertainty.”Quantitative Finance17(12): 1933—1963.
- Beutel, J., S. List, G. von Schweinitz. 2018. “An evaluation of early warning models for systemic banking crises: does machine learning improve predictions?” Discussion Paper No. 48/2018 (Frankfurt, Deutsche Bundesbank).

### Crisis impacts, recovery, and macroeconomic perspectives
- Alexander, M., M. Harding, C. Lamarche. 2008. “The human cost of economic crises.” SIEPR Working Paper 08-029. Stanford Institute for Economic Policy Research.
- Cerra, V., S. Saxena. 2008. “Growth dynamics: the myth of economic recovery.”American Economic Review 98(1): 439—57.
- Christiano, L.J., M.S. Eichenbaum, M. Trabandt. 2018. “On DSGE models.”J. of Economic Perspectives 32(3): 113—140.
- Reinhart, C.M., K.S. Rogoff. 2014. “Recovery from financial crises: evidence from 100 episodes.”American Economic Review104(5): 50—55.
- van Dijk, M. 2013. “The social cost of financial crises.” Mimeo. Rotterdam School of Management, Erasmus University.
- Stiglitz, J. 2017. “Where modern macroeconomics went wrong.” NBER Working Paper No. 23795, National Bureau for Economic Research (Cambridge, Massachusetts).

### Fiscal crises and currency crises
- Medas, P. T. Poghosyan, Y. Xu, J. Farah-Yacoub, K. Gerling. 2018. “Fiscal crises.”J. of International Money and Finance88: 191—207.
- Frankel, J.A., A.K. Rose. 1996. “Currency crashes in emerging markets: and empirical treatment.”J. of International Economics41(3-4), 351—366.
- Kaminsky, G.L., S. Lizondo, C.M. Reinhart. 1998. “Leading indicators of currency crises.”IMF Staff Papers 45(1): 1—48.
- Babecky, J. T. Havranek, J. Mateju, M. Rusnak, KI. Smidkova, B. Vacisek. 2012. “Banking, debt, and currency crises: early warning indicators for developed countries.” ECB Working Paper 1485 (Frankfurt, European Central Bank).

### Handling imbalanced data, missing data, and label bias
- Chawla, N.V. N. Japkowicz, A. Kotcz. 2004. “Special issue on learning from imbalanced data sets.”ACM Sigkdd Explorations Newsletter6(1): 1—117.
- Chawla, N.V., K.W. Bowyer, L.O. Hall, W.P. Kegelmeyer. 2002. “SMOTE: synthetic minority over-sampling technique.”J. of Artificial Intelligence Research16: 321—357.
- Kotsiantis, S., D. Kanellopoulos, P. Pintelas. 2006. “Handling imbalanced datasets: a review.”GESTS International Transactions on Computer Science and Engineering30: 25—36.
- van Buuren, S. 2007. “Multiple imputation of discrete and continuous data by fully conditional specification.” Statistical Methods in Medical Research16(3): 219—242.
- Dempster, A., N. Laird, D. Rubin. 1977. “Maximum likelihood from incomplete data via the EM algorithm.” J. of the Royal Statistical Society Series B (Methodological)39 (1): 1—38.
- Raghunathan, T.E., J.M. Lepkowski, J. vanHoewyk, P.A. Solenberg. 2001. “A Multivariate technique for multiply imputing missing values using a sequence of regression models.”Survey Methodology27(1): 85—95.
- Jiang, H., O. Nachum. 2019. “Identifying and correcting label bias in machine learning.” Google Research.

### Visualization, dimensionality reduction, and clustering
- van der Maaten, L., G. Hinton. 2008. “Visualizing Data using t-SNE.”Journal of Machine Learning Research 1: 1—48
- Xie, J., R. Girshick, A. Farhadi. 2016. “Unsupervised deep embedding for clustering analysis.”Proceeding ICML’16 Proceedings of the 33rd International Conference on International Conference on Machine Learning48: 478—487

*References section, wpiea2020262-print-pdf*

---


_Source: https://www.imf.org/-/media/files/publications/wp/2020/english/wpiea2020262-print-pdf.pdf_
