Spaces:
Sleeping
Sleeping
Daniel Varga
commited on
Commit
•
7c98739
1
Parent(s):
0ea2c50
holidays
Browse files- demo_prophet.py +6 -1
demo_prophet.py
CHANGED
@@ -2,6 +2,7 @@ import numpy as np
|
|
2 |
import pandas as pd
|
3 |
import matplotlib.pyplot as plt
|
4 |
from prophet import Prophet
|
|
|
5 |
import logging
|
6 |
|
7 |
|
@@ -9,6 +10,9 @@ import logging
|
|
9 |
PREDICTION_LOWER_BOUND = 0 # 15
|
10 |
print("do not forget about hardwired prediction lower bound", PREDICTION_LOWER_BOUND, "kW")
|
11 |
|
|
|
|
|
|
|
12 |
|
13 |
def prediction_task(df, split_date, forecast_horizon):
|
14 |
# Split the data into training (past) and evaluation (future) sets
|
@@ -18,7 +22,8 @@ def prediction_task(df, split_date, forecast_horizon):
|
|
18 |
|
19 |
# Initialize and train the Prophet model using the training data
|
20 |
model = Prophet(seasonality_mode='multiplicative', growth='flat',
|
21 |
-
yearly_seasonality=False, weekly_seasonality=True, daily_seasonality=True
|
|
|
22 |
|
23 |
model.fit(train_data)
|
24 |
|
|
|
2 |
import pandas as pd
|
3 |
import matplotlib.pyplot as plt
|
4 |
from prophet import Prophet
|
5 |
+
import holidays
|
6 |
import logging
|
7 |
|
8 |
|
|
|
10 |
PREDICTION_LOWER_BOUND = 0 # 15
|
11 |
print("do not forget about hardwired prediction lower bound", PREDICTION_LOWER_BOUND, "kW")
|
12 |
|
13 |
+
hungarian_holidays = holidays.Hungary(years=range(2019, 2031))
|
14 |
+
HOLIDAY_DF = pd.DataFrame(list(hungarian_holidays.items()), columns=['ds', 'holiday'])
|
15 |
+
|
16 |
|
17 |
def prediction_task(df, split_date, forecast_horizon):
|
18 |
# Split the data into training (past) and evaluation (future) sets
|
|
|
22 |
|
23 |
# Initialize and train the Prophet model using the training data
|
24 |
model = Prophet(seasonality_mode='multiplicative', growth='flat',
|
25 |
+
yearly_seasonality=False, weekly_seasonality=True, daily_seasonality=True,
|
26 |
+
holidays=HOLIDAY_DF)
|
27 |
|
28 |
model.fit(train_data)
|
29 |
|