Is your feature request related to a problem? Please describe.
When using the TimeSeriesDataset.prettify_prediction() method in flaml/automl/time_series/ts_data.py, if test_data is None, the function throws a NotImplementedError instead of automatically generating timestamps for the prediction output:
# ts_data.py, line 251-252
# TODO auto-create the timestamps for the time column instead of throwing
raise NotImplementedError("Need a non-None test_data for this to work, for now")
This is frustrating for users who want to make predictions without providing explicit test data timestamps, which is a common use case in time series forecasting.
Describe the solution you'd like
Implement automatic timestamp generation based on:
- The training data's frequency - Infer the frequency from
self.frequency (already available in the dataset)
- The last timestamp in training data - Use
self.end_date as the starting point
- The prediction horizon - Generate the appropriate number of future timestamps
Example implementation approach:
if self.test_data is None:
# Auto-generate timestamps based on frequency and end_date
pred_timestamps = pd.date_range(
start=self.end_date + pd.Timedelta(self.frequency),
periods=len(y_pred),
freq=self.frequency
)
y_pred[self.time_col] = pred_timestamps
Additional context
- The
TimeSeriesDataset class already has self.frequency and self.end_date attributes that can be used for this purpose
- This would align with how other time series libraries (e.g., statsmodels, Prophet) handle predictions
- The existing
create_forward_frame() function in the same file already implements similar logic for creating future timestamps, which could be reused
Is your feature request related to a problem? Please describe.
When using the
TimeSeriesDataset.prettify_prediction()method inflaml/automl/time_series/ts_data.py, iftest_dataisNone, the function throws aNotImplementedErrorinstead of automatically generating timestamps for the prediction output:This is frustrating for users who want to make predictions without providing explicit test data timestamps, which is a common use case in time series forecasting.
Describe the solution you'd like
Implement automatic timestamp generation based on:
self.frequency(already available in the dataset)self.end_dateas the starting pointExample implementation approach:
Additional context
TimeSeriesDatasetclass already hasself.frequencyandself.end_dateattributes that can be used for this purposecreate_forward_frame()function in the same file already implements similar logic for creating future timestamps, which could be reused