Skip to content

keras.utils.timeseries_dataset_from_array example bugs #21305

Open
@zhangpanzhan

Description

@zhangpanzhan
  1. if you refer to documentary of timeseries_dataset_from_array, there is an example similarly like this ( I changed parameter for quickly proof):
data = np.arange(10)
x = data[:-3] # x will be [0, 1, 2, 3, 4, 5, 6]
y = data[3:]  # y will be [3, 4, 5, 6, 7, 8, 9]
batch_data = timeseries_dataset_from_array(x, y, 3, 1)
for input, target in batch_data:
    print(input, target)

It will create samples like [0, 1, 2], [1, 2, 3], [2, 3, 4], [3, 4, 5],[4, 5, 6] with labels [3, 4, 5, 6, 7].
However, obviously, it misses samples [5, 6, 7], [6, 7, 8] with lables [8, 9].

Image

The api may expected to have the x, and y with same length, but it will miss some samples.
However, if you feed x with data, and y, the output should be correct.
That means, the example 2 in this api should be changed!!!

Image

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions