Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions neuralprophet/data/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def _reshape_raw_predictions_to_forecst_df(
forecast = predicted[:, forecast_lag - 1, j]
pad_before = max_lags + forecast_lag - 1
pad_after = n_forecasts - forecast_lag
yhat = np.pad(forecast, (pad_before, pad_after), mode="constant", constant_values=np.NaN)
yhat = np.pad(forecast, (pad_before, pad_after), mode="constant", constant_values=np.nan)
if prediction_frequency is not None:
ds = df_forecast["ds"].iloc[pad_before : -pad_after if pad_after > 0 else None]
mask = df_utils.create_mask_for_prediction_frequency(
Expand All @@ -79,7 +79,7 @@ def _reshape_raw_predictions_to_forecst_df(
)
yhat = np.full((len(ds),), np.nan)
yhat[mask] = forecast
yhat = np.pad(yhat, (pad_before, pad_after), mode="constant", constant_values=np.NaN)
yhat = np.pad(yhat, (pad_before, pad_after), mode="constant", constant_values=np.nan)
# 0 is the median quantile index
if j == 0:
name = f"yhat{forecast_lag}"
Expand All @@ -104,7 +104,7 @@ def _reshape_raw_predictions_to_forecst_df(
forecast = components[comp][:, forecast_lag - 1, j] # 0 is the median quantile
pad_before = max_lags + forecast_lag - 1
pad_after = n_forecasts - forecast_lag
yhat = np.pad(forecast, (pad_before, pad_after), mode="constant", constant_values=np.NaN)
yhat = np.pad(forecast, (pad_before, pad_after), mode="constant", constant_values=np.nan)
if prediction_frequency is not None:
ds = df_forecast["ds"].iloc[pad_before : -pad_after if pad_after > 0 else None]
mask = df_utils.create_mask_for_prediction_frequency(
Expand All @@ -114,7 +114,7 @@ def _reshape_raw_predictions_to_forecst_df(
)
yhat = np.full((len(ds),), np.nan)
yhat[mask] = forecast
yhat = np.pad(yhat, (pad_before, pad_after), mode="constant", constant_values=np.NaN)
yhat = np.pad(yhat, (pad_before, pad_after), mode="constant", constant_values=np.nan)
if j == 0: # temporary condition to add only the median component
name = f"{comp}{forecast_lag}"
df_forecast[name] = yhat
Expand All @@ -126,7 +126,7 @@ def _reshape_raw_predictions_to_forecst_df(
forecast_0 = components[comp][0, :, j]
forecast_rest = components[comp][1:, n_forecasts - 1, j]
yhat = np.pad(
np.concatenate((forecast_0, forecast_rest)), (max_lags, 0), mode="constant", constant_values=np.NaN
np.concatenate((forecast_0, forecast_rest)), (max_lags, 0), mode="constant", constant_values=np.nan
)
if prediction_frequency is not None:
date_list = []
Expand Down
2 changes: 1 addition & 1 deletion neuralprophet/df_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1117,7 +1117,7 @@ def get_freq_dist(ds_col):
tuple
numeric delta values (``ms``) and distribution of frequency counts
"""
converted_ds = pd.to_datetime(ds_col, utc=True).view(dtype=np.int64)
converted_ds = pd.to_datetime(ds_col, utc=True).astype(dtype=np.int64)
diff_ds = np.unique(converted_ds.diff(), return_counts=True)
return diff_ds

Expand Down
Loading