Discussion of article "Neural networks made easy (Part 31): Evolutionary algorithms"

 

New article Neural networks made easy (Part 31): Evolutionary algorithms has been published:

In the previous article, we started exploring non-gradient optimization methods. We got acquainted with the genetic algorithm. Today, we will continue this topic and will consider another class of evolutionary algorithms.

After optimization, the model was tested in the strategy tester. To test the model, I used the Evolution-test.mq5 EA which is an exact copy of the EA from several previous articles. The changes affected only the file name of the loaded model. The full EA code can be found in the attachment.

The EA was tested for the period of the last 2 weeks, not included in the training sample. It means that the EA was tested in close to real conditions. Testing results showed the viability of the proposed approach. In the chart below, you can see the balance increasing dynamics. In general, 107 trades were executed during the testing period. Of these, almost 55% were profitable. The ratio of profitable trades to losing trades is close to 1:1, but the average winning trade is 43% higher than the average losing trade. Therefore, the resulting Profit Factor is 1.69. The recovery factor has reached 3.39.

Trained model testing results

Author: Dmitriy Gizlyk

 
MetaQuotes:

The article Neural networks are simple (Part 31) has been published : Evolutionary Algorithms:

Author: Dmitriy Gizlyk


There is an error. Please tell me how to solve it

2022.10.21 18:23:12.259 Evolution (EURUSD,H1) 1 undeleted objects left
2022.10.21 18:23:12.259 Evolution (EURUSD,H1) 1 object of type CBufferFloat left
2022.10.21 18:23:12.259 Evolution (EURUSD,H1) 1280 bytes of leaked memory
2022.10.21 18:23:13.785 Evolution (EURUSD,H1) EURUSD_PERIOD_H1_Evolution.nnw
2022.10.21 18:23:13.858 Evolution (EURUSD,H1) OpenCL: GPU device 'NVIDIA GeForce RTX 3080' selected
2022.10.21 18:23:16.085 Evolution (EURUSD,H1) Error of execution kernel SoftMax FeedForward: 5109
2022.10.21 18:23:16.085 Evolution (EURUSD,H1) Train -> 206


In the log
2022.10.21 18:23:12.281 Experts experts Evolution (EURUSD,H1) loaded successfully


And nothing happens, silence, I can't hear the video card, it usually makes noise when working (using the same Fractal OCL as an example).
 
Ivan Butko #:


An error is popping up. Please tell me how to solve it

2022.10.21 18:23:12.259 Evolution (EURUSD,H1) 1 undeleted objects left
2022.10.21 18:23:12.259 Evolution (EURUSD,H1) 1 object of type CBufferFloat left
2022.10.21 18:23:12.259 Evolution (EURUSD,H1) 1280 bytes of leaked memory
2022.10.21 18:23:13.785 Evolution (EURUSD,H1) EURUSD_PERIOD_H1_Evolution.nnw
2022.10.21 18:23:13.858 Evolution (EURUSD,H1) OpenCL: GPU device 'NVIDIA GeForce RTX 3080' selected
2022.10.21 18:23:16.085 Evolution (EURUSD,H1) Error of execution kernel SoftMax FeedForward: 5109
2022.10.21 18:23:16.085 Evolution (EURUSD,H1) Train -> 206


In the log
2022.10.21 18:23:12.281 Experts experts Evolution (EURUSD,H1) loaded successfully


And nothing happens, silence, I can't hear the video card, it usually makes noise when working (using the same Fractal OCL as an example).

Try to reduce the population size. Set it to 5-10 for the experiment. If the error goes away, then increase it. And experimentally find the acceptable limit.

 
Dmitriy Gizlyk #:

Try reducing the population size. Set it to 5-10 for the experiment. If the error goes away, then increase it. And experimentally find the acceptable limit.

I tried it, I set it from 5 to 10, and tried one. The same error:

2022.10.22 01:42:08.768 Evolution (EURUSD,H1) Error of execution kernel SoftMax FeedForward: 5109.


I noticed something, maybe because of this: when saving a model, the following inscriptions appear on the left side of the window: "Error of loading model, Select file, error id: 5004". Maybe this has some effect.


Also: the created file should weigh 16 megabytes! It is unusual to see such sizes in mql.




UPD

I tried it on my laptop, it doesn't want to train either:

2022.10.22 13:07:36.028 Evolution (EURUSD,H1) EURUSD_PERIOD_H1_Evolution.nnw
2022.10.22 13:07:36.028 Evolution (EURUSD,H1) OpenCL: GPU device 'Intel(R) UHD Graphics' selected
2022.10.22 13:07:37.567 Evolution (EURUSD,H1) 9 undeleted objects left
2022.10.22 13:07:37.567 Evolution (EURUSD,H1) 1 object of type CLayer left
2022.10.22 13:07:37.567 Evolution (EURUSD,H1) 1 object of type CNeuronBaseOCL left
2022.10.22 13:07:37.567 Evolution (EURUSD,H1) 7 objects of type CBufferFloat left
2022.10.22 13:07:37.567 Evolution (EURUSD,H1) 2688 bytes of leaked memory

In log:

2022.10.22 13:07:34.716 Experts expert Evolution (EURUSD,H1) loaded successfully
2022.10.22 13:07:37.568 Experts initialising of Evolution (EURUSD,H1) failed with code 1
2022.10.22 13:07:37.580 Experts expert Evolution (EURUSD,H1) removed


 
Ivan Butko #:

I noticed something, maybe because of this: when saving a model, the following inscriptions appear on the left side of the window: "Error of loading model, Select file, error id: 5004". Maybe this has some effect.


This is not an error, NetCreator is just trying to load the model on the left side. and no file is specified. Error 5004 is an error opening a file.

 
Ivan Butko #:

I tried, I set from 5 to 10, and tried one. Same error:

2022.10.22 01:42:08.768 Evolution (EURUSD,H1) Error of execution kernel SoftMax FeedForward: 5109

Did you use all the files from the last article?

 
Dmitriy Gizlyk #:

Did you use all the files from the last article?

Yes.

If the error is related to OpenCl, maybe the processor should be switched somehow, maybe it doesn't want to
I tried it on different terminals.

 

When the same section of the history of the trained model is tested repeatedly, the result is randomised

Files:
qoymbc.gif  928 kb
 
Ivan Butko #:

When the same section of the history of the trained model is tested repeatedly, the result is randomised

This is possible with an untrained model or when the analysed data does not allow to make a preference in favour of one action. As can be seen, the algorithm uses random selection of an action from a probability distribution. If the model generates equal probabilities for all actions, then we get a random result at the output.

 
Dmitriy Gizlyk #:

This is possible with an untrained model

To train a model, do you have to necessarily run the 1000 generations set in the settings? (more than a day of training on the 3080)

 

You wrote: "The model training process has already been described in previous articles. I will not dwell on them."

I understand you don't want to repeat but can you at least give your readers a reference to the article where they can find that information