TransWikia.com

How to fit the LSTM model correctly with series data

Data Science Asked on June 14, 2021

I have a small data set with the transformed series vector data with the music genre. The goal for me is to use the LSTM model to learn the non-linear pattern each row for genre classification. The LSTM model is one of the most suitable models for doing this task.

So, my original data set look like this:

vec_1,vec_2,...,vec30,genre
  50    30        0    pop
  .
  .
  .

The shape of the training data is (7678,30), so, at first, I just randomly reshape the training data such as (7678,2,15) to fit the input requirement (samples, time steps, features) for the LSTM model.

However, I am confused about the input data, since the time series data I’ve seen so far, from many tutorials is like:

time,vec_1,vec_2
 0    50    30
 1     .     .
 .     .     .
 .     .     .
 .     .     .

Should I transpose the matrix before I fit in the LSTM model like this?

        0  1  2  3  .  .  .  7678
vec_1  50
vec_2  30
  .
  .
  .
vec_30  0
genre  pop

The shape of this data will be (30,7678), and it looks right to fit in the LSTM model.

If so, when I reshape it to (7678,2,15), does it mean the same before I transpose the matrix? meaning that with 7678 samples, with 2 timesteps, with 15 features.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP