Spaces:
Sleeping
Sleeping
Commit ·
f7d4b1d
1
Parent(s): 1984dda
Update Support_module_dir/support_function_predict.py
Browse files
Support_module_dir/support_function_predict.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
import time
|
| 2 |
import warnings
|
|
|
|
| 3 |
import pandas as pd
|
| 4 |
|
| 5 |
|
|
@@ -15,7 +16,7 @@ def predict_function(trained_model, dataset, forecast_days):
|
|
| 15 |
|
| 16 |
Returns
|
| 17 |
-------
|
| 18 |
-
predict_frame : pandas Dataframe
|
| 19 |
execution_time : float
|
| 20 |
Execution time for making predictions.
|
| 21 |
"""
|
|
@@ -45,8 +46,10 @@ def predict_function(trained_model, dataset, forecast_days):
|
|
| 45 |
last_date = dataset.index[-2]
|
| 46 |
|
| 47 |
# Generate a new DataFrame with the dates for the next x number of steps
|
| 48 |
-
new_dates = pd.date_range(
|
| 49 |
-
|
|
|
|
|
|
|
| 50 |
|
| 51 |
# Print or use the confidence interval
|
| 52 |
predict_frame = pd.DataFrame({"Date": new_dates, "Lower_Bound": confidence_interval.iloc[:, 0],
|
|
|
|
| 1 |
import time
|
| 2 |
import warnings
|
| 3 |
+
from Variable_artifects.artifact import FORECAST_DAY
|
| 4 |
import pandas as pd
|
| 5 |
|
| 6 |
|
|
|
|
| 16 |
|
| 17 |
Returns
|
| 18 |
-------
|
| 19 |
+
predict_frame : pandas Dataframe with predicted values and corresponding dates.
|
| 20 |
execution_time : float
|
| 21 |
Execution time for making predictions.
|
| 22 |
"""
|
|
|
|
| 46 |
last_date = dataset.index[-2]
|
| 47 |
|
| 48 |
# Generate a new DataFrame with the dates for the next x number of steps
|
| 49 |
+
new_dates = pd.date_range(
|
| 50 |
+
start=last_date,
|
| 51 |
+
periods=PERIODS,
|
| 52 |
+
freq='B')[1:] # 'B' stands for business day), [1:] Exclude the last_date
|
| 53 |
|
| 54 |
# Print or use the confidence interval
|
| 55 |
predict_frame = pd.DataFrame({"Date": new_dates, "Lower_Bound": confidence_interval.iloc[:, 0],
|