Time Series Generator documentation
Welcome to Time Series Generator’s documentation!
This documents the python package sourced from the following repository.
Description
Emulates Teras Tensorflow TimeSeriesGenerator functionality presenting a candidate solution for the direct multi-step outputs limitation in Keras version.
Installation
pip install time-series-generator
Usage
Main Functionality
Candidate Improvement
Addition of the keyworded argument length_output
.
# define dataset
series = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
target = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
# define generator
n_input = 2
n_output = 2
generator = TimeseriesGenerator(series, target, length=n_input, length_output=n_output, batch_size=1)
# print each sample
for i in range(len(generator)):
x, y = generator[i]
print('%s => %s' % (x, y))
Output
[[1 2]] => [[3 4]]
[[2 3]] => [[4 5]]
[[3 4]] => [[5 6]]
[[4 5]] => [[6 7]]
[[5 6]] => [[7 8]]
[[6 7]] => [[8 9]]
[[7 8]] => [[9 10]]