Crossover doesn't breed any new strategies from two parents. Only mutation rate creates new strategies...

With the settings in the screenshot (notice "detect same strategies" and "replace x%" are both disabled for this experiment and mutation is set to 0), island one fills up, then it instantly empties and starts over, no strategies ever appear in the Last Generation tab. Generations do progress but no testing is actually done at any generation, I assumed some new offspring would be produced by breeding and would need to be tested.

Here is what the logs show:


- Main test - dismissed: Initial population filter: Profit factor[Main data] (0.3) > 0.5 in 1.13 s. 01:27:32 Strategy 1.0.3 - Main test - dismissed: Initial population filter: Avg. Trades Per Month[Main data] (0.06) > 1 in 1.13 s. 01:27:31 Starting synchronization of databank 'Last generation'... 01:27:31 -- Generating initial population for island #1 01:27:31 -- Evolution on island #1 restarted because of stagnation 01:27:31 -- Evolution on island #1 finished 01:27:31 -- Evolving generation 14 population for island #1 01:27:31 Starting synchronization of databank 'Last generation'... 01:27:31 -- Evolving generation 13 population for island #1 01:27:31 Starting synchronization of databank 'Last generation'... 01:27:31 -- Evolving generation 12 population for island #1 01:27:31 Starting synchronization of databank 'Last generation'... 01:27:31 -- Evolving generation 11 population for island #1 01:27:31 Starting synchronization of databank 'Last generation'... 01:27:31 -- Evolving generation 10 population for island #1 01:27:31 Starting synchronization of databank 'Last generation'... 01:27:31 -- Evolving generation 9 population for island #1 01:27:31 Starting synchronization of databank 'Last generation'... 01:27:31 -- Evolving generation 8 population for island #1 01:27:31 Starting synchronization of databank 'Last generation'... 01:27:31 -- Evolving generation 7 population for island #1 01:27:31 Starting synchronization of databank 'Last generation'... 01:27:31 -- Evolving generation 6 population for island #1 01:27:31 Starting synchronization of databank 'Last generation'... 01:27:31 -- Evolving generation 5 population for island #1 01:27:31 Starting synchronization of databank 'Last generation'... 01:27:31 -- Evolving generation 4 population for island #1 01:27:31 Starting synchronization of databank 'Last generation'... 01:27:31 -- Evolving generation 3 population for island #1 01:27:31 Starting synchronization of databank 'Last generation'... 01:27:31 -- Evolving generation 2 population for island #1 01:27:31 Starting synchronization of databank 'Last generation'... 01:27:31 -- Evolving generation 1 population for island #1 01:27:31 Starting synchronization of databank 'Last generation'... 01:27:31 -- Initial population for island #1 generated 01:27:31 Strategy 1.0.148 - Main test - dismissed: Initial population filter: Profit factor[Main data] (0.47) > 0.5 in 1.16 s. 01:27:31 Strategy 1.0.147 - Main test - OK in 0.96 s. - initial generation, not saving to databank


Interestingly the fitness evolution actually progresses! How could that be if no new strategies are ever tested?

Crossover appears to do nothing more than create multiple copies (2 or more) of the best performers and delete the lowest performers (and applies mutation as necessary.) No new offspring (genes of 2 parents blended together) strategies are being generated at all. Apparently, only the mutation process can actually create brand new strategies. (Apparently mutation rate is applied to each block/operator/variable so try keeping it at 1-2% and you will see a low amount of new strategies regardless of crossover rate.)

https://en.wikipedia.org/wiki/Crossover_(genetic_algorithm)#:~:text=In%20genetic%20algorithms%20and%20evolutionary,parents%20to%20generate%20new%20offspring.&text=Typical%20data%20structures%20that%20can,of%20real%20numbers%2C%20or%20trees.
"In genetic algorithms and evolutionary computationcrossover, also called recombination, is a genetic operator used to combine the genetic information of two parents to generate new offspring."


Attachments
  • Votes +11
  • Project StrategyQuant X
  • Type Bug
  • Status Fixed
  • Priority Normal

History

b
#1

bentra

27.10.2020 07:15

Task created

b
#2

bentra

27.10.2020 07:16

Attachment Screenshot 14.png added

Screenshot 14.png
(155.02 KiB)
b
#3

bentra

27.10.2020 19:16

Attachment Screenshot 15.png added

Attachment builder-settings-proves-no-breeding.cfx added

builder-settings-proves-no-breeding.cfx
(27.59 KiB)
Screenshot 15.png
(58.07 KiB)
b
#4

bentra

27.10.2020 23:37

Attachment Screenshot 16.png added

Attachment Screenshot 17.png added

Attachment Screenshot 18.png added

Attachment Screenshot 19.png added

Attachment Screenshot 20.png added

Attachment Screenshot 21.png added

Attachment Screenshot 22.png added

Attachment Screenshot 23.png added

Attachment builder-settings-proves-no-breeding-2.cfx added

Screenshot 23.png
(48.76 KiB)
Screenshot 16.png
(67.07 KiB)
Screenshot 20.png
(50.01 KiB)
Screenshot 18.png
(52.49 KiB)
Screenshot 19.png
(62.04 KiB)
Screenshot 21.png
(53.79 KiB)
builder-settings-proves-no-breeding-2.cfx
(27.53 KiB)
Screenshot 17.png
(56.87 KiB)
Screenshot 22.png
(55.27 KiB)
With some adjustments to the config, we can clearly see the in sample training "top strategy" always remains constant and the "top 10" line and the "average" line gradually converge to it. (You would think sometimes the breeding of two strategies would produce an even better top strategy.) Test after test after test. More clear evidence the breeding function is not working.
?
#5

anonymous

28.10.2020 16:29
Upon further testing, this condition does not only exist in a vacuum. It looks like even if mutation is set to non zero, the mutation is the only thing which produces brand new strategies. (It appears mutation rate is applied to each block/operator/variable so try a high crossover rate with a low 1%-2% mutation rate, you will se a very low amount of new strategies regardless of crossover setting.)

According to wiki:
"In genetic algorithms and evolutionary computationcrossover, also called recombination, is a genetic operator used to combine the genetic information of two parents to generate new offspring."
https://en.wikipedia.org/wiki/Crossover_(genetic_algorithm)#:~:text=In%20genetic%20algorithms%20and%20evolutionary,parents%20to%20generate%20new%20offspring.&text=Typical%20data%20structures%20that%20can,of%20real%20numbers%2C%20or%20trees.

Crossover should be producing brand new strategies from the genes of two parents of the previous generation. The higher the crossover setting the more new strategies should be produced by breeding. Currently, crossover just brings in exact multiple (2 or more) copies of each top performer to the next gen. 



b
#6

bentra

28.10.2020 16:30

Attachment builder-settings-proves-no-breeding-3.cfx added

builder-settings-proves-no-breeding-3.cfx
(27.57 KiB)
to test non zero mutation rates
m
#7

mabi

29.10.2020 23:35
Voted for this task.
o
#8

Enric

30.10.2020 07:35
Voted for this task.
IH
#9

clonex / Ivan Hudec

30.10.2020 17:07
Voted for this task.
WH
#10

Stormin_Norman

02.11.2020 10:23
Voted for this task.
g
#11

geektrader

03.11.2020 01:53
Voted for this task.
g
#12

geektrader

03.11.2020 01:57

Holy sh... That explains a lot! What a great find! I was always wondering why there seems to be no real crossover happening. Now this all makes sense and I can confirm that I can reproduce this too. The crossover is simply not working at all. Amazing how this could not get noticed by the developers at all.

b
#13

beppil

03.11.2020 06:37
Voted for this task.
N
#14

nathan

03.11.2020 10:46
Voted for this task.
b
#15

bentra

04.11.2020 05:56
Thanks.
MF
#16

Mark Fric

04.11.2020 09:15

Status changed from New to Fixed

you are right, it is strange why we didn't find this earlier. Thank you for finding and reporting this.


It will be fixed in the next build.

fG
#17

Gianfranco

05.11.2020 09:58
Voted for this task.
b
#18

gin

12.11.2020 04:45
Voted for this task.
b
#19

gin

12.11.2020 04:47

it is not fixed

check again


reported this issue 3 months ago

sqx produces same strategies


MF
#20

Mark Fric

13.11.2020 09:46

Status changed from Fixed to In progress

MF
#21

Mark Fric

16.11.2020 11:49

Status changed from In progress to Fixed

I rechecked it, but there is no problem. Crossover works as it should. 


The fact that there are some repeating strategies doens't mean that it doesn't work, crossower doest't produces better strategies most of the time.

If you'll set mutation to 0 and crossover to 50-100% you'll see that there is still progress in evolution and fitness is increasing.

b
#22

bentra

16.11.2020 19:53

I was looking at b129 for this bug report.


In build 130 dev1 there does appear to be some gene swapping! Nice work! However, there are some other issues which I have began reporting separately in other tickets.

b
#23

gin

09.12.2020 05:49

genetics gets stuck in a rut, and produces 99% of the same

can you push sqx to do other evolution strategies

forbid indicators that already produced strategy


Votes: +11

Drop files to upload

or

choose files

Max size: 5MB

Not allowed: exe, msi, application, reg, php, js, htaccess, htpasswd, gitignore

...
Wait please