Skip to content

Commit

Permalink
added auto_extend
Browse files Browse the repository at this point in the history
  • Loading branch information
MaiBe-ctrl committed Jun 19, 2024
1 parent 9f7d1d7 commit cfde05b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions neuralprophet/forecaster.py
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,7 @@ def fit(
self.fitted = True
return metrics_df

def predict(self, df: pd.DataFrame, decompose: bool = True, raw: bool = False):
def predict(self, df: pd.DataFrame, decompose: bool = True, raw: bool = False, auto_extend=False):
"""Runs the model to make predictions.
Expects all data needed to be present in dataframe.
Expand Down Expand Up @@ -1181,8 +1181,8 @@ def predict(self, df: pd.DataFrame, decompose: bool = True, raw: bool = False):
quantiles=self.config_train.quantiles,
components=components,
)
# if periods_added[df_name] > 0:
# fcst = fcst[:-1]
if not auto_extend and periods_added[df_name] > 0:
fcst = fcst[:-1]
else:
fcst = _reshape_raw_predictions_to_forecst_df(
df=df_i,
Expand All @@ -1196,8 +1196,8 @@ def predict(self, df: pd.DataFrame, decompose: bool = True, raw: bool = False):
quantiles=self.config_train.quantiles,
config_lagged_regressors=self.config_lagged_regressors,
)
# if periods_added[df_name] > 0:
# fcst = fcst[: -1]
if not auto_extend and periods_added[df_name] > 0:
fcst = fcst[: -1]

Check warning on line 1200 in neuralprophet/forecaster.py

View check run for this annotation

Codecov / codecov/patch

neuralprophet/forecaster.py#L1200

Added line #L1200 was not covered by tests
forecast = pd.concat((forecast, fcst), ignore_index=True)

df = df_utils.return_df_in_original_format(forecast, received_ID_col, received_single_time_series)
Expand Down

0 comments on commit cfde05b

Please sign in to comment.