arundo / tsaug

A Python package for time series augmentation
https://tsaug.readthedocs.io
Apache License 2.0
347 stars 37 forks source link

How to augment multi_variate time series data? #9

Open talhaanwarch opened 4 years ago

talhaanwarch commented 4 years ago

I noticed that while augmenting multi-variate time series data, augmented data is concatenated on 0 axes, instead of being added to a new axis ie third axis. Let suppose data shape is (18,1000), after augmentation it turns to be (72,1000), but i believe it should be (4,18,1000). simply reshaping data.reshape(4,18,1000) resolve the problem or not?

tailaiw commented 4 years ago

@talhaanwarch An input X should be a numpy array with shape (n,), (N, n), or (N, n, c), where n is the length of each series, N is the number of series, and c is the number of channels. Therefore, if we have a single original time series with 18 channels and 1000 time points, the shape of X should be (1, 1000, 18). Augmenting it by M times will return an output with shape (M, 1000, 18).

X = np.cumsum(np.random.normal(size=(1,1000, 18)), axis=1)  # (1, 1000, 18)
plot(X)

image

aug = tsaug.RandomTimeWarp() * 4
X_aug = aug.run(X)    # (4, 1000, 18)
plot(X_aug)

image

talhaanwarch commented 4 years ago

How can I get an original signal after augmentation, I think I lost that, if I don't save it explicitly and then concatenate augmented and the original signal