Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating a sequence of GAF's from a timeseries #93

Open
david-waterworth opened this issue Mar 23, 2021 · 2 comments
Open

Creating a sequence of GAF's from a timeseries #93

david-waterworth opened this issue Mar 23, 2021 · 2 comments

Comments

@david-waterworth
Copy link

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?

@johannfaouzi
Copy link
Owner

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.

@david-waterworth
Copy link
Author

Thanks yes this is what I was looking for

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants