3.2 TimeDataset

時系列データはTimeDatasetクラスで作成できます。

from ivory.common.context import np
from ivory.common.dataset import TimeDataset

x = np.arange(128).reshape(-1, 4)
t = x[:, 0]
data = TimeDataset((x, t), batch_size=2, time_size=4)
data
for x, t in data:
    print(data.state)
    print(t)
print(data.shape, x.shape, t.shape)

[1] 2019-06-14 16:03:12 (201ms) python3 (201ms)

(0, 0, 0)
[[ 0  4  8 12]
 [64 68 72 76]]
(-1, 1, 1)
[[16 20 24 28]
 [80 84 88 92]]
(-1, 2, 2)
[[ 32  36  40  44]
 [ 96 100 104 108]]
(1, 3, 3)
[[ 48  52  56  60]
 [112 116 120 124]]
((2, 4, 4), (2, 4)) (2, 4, 4) (2, 4)