Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove type conversion for _stride_lagged_features and _stride_future… #1331

Merged
merged 1 commit into from
May 24, 2023
Merged
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
16 changes: 4 additions & 12 deletions neuralprophet/time_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,20 +314,12 @@ def tabularize_univariate_datetime(
inputs = OrderedDict({})

def _stride_time_features_for_forecasts(x):
# only for case where n_lags > 0
if x.dtype != np.float64:
dtype = np.datetime64
else:
dtype = np.float64
return np.array([x[i + max_lags - n_lags : i + max_lags + n_forecasts] for i in range(n_samples)], dtype=dtype)
return np.array(
[x[i + max_lags - n_lags : i + max_lags + n_forecasts] for i in range(n_samples)], dtype=x.dtype
)

def _stride_future_time_features_for_forecasts(x):
# only for case where n_lags > 0
if x.dtype != np.float64:
dtype = np.datetime64
else:
dtype = np.float64
return np.array([x[max_lags + i : max_lags + i + n_forecasts] for i in range(n_samples)], dtype=dtype)
return np.array([x[max_lags + i : max_lags + i + n_forecasts] for i in range(n_samples)], dtype=x.dtype)

def _stride_lagged_features(df_col_name, feature_dims):
# only for case where max_lags > 0
Expand Down