Answer the question
In order to leave comments, you need to log in
The neural network gives incorrect values. How can I fix it?
A neural network on keras predicts price values for a certain period.
The values of Open, High, Low, Close, Volume are given as an input.
Further values for the next period are predicted through the LSTM model.
But the output data is sometimes predicted incorrectly:
Close price can be higher than High
price Low price can be higher than High price
Is it possible to add conditions, so that the output values are correct?
Answer the question
In order to leave comments, you need to log in
Firstly, there may not be any regularities in the specified data, it is impossible to find something that is not there.
Secondly, there may not be enough information for making a decision , i.e. it is impossible to predict the next value only on the basis of one previous one, especially using the wrong tool for this (as far as I remember, neural networks with memory can process data given to it sequentially), usually a neural network is given information as an input immediately for a certain period, consider she should look directly at the chart for the day / day / month / year, in fact there is no clear rule for this. Try, in addition to the specified data, to feed the networks with some additional information, even calculating it from the available information (for example, popular indicators used in TA).
Thirdly,data must be correctly submitted, they must be normalized , be on the interval (usually 0-1 or for example -1..+1), a great example is for trading volumes, enter 1/(1+v) as input, this is a number will be guaranteed to be on the interval (0..1], also try to avoid discrete values and graphs with sharp peaks (the first derivative is infinity)...
Fourth, do not try to predict all values at once, try using only one output as an example, make this value also calculated, why not make this value a classifier with three options - buy, sell, wait? some trading strategies can work successfully if they predict only some metric, for example, the amount of liquidity, how many transactions can be made to buy and sell at a certain price, or how quickly the market is gaining limit transactions (order book), etc. Those. not to predict the price, but the value of this metric, it can tell when to act or wait.
Fifth, I highly recommend that you carefully consider the error function. So in the classical form, the error function is the sum of the squares of the difference between the target and calculated outputs, but you can define it as, for example, the size of the deposit, you want to maximize it, so flip 1/(a + x), when using the current neural network, if you trade according to your strategy, on some interval (this interval must be tied to the time of receiving the input data from the network, i.e. we calculate the network for the time T, and simulate trading for the time [Tx..T] or better [T..T+x], i.e. in the future, you will receive income based on future transactions after making a decision based on current values.
... and you may also have stupidly insufficient computing power, the network size is chosen incorrectly, the initial content is incorrectly chosen, and many many other things, which means the ability to work with neural networks
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question