Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AI and Deep Learning by (50.2k points)

I am trying to train a model of LSTM layers data of time series of categorical (one_hot) action(call/fold/raise) and time. So example time series of 3 rounds where player 2x called and then folded.

  #Call  #0.5s   # Call #0.3s   #Fold, 1.5s

[[[1,0,0], 0.5], [[1,0,0], 0.3], [[0,1,0], 1.5]]

The categorical array of call/fold/raise cannot be processed by the first layer (LSTM) and I cannot use the simple Embedding layer because of the non-categorical time.

First layer - model.add(LSTM(500, return_sequences=True, input_shape=(3, 2)))

I have tried to change the input_shape, but nothing worked for me. Any ideas on how to represent one_hot and float in once input?

1 Answer

0 votes
by (107k points)

You just have to concatenate as your one-hot encoding isn't of too high dimensionality. You could try sequences of vectors like the following:

[[1,0,0,0.5], [1,0,0,0.3], [0,1,0,1.5]]

and the LSTM or any layer that you'll use will figure out that the first 3 values mean the action and the last is the time, you don't have to concern about that.

model.add(LSTM(500, return_sequences=True, input_shape=(3, 2)))

If you want to learn more about LSTM then you can visit Recurrent Neural Network

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...