Use Generated Data for Stress Test Predictions
Stress testing in the context of time series refers to a risk management and validation technique that assesses how a model performs under different conditions, typically involving changes in the variables. The goal of stress testing is to evaluate the resilience of a system, portfolio, or model to such extreme scenarios.
In this Shortcut, you will apply a linear autoregressive machine learning model to forecast the next change in the ISM Purchasing Managers Index (ISM PMI), a widely followed monthly economic indicator in the United States that provides insights into the health and direction of the country’s manufacturing sector.
Following the same previous Shortcuts, you will use a VAE to generate synthetic data that resembles the ISM PMI’s differenced values (to impose stationarity), and then you will fit and predict the regression models on every generated piece of data. The aim is to see if there is a significant different between the accuracy (hit ratio) of the data (original and synthetic).
You must download the ISM PMI data from this repository first. Use the following code to apply the Shortcut:
# Importing the required librariesimportnumpyasnpimporttensorflowastfimportmatplotlib.pyplotaspltimportpandasaspd# Fetch S&P 500 price datadata=np.reshape(np.array(pd.read_excel('ISM_PMI.xlsx')),(-1))data=np.diff(data)# Define the VAE model
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access