├── Forecasting Code for Mutivariate Time Series Data.ipynb ├── Housing market data.xlsx ├── LICENSE └── README.md /Housing market data.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IDB-FOR-DATASCIENCE/Predictive-Excellence-Engine/849d995b6a00df9ca13c898faf29421c2a6d46c5/Housing market data.xlsx -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Indraneel D Baruah 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Predictive-Excellence-Engine 2 | In this notebook, we will create an AI and time serie driven forecasting engine based on a set of 5 AI models and 5 time series models and employ several algorithms to perform feature engennering and selection on a multivaraite time series dataset. We are trying to find the best drivers of the HK flat price using various macro economics data.The dataset we are using is the 'HK macroeconomics data' from Kaggle. It is a daily dataset starting from 2nd January 2003 and goes on till 26th November 2019. The target variable is 'Private Domestic (Price Index)' and there 12 features which can help us forecast HK flat price. The dataset can be found [here](https://www.kaggle.com/stanley11291985/hk-macroeconomics-data). 3 | 4 | We will first do exploratory data analysis on the data and then move on to data cleaning where we do the following: 5 | 1. Check if any dates are missing and add the missing dates 6 | 2. Use linear interpolation to fill the nulls (we will also provide the code for forward and backward fill 7 | 3. Perform outlier detection 8 | 4. Perform outlier treatment 9 | 5. Check time series components, ACF and PACF plots of target variable 10 | 11 | Once the data has been cleaned up, we will create the following additional features: 12 | 1. 3 lags for each feature 13 | 2. Daily change for each feature 14 | 3. A flag for holidays 15 | 4. Flag for S&P 500 index 16 | 5. Calculate First hand sales price and drop the sales amount variable 17 | 18 | The next step is to perform featue selection using the following techniques: 19 | 1. Select the top n features based on feature importance from random forest 20 | 2. Select the top n features based on absolute correlation with target variable 21 | 3. Select the features identified by Lasso regression 22 | 4. Select features by recursively considering smaller and smaller sets of features 23 | 5. Select the top n features based on absolute value of beta coefficients of features 24 | 25 | The final features are the ones selected in at least 3 out of 5 models. 26 | 27 | After feature selection, we train a set of 10 models (and perform hyper parameter tuning wherever required): 28 | 1. SARIMA (Univariate Time Series) 29 | 2. Holt Winters (Univariate Time Series) 30 | 3. SARIMAX(Multi-variate Time Series) 31 | 4. VAR(Multi-variate Time Series) 32 | 5. VECM(Multi-variate Time Series) 33 | 6. LSTM (Univariate Time Series) 34 | 7. Random Forest (Multi-variate AI) 35 | 8. XGBoost (Multi-variate AI) 36 | 9. Linear Regression (Multi-variate AI) 37 | 10. SVR (Multi-variate AI) 38 | 39 | We make predictions for the next year using all the models and then take their average as the final predictions. 40 | 41 | --------------------------------------------------------------------------------