`timeseries_dataset_from_array()` - Slide over both `data` and `targets` in Tandem for Sequence-to-Sequence Predictions
I am looking to perform sequence-to-sequence predictions, so need to slide over x and y simultaneously, producing vectors of equal length at the same time. It seems that timeseries_dataset_from_array() by default outputs just one sample, more akin to sequence-to-value problems. I think it owuld be good to add this capability as a parameter to the function.
I have a basic implementation, and haven't opened a PR, as I don't have the time or knowledge to test thoroughly, but I have my changes in this branch here, which you are of course free to take if you want to use at all. So far it "works for me", and if I hit any bugs down the line I'll push updates there.
Personally, having previously had hard-to-diagnose headaches with sliding windows, I would also suggest adding an option for whether to take the first or last element inthe window for targets (I was under the impression it owuld be the last, but upon inspection it seems the first is taken implicitly), and also mirror the drop_remainder parameter, to discard any batches that are not full, since this will cause an error if inputting to a networkand I have had to do this manually form outside the function.
Thanks!
What are some example input and outputs with your change?
I would think if we wanted targets to be a sequence to we would want to add a parameter along the lines of target_sequence_length, but I don't see that in your version.
I guess you could have different window lengths for the input and output, although that would increase the complexity. In my modifications it's just a binary one value or many values. At that point it could perhaps be simpler as a minimal class, rather than all in one function.
I'm working with a simple signal taken at regular intervals, and trying to filter it. So, I'm training the model on a window of the last second or so of data, and its job is to predict the last second or so of the filtered signal. Hence I just need a dataset that moves the window one by one over both.