arundo / tsaug

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

ValueError: The numbers of series in X and Y are different. #13

Open talhaanwarch opened 4 years ago

talhaanwarch commented 4 years ago

The shape of X is (54, 337) and the shape of y is (54,). But I am getting error. I am using the following code

from tsaug import TimeWarp, Crop, Quantize, Drift, Reverse
my_augmenter = (
    TimeWarp() * 5  # random time warping 5 times in parallel
    + Crop(size=300)  # random crop subsequences with length 300
    + Quantize(n_levels=[10, 20, 30])  # random quantize to 10-, 20-, or 30- level sets
    + Drift(max_drift=(0.1, 0.5)) @ 0.8  # with 80% probability, random drift the signal up to 10% - 50%
    + Reverse() @ 0.5  # with 50% probability, reverse the sequence
)
data, labels = my_augmenter.augment(data, labels)
tailaiw commented 4 years ago

The Y in tsaug is considered as point-wise label to X. In other words, if Y is present, then it is assumed for segmentation purpose. I guess your problem is a classification problem as you have 54 time series (each of which has 337 time points) and your label is per series instead of per time point. If so, you only need to augment X and assume the classification labels invariant.

talhaanwarch commented 4 years ago

The Y in tsaug is considered as point-wise label to X. In other words, if Y is present, then it is assumed for segmentation purpose. I guess your problem is a classification problem as you have 54 time series (each of which has 337 time points) and your label is per series instead of per time point. If so, you only need to augment X and assume the classification labels invariant.

After doing this, shape of X is (270, 300) and the shape of y is (54,). So how can I make the shape of y equal in length of X? Is each row is augmented exactly the 5 times? or there are some rows augmented more and some less.

tailaiw commented 4 years ago

Yes, every row is augmented exactly 5 times.