Machine learning in trading: theory, models, practice and algo-trading - page 1884

 
Evgeny Dyuka:
1. That's right, you have to go through all the options. The problem is that it's too time consuming.
2. I tried it, it got worse.
3. How do you know which ones she's using? It's a black box, so I feed everything.

There are hyperparameter optimizers, like the optimizer in the MT tester. Put it on 24 hours and it picks it up.

I was tired to wait for it to work out, but this is a peculiarity of NS, there is no exact science, only experience (my own and somebody else's) and intuition. You can share the results here or in private.

I previously posted an example for training. The idea is to teach the network to buy signals. Then reverse the entry and the network should produce sell signals. It is a binary classification whether there is a signal or not. You could teach the network to recognize buy and sell, but imho, it is worse. The output range is limited to 0-1; if we are searching only for buy, the range is divided into two classes (there is or there is not a buy) and the threshold can be moved by 0.8. If we search for buy, then 0-1 is divided into three sectors: buy, sell and something in between. Imho, search only for buy signal is: 2 times more training examples (flip input), smaller network size (the task is easier, less neurons required), less training time, easier to find solution (think about 1 class only), but this is just theory.

I have an idea, that the network itself would look for the signs, you give a price, the desired signals, and it does everything by itself. I have started with lstm, it seems to be perfect, but so far not so much. I want to try regular nets, and if not I will think about other options. CNNs are kind of messy, you'll be exhausted trying to figure out layer and core configurations. Probably, it will be easier to feed wavelets into a regular network. And if this does not work, we will have to harder work with the selection of input features, but then the question, and it is better to do "classic" system, and clearer, and more reliable, and economical, and easier to test.

And how do you analyze the results, just looking at the numbers? Is this the code you use?

plt.plot(history.history['loss'])
plt.plot(history.history['val_loss'])

You build 2 graphs, error on tray and test, by them you can understand what the network is missing and in what direction to move.

 
Rorschach:

Also hesitated to wait until it counts, but this is a feature of NS, there is no exact science, only experience (other people's, their own) and intuition. You can share the results here or in private.

Are we talking about pictures or about the market?

And how do you analyze the results, only look at the numbers? Is this the code you use?

I built two charts, one for the tray and one for the test. Using them I can understand what the network is missing and in what direction to move.

You can tell at once that you are in the real process ))

At first I drew it using the standard algorithm

import matplotlib.pyplot as plt

But it is of little use, because of the big noise the graph lies on the horizontal line after 10 epochs.
I have the binary classification and I analyze the level of certainty of the net in each answer, i.e. for example the correct answer is 0 1 and the net gives 0.4 0.6 - this is a good answer, and more often it is like this: the correct answer is 0 1 and the net gives 0.49 0.51
When the answers are thousands you can group them by certainty and analyze.


 
Rorschach:

In the end in practice this is the euro on M2 today, the neural network begins to understand something, but so far very poorly.
Blue - forecast up, yellow - down.


 
Evgeny Dyuka:

It is immediately obvious that the man in the real process ))

At first, the standard rendered using

But it is of little use, because of the big noise the graph already after 10 epochs lies on the horizontal.
I have the binary classification and I analyze the level of certainty of the network in each answer, i.e. for example the correct answer is 0 1 and the network gives 0.4 0.6 - this is a good answer, and more often it is so: the correct answer is 0 1 and the network gives 0.49 0.51
When the answers are thousands, they can be grouped by certainty and analyzed.


Can you post the loss charts? The more epochs and the smaller the size of the batch, the more times the weights change. Also, it makes sense to change lerning_rate in the optimizer by +-an order of magnitude. What optimizer are you using?

 
Rorschach:

Can you lay out the graphs? In addition to epochs you should change the size of the batch, the more epochs and the smaller the batch size, the more times the weights are changed. Also, it makes sense to change the lerning_rate in the optimizer +- by an order of magnitude. What optimizer are you using?

For the chart you have to run the tutorial, then... But nothing interesting - vertically down then horizontally, no smooth decline as in textbooks ))
Bach 128, if we're talking about the same thing. It should always be 128 is something to do with TPU, such a requirement.
Stopped changing epochs too, after 150 usually nothing changes.
Optimizer adam, with SGD something does not work.
 
Rorschach:

Here's my grid, I dynamically change the number of layers here

def make_model(arr_size, lays):
  sgd = SGD(lr=0.01, decay=1 e-6, momentum=0.9, nesterov=True)

  #res = 2 # количество ответов
  act = "softmax"
  #act = "sigmoid"
  #opt = sgd
  opt = 'adam'

  model = Sequential()

  if lays == 1:
    model.add(Dense(int((arr_size-res)*k), input_dim=(arr_size-res), activation='relu'))
    model.add(Dropout(dropout))

  if lays == 2:
    model.add(Dense(int((arr_size-res)*k), input_dim=(arr_size-res), activation='relu'))
    model.add(Dropout(dropout))
    model.add(Dense(int((arr_size-res)*0.5*k), activation='relu'))
    model.add(Dropout(dropout))

  if lays == 3:
    model.add(Dense(int((arr_size-res)*k), input_dim=(arr_size-res), activation='relu'))
    model.add(Dropout(dropout))
    model.add(Dense(int((arr_size-res)*0.5*k), activation='relu'))
    model.add(Dropout(dropout))
    model.add(Dense(int((arr_size-res)*0.3*k), activation='relu'))
    model.add(Dropout(dropout))

  if lays == 4:
    model.add(Dense(int((arr_size-res)*k), input_dim=(arr_size-res), activation='relu'))
    model.add(Dropout(dropout))
    model.add(Dense(int((arr_size-res)*0.7*k), activation='relu'))
    model.add(Dropout(dropout))
    model.add(Dense(int((arr_size-res)*0.5*k), activation='relu'))
    model.add(Dropout(dropout))
    model.add(Dense(int((arr_size-res)*0.3*k), activation='relu'))
    model.add(Dropout(dropout))

  #model.add(Dense(int((arr_size-res)*0.1*k), activation='relu'))
  #model.add(Dropout(dropout))

  model.add(Dense(res, activation=act))

  if res==1:
    ls="binary_crossentropy"
  else:
    ls="categorical_crossentropy"
  model.compile(loss=ls, optimizer=opt, metrics=['accuracy'])
  return model
 
Evgeny Dyuka:

Here's my grid, I dynamically change the number of layers here

You can try something else instead of Dropout, reduce the number of neurons. Add initialization and normalization of weights. Is input data processed somehow? My results are better after multiplication of input data by order of magnitude, looks like you need to get rid of non-stationarity after all.

 
Rorschach:

You can try something else instead of Dropout, reduce the number of neurons. Add initialization and normalization of weights. Is input data processed somehow? I got better results after multiplying the input data by an order of magnitude, it looks like you need to get rid of non-stationarity after all.

No package will give the exact result. Any NS can only give a probabilistic prediction up, down or unknown. The price does not obey the neural networks and can easily go against them. A variant of 65% is already acceptable.

 
Uladzimir Izerski:

No package will give an exact result. Any NS can only give a probabilistic prediction up, down or unknown. The price does not obey neural networks and can easily go against them. The option of 65% is already acceptable.

Here is 56%. The blue one is as it should be and the red one is the network response. The percentages do not mean anything.

Here we have 48%, the figure is even lower, but at least it has some effect.


 
Rorschach:

You can try something else instead of Dropout, reduce the number of neurons. Add initialization and normalization of weights. Is input data processed somehow? I got better result after multiplying input data by order of magnitude, looks like you need to get rid of non-stationarity after all.

Yes, you have to go through all of them, otherwise there is no way.
Try playing this, it's good for understanding how parameters affect the result.
Tensorflow — Neural Network Playground
Tensorflow — Neural Network Playground
  • Daniel Smilkov and Shan Carter
  • playground.tensorflow.org
It’s a technique for building a computer program that learns from data. It is based very loosely on how we think the human brain works. First, a collection of software “neurons” are created and connected together, allowing them to send messages to each other. Next, the network is asked to solve a problem, which it attempts to do over and over...
Reason: