SOME CLARIFICATIONS

24 views
Skip to first unread message

Folashade Ogunrinde

unread,
Jul 21, 2022, 5:11:40 AM7/21/22
to Keras-users
Good morning, great people.

I am currently working on a time series prediction using LSTM and I need some clarifications.

1). I read an article on a blog that said the number of units in the first LSTM layer should be the input size. Can you please explain why?

2) Having trained my model with 23 variables, do I have to predict real-time data with 23 variables or can this be changed when re-shaping the new data before prediction?

3). Do you have a code snippet for streaming real-time price data from Oanda? Yfinance does not give real-time data for currency pairs.

4) What do you think about including the price data (Open, High, Low, and Close prices) as an input to the model? Is pricing with indicator data better than with indicators alone as input variables?

5) Also, how do you advise to get the best number of hidden layers for a model? I have tried using the for-loop method, but it was giving me issues with the output dimension.

6) Once I train a model with, for example, EURUSD data and save the model, can I use it to predict GOLD or do I have to create and train another model with GOLD data? If I have to create a separate model to train, how then can a single model be used on multiple assets for real-time (real-life predictions)?

I look forward to your responses.

warm regards,

Folashade

Lance Norskog

unread,
Jul 22, 2022, 8:34:43 PM7/22/22
to Folashade Ogunrinde, Keras-users
1) The output of a Layer is a container for an amount of entropy, spread across the number of units. The amount of entropy in the input dictates how large each layer's output should be. The job of a Dense, LSTM or convolutional layer is to rearrange the information spread across its input. So, the size of the first LSTM layer does not depend on the number of inputs, but on the amount of variation across the training samples.

2) The structure of the input and output have to exactly match the structure of the data. You can reshape a different dataset to match a model. I have only seen this done when resizing images to match what a model was trained against; it only works because of the nature of image data.

5) Keras-Tuner is a library that lets you quickly set up experiments where you can test different numbers of layers, and different sizes at each layer. It does an optimizing walk through the permutations and finds good sets of values.

6) It is very common to train several models with the same model structure, and then train each model on a slightly different dataset. For example, when shopping online, a recommender will find items. There might be multiple versions of this recommender based on, say, the time of day when you are online.

Good luck!


--
You received this message because you are subscribed to the Google Groups "Keras-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to keras-users...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/keras-users/CANJ4yLz%2BDD7tAHHSSz2jq12H4yMzLnOP614MuwR4ui_EXkn9XA%40mail.gmail.com.


--
Lance Norskog
lance....@gmail.com
Redwood City, CA
Reply all
Reply to author
Forward
0 new messages