Data Science Asked on September 26, 2021
I’m implementing an LSTM
with Keras
and I know that I have to reshape the training dataset in a 3D object. Basically I have a dataset of shape (300000, 839)
and I reshape it as (100000, 3, 839)
because I want a timestep of 3. The question is: how could I treat the training set labels? Have I to reshape also them? if I reshape the labels to 100000
, I don’t truncate 200000
labels, since the starting number of labels is 300000
?
Thanks in advance.
Your approch so far is not exactly right. Assuming you want to use the many to one approcah, the way you do it is as follows:
You have a dataset like this:
And you prepare your data in a way like this:
For a timestep of 3, you discard the first 2 occurrences of your labels and use $y_{3}$ for the inputs ${x_1, x_2,x_3}$.
Next you don't start in $x_4$. Instead you use the next three-item slice ${x_2, x_3, x_4}$ with the training label $y_4$.
You continue this way until the last imput ${x_{n-2}, x_{n-1}, x_{n}}$ to predict $y_n$. If you have $n=30000$ samples, you can generate up to $n-2$ (29998) training samples for your model following this logic.
Answered by TitoOrt on September 26, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP