johannfaouzi/pyts

Creating a sequence of GAF's from a timeseries

Opened this issue · 2 comments

I'm looking to train a Connectionist Temporal Classification (CTC) classifier. The input is a sequence of tensors of length N and the output a sequence of length M, M<N. I want to use a Gramian Angular Field to encode the input sequence.

From what I understand pyts Gramian Angular Field encodes the entire input to a single output? So given a series of 1x1000 where 1 is the batch dimension and 1000 is the series length, I get back a single tensor 1x32x32, what I want is Bx32x32 where B is the number of windows.

Is there a way of doing this using pyts? I'm guessing I could just reshape the input from 1x1000 to say 10x100 but is there a transform which does this, perhaps with overlap etc?

Hi,

There is indeed a function in pyts to extract windows from time series: pyts.utils.windowed_view. It has two arguments:

  • window_size: the size of each window,
  • window_step: the step between each window.

Since machine learning usually requires several samples, the input must be a 2D array and the output is a 3D array, but you just have to reshape the single time series from a 1D array to a 2D array and discard the first dimension of the output.

Let me know if this answers your question and feel free to ask more questions if needed.

Thanks yes this is what I was looking for