Recurrent Neural Networks for Recession Forecast

语言: CN / TW / HK

Recurrent Neural Networks for Recession Forecast

Context

It is widely discussed that the US economy will face another recession in coming years. The question is when and how it will occur. We have seen a decade of economic expansion but it will not last forever. In this article I will try a basic Recurrent Neural Network (RNN) model to foresee how the US economy will grow, or possibly shrink in the near future.

Approach

You may know that we have had not many recession periods in the past few decades, the most recent one being after the Global Financial Crisis of 2008. It can be a hurdle for any machine/deep learning classifier models. One of the definitions of recession is “two consecutive quarters with negative economic growth” thus a regression model to estimate GDP growth should suffice the purpose. Furthermore, with the potential GDP being rather stable, cyclical factor in GDP growth, i.e. the output gap, would be a good target for a regressor model.

This is a time-series analysis and for its autoregressive nature, RNN is one of the most appropriate tools. I used major macroeconomic and financial variables from Federal Reserve Economic Data ( FRED ), provided by the Research division of the Federal Reserve Bank of St. Louis, since the late 1970’s and resampled them into weekly frequency. The input into the RNN model comprises 30 top principal components with 52 time steps of a week i.e. one year. The target here is the output gap of 6-month advance.

Models -LSTM Layers

I started with a simple model with two Long Short-Term Memory (LSTM) layers.

regressor = Sequential()
regressor.add(LSTM(units=50, 
 return_sequences=True, 
 input_shape=(X_train_rnn.shape[1], 
 X_train_rnn.shape[2])))
regressor.add(Dropout(drop_out))

regressor.add(LSTM(units=50))
regressor.add(Dropout(drop_out))regressor.add(Dense(units=1))regressor.compile(optimizer='adam',
 loss='mean_squared_error')

Following figure depicts the model predictions for ten times of trials. It is obvious that the predictions fluctuate too much to say the model is reliable.

分享到: