View source on GitHub |
Utility class for generating batches of temporal data.
Inherits From: Sequence
tf.keras.preprocessing.sequence.TimeseriesGenerator(
data,
targets,
length,
sampling_rate=1,
stride=1,
start_index=0,
end_index=None,
shuffle=False,
reverse=False,
batch_size=128
)
This class takes in a sequence of data-points gathered at equal intervals, along with time series parameters such as stride, length of history, etc., to produce batches for training/validation.
Returns | |
---|---|
A Sequence instance. |
Examples | |
---|---|
|
Methods
get_config
get_config()
Returns the TimeseriesGenerator configuration as Python dictionary.
Returns | |
---|---|
A Python dictionary with the TimeseriesGenerator configuration. |
on_epoch_end
on_epoch_end()
Method called at the end of every epoch.
to_json
to_json(
**kwargs
)
Returns a JSON string containing the generator's configuration.
Args | |
---|---|
**kwargs
|
Additional keyword arguments to be passed
to json.dumps() .
|
Returns | |
---|---|
A JSON string containing the tokenizer configuration. |
__getitem__
__getitem__(
index
)
Gets batch at position index
.
Args | |
---|---|
index
|
position of the batch in the Sequence. |
Returns | |
---|---|
A batch |
__iter__
__iter__()
Create a generator that iterate over the Sequence.
__len__
__len__()
Number of batch in the Sequence.
Returns | |
---|---|
The number of batches in the Sequence. |