Energy Consumption Prophet - A Machine Learning based Energy Forecast
This function creates a new folder 'minutes' in the given path and saves an according .csv for every data file
python3 src/reduce_dataset_minutes.py --path R:/ecoproph/Dataset/2018
- new file is .csv format
- new file starts with header
- resolution is now minutes
Depending on the number of files this procedure can be pretty time consuming!
- Import the cleaned .csv Data
- Drop all Rows containing err flags
import sys
sys.path.append('C:\\workspace\\ecoproph\\src\\')
import datasetutils as du
directory = "R:\\ecoproph\\Dataset\\2018\\minutes_2018_new"
col_of_interest = ['unixtimestamp', 'YYYYMMDD', 'hhmmss', 'AEZ-P_SUM']
df = du.load_dataset_from_directory_partial(directory, col_of_interest)
print(df.shape)Plotting the data (after cleaning the error fields) results in the following:
![]() |
![]() |
|---|---|
| Data AEZ-PSUM for 2016 | Histogram AEZ-PSUM for 2016 |
![]() |
![]() |
|---|---|
| Data AEZ-PSUM for 2017 | Histogram AEZ-PSUM for 2017 |
![]() |
![]() |
|---|---|
| Data AEZ-PSUM for 2018 | Histogram AEZ-PSUM for 2018 |
- Load the Datasets
- Create a Regression Model with Facebook Prophet
- Fit the model
- Predit the future
- Plot the prediction and save the plots
- Prediction and Training Data
- Regression Components
$ cd src
$ python3 ./ecoproph.py
will save the created plots in the root folder.
Please adapt the script to your needs. Currently, the Paths to the datasets and plot outputs are hardcoded absolute paths. This might be resolved in a later release.
The first step is the most primitive fbprophet model available. No tweaks were made. It's simply the datasets for three years are fit to the primitive model and a forecast for a span of a year is done.
This are the results of the primitive, unoptimized model just at the first shot:
![]() |
|---|
| Facebook Prophet forecast |
![]() |
|---|
| Plot of the regression components |
Validation is done via Prophet's cross-validation method. For validation, a saved model has to be provided via a pickle file. Validation can be started via the following command:
$ cd src
$ python3 ./validation.py
The validation script creates an output plot of the MAPE metric saved as .png file:
![]() |
|---|
| Validation via MAPE metric - plot |









