View source on GitHub
|
Utility class for generating batches of temporal data.
Inherits From: PyDataset
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
)
DEPRECATED.
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.
Arguments |
|---|
data
targets
data.
It should have same length as data.
length
sampling_rate
r, timesteps
data[i], data[i-r], ... data[i - length]
are used for create a sample sequence.
stride
s, consecutive output samples would
be centered around data[i], data[i+s], data[i+2*s], etc.
start_index
start_index will not be used
in the output sequences. This is useful to reserve part of the
data for test or validation.
end_index
end_index will not be used
in the output sequences. This is useful to reserve part of the
data for test or validation.
shuffle
reverse
true, timesteps in each output sample will be
in reverse chronological order.
batch_size
Returns | |
|---|---|
| A PyDataset instance. |
Attributes |
|---|
max_queue_size
num_batches
use_multiprocessing
workers
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
json.dumps().
| Returns | |
|---|---|
| A JSON string containing the tokenizer configuration. |
__getitem__
__getitem__(
index
)
Gets batch at position index.
| Args |
|---|
index
| Returns | |
|---|---|
| A batch |
__len__
__len__()
View source on GitHub