# Recurrent Neural Networks for Recession Forecast

## 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.

- 使用神经网络在表格中查找答案
- Chest X-rays Pneumonia Detection using Convolutional Neural Network
- 别再SOTA了，那叫“微调”！Science发文炮轰论文灌水
- 百度李伟彬：基于PGL的图神经网络基线系统
- Dismantling Neural Networks to Understand the Inner Workings with Math and Pytorch
- The Workflow of Neural Network Explained
- 人人都看得懂的神经网络，如何形象直观地理解深度学习
- AI安全对抗中，只用一招轻松骗过五种神经网络
- Solving a Reinforcement Learning Problem Using Cross-Entropy Method
- Understanding Compression of Convolutional Neural Nets: Part 2