Linear Regression Model for Energy Consumption Prediction
Description
This linear regression model predicts energy consumption based on meteorological data and historical energy usage from 2021 to 2023. It utilizes time series data from a transformer station to forecast future energy demands. It is built using the statsmodels
library in Python and incorporates both time-based and weather-related variables to enhance prediction accuracy.
Model Details
- Model Type: Linear Regression
- Data Period: 2021-2023
- Variables Used:
Lastgang
: Energy consumption dataHour
: Hour of the dayDayOfWeek
: Day of the weekLastgang_Moving_Average
: Moving average of energy consumptionLastgang_First_Difference
: First difference of energy consumption
Features
The model splits the data into training and testing sets, with the last 192 data points (equivalent to 48 hours at 15-minute intervals) designated as the test dataset. It defines target variables (Lastgang
) and explanatory variables including hourly and daily patterns as well as derived features from the consumption data. The dataset includes preprocessed features such as scaled energy consumption (Lastgang
), and time-related features (Hour
, DayOfWeek
).
Installation and Execution
To run this model, you need Python along with the following libraries:
pandas
numpy
matplotlib
statsmodels
sklearn
To execute the model:
- Load your dataset into a pandas DataFrame.
- Ensure that the data is formatted according to the specifications mentioned in the model details.
- Run the script provided in the
Prediction_Linear-Regression.ipynb
notebook.