This project aims to forecast house prices using a time series analysis approach. It includes data preprocessing and forecasting steps using the SARIMAX model.
-
Data Preprocessing Pipeline
- Cleans and prepares the data for analysis.
-
Forecasting
- Uses the SARIMAX model to predict future house prices for different regions.
-
Missing Data Handling
- Removes rows with more than 50% missing values.
- Uses forward-fill, backward-fill and linear interpolation for numeric columns.
-
Duplicate Handling
- Removes duplicate rows from the dataset.
-
Output
- Saves the processed data to
processed_house_prices.csv.
- Saves the processed data to
-
Data Loading
- Loads processed data from
processed_house_prices.csv.
- Loads processed data from
-
Data Transformation
- Converts data to a long format suitable for time series analysis.
-
Modeling
- Fits a SARIMAX model for each region to forecast house prices.
-
Output
- Saves the forecasted house prices to
house_price_forecast.csvwith values rounded to 4 decimal places.
- Saves the forecasted house prices to
-
Data Loading
- Loads processed data from
processed_house_prices.csvand forecasted data fromhouse_price_forecast.csv
- Loads processed data from
-
Data Transformation
- Transpose the forecasted data.
-
Output
- Saves the combined data to
combined_data.csv.
- Saves the combined data to
- Activate the virtual environment:
# Windows
myenv\Scripts\activate
# Unix/MacOS
source myenv/bin/activate - Install dependencies:
pip install -r requirements.txt - Run the preprocessing script:
python data_preprocessing.py - Run the forecasting script:
python forecast_house_price.py - Run the combine script:
python combine_data.py - Input:
data.csv - Output:
processed_house_prices.csv - Output:
house_price_forecast.csv - Output:
combined_data.csv
See requirements.txt for package dependencies.
- Ensure that the input data is properly formatted and preprocessed before running the forecasting script.
- The forecasting model is set to predict the next 5 months of house prices for each region.