timeseriesAI / tsai

Time series Timeseries Deep Learning Machine Learning Python Pytorch fastai | State-of-the-art Deep Learning library for Time Series and Sequences in Pytorch / fastai
https://timeseriesai.github.io/tsai/
Apache License 2.0
4.95k stars 625 forks source link

bug in forecasting splits indices computation #776

Open lo-zed opened 1 year ago

lo-zed commented 1 year ago

When function get_forecasting_splits is used with the argument unique_id_cols, the computation for the split indices is wrong. The function only substracts fcst_history - 1 from the data frame indices, which is incorrect since this can accumulate when several ids are present.

See the attached code for a minimal example and a proposition on how to solve it.

bug_report_indices.txt

Edit: changed the zip file to a txt file

lo-zed commented 1 year ago

line 87 of my file 'bug_report_indices.txt' I forgot to add [0] at the end. The line should read

            valid_idxs = np.where((usable_step_codes >= valid_start))[0]  # CORRECTED