[B131 Dev1] Lower fitness in first generation than in initial population

Hello,

I am building using the genetic evolution, 4 islands, with an initial population of 5700 strategies. The highest fitness in that initial population is 0.85 (several of the strategies have that fitness, as you can see in the screenshot). Yet the first strategies that come up in the "Results" tab, have a lower fitness (0.84 in that case). I am of course using the exact same fitness weights that were used to create the initial population (several days of random generation), nothing else has been changed in terms of settings either. It should hence not be the case that the first results (first generation of the genetic evolution) that appear in the Results tab have a lower highest fitness than the best strategies in the initial population. In fact the best strategies of the initial population should appear in the Results tab at first, then it should evolve from there for an even better fitness. But in no case the fitness of the first results should be lower than the highest fitness in the initial population, this makes no sense and would make the genetic evolution from an initial population pretty pointless, if it degrades the fitness of what has already been there. Seems like a bug?

Thanks.
Attachments
Untitled01.jpg
(1.04 MiB)
Untitled02.jpg
(1.03 MiB)
  • Votes +3
  • Project StrategyQuant X
  • Type Bug
  • Status Refused
  • Priority Normal

History

g
#1

geektrader

09.02.2021 14:38

Task created

g
#2

geektrader

09.02.2021 14:39
Voted for this task.
b
#3

bentra

09.02.2021 17:22
Voted for this task.
b
#4

bentra

09.02.2021 17:54
I think this is a good example of a drawback of the GA method SQX uses. The parents/original seems to die off regardless of the fitness of the new mutated version or offspring. It's not wrong or a bug necessarily though. There is elitism taking place to protect the best performers to some degree but for high quality initial pop build tasks like what you're showing here it's not optimal. For a second build task I use mutation/crossover ~10/5 and short restarts ~5 max to work around it. I also use time instead of target number of strategies as sometimes there is a bad batch and getting a certain number of strats can take too long.

I have a task to improve the improver which I think is relevant as we could use it instead of the second build task as it should improve all the strategies equally and not kill of the originals: https://roadmap.strategyquant.com/tasks/sq4_7569 maybe they could add crossover to it eventually too. I recommend experimenting with an optimization task (100-300 iterations) as another way to improve all strategies equally.

I'd sure like to test a method where offspring and mutations are first checked against parents and initial pop filters before replacing the parents/originals. Of course we can't allow them to live too long but guaranteeing entire population lives a few to several generations (unless a better version is found) should be nice for such a high quality initial pop task. Maybe one day we will have snippet access and can try it ourselves: 
https://roadmap.strategyquant.com/tasks/sq4_7689



MF
#5

Mark Fric

15.02.2021 09:28

Status changed from New to Refused

bendx77 - there is no drawback in SQ genetic evolution algorithm, it uses elitism and it works corectly.


The explanation of this behavior is simple - you have 5727 strategies in initial population, and you generate 4 islands with 1440 strategies each.

Because initial population is bigger than the required population of the island these 1440 strategies for each island are chosen randomly from the initial population.


So there is no guarantee that these 5 strategies with the highest fitness 0.85 will be picked for any given island. If they were picked elitism would keep them in the population.

b
#6

bentra

15.02.2021 18:15



"The explanation of this behavior is simple - you have 5727 strategies in initial population, and you generate 4 islands with 1440 strategies each.

Because initial population is bigger than the required population of the island these 1440 strategies for each island are chosen randomly from the initial population.

So there is no guarantee that these 5 strategies with the highest fitness 0.85 will be picked for any given island. If they were picked elitism would keep them in the population."

geektrader has shown a screenshot of the RESULTS tab, he's wondering why the RESULTS are coming out lower. 1440x4 is 5760 of second build task room which is more than enough room for the 5727 no strats need to be randomly selected, instead some will need to be generated. geektrader is expecting to see all 5727 to appear in the results tab immediately since they all pass the ranking filters of the second build task. I think he's also expecting to see even better strategies coming out from that task in to the results tab and so would I.


"bendx77 - there is no drawback in SQ genetic evolution algorithm, it uses elitism and it works corectly."


Yes elitism works as intended and works very very excellent for low quality init pops like the way most people are probably using it. BTW I wasn't JUST talking about elitism. My point was that the killing off of parents so swiftly cannot be optimal for high quality start pops even though it seems to be good for low quality start pops. Apparently, I'm not the only one finding this. Think about this: the higher the finesses of the entire pool, the more likely they are to produce worse (than the original) children and or mutations so the more likely the fitness is to stagnate AND the more likely good high quality genes in the pool (even the worst in the pool could be good quality) will be replaced by worse genes. Assuming we are not in curve fit territory yet and assuming we still have room for improvements, it's prudent to allow the originals to live longer in such situations, even the worse genes in the pool which are quite high fitness in this case. By definition elitism must kill something to make room for the protective copies of the top genes, this may not be best in such a high quality start population setting where we are trading off too much for too little.

Or think in terms of value: The higher fitness we get in the pool, the value of the freshly generated mutations goes down (because they are less likely to best their parents) the value of the worse genes in such a pool can actually be quite high, nearly as high as the best genes, and so we don't necessarily want to trade them off so aggressively for the less valuable offspring and mutations. In fact, as we get higher in fitness (of the worse genes in the pool,) there must be an inflection point where we should instead be killing off the fresh mutations and offspring more aggressively (and the lower end of the pool less aggressively.)

In a low quality start pop, the lowest fitness in the pool are very low value and the fresh mutations and children are much more likely to best their parents and are much higher value so the current algo works awesome in this context.





g
#7

geektrader

15.02.2021 18:58

Hi Guys,


"geektrader has shown a screenshot of the RESULTS tab, he's wondering why the RESULTS are coming out lower. 1440x4 is 5760 of second build task room which is more than enough room for the 5727 no strats need to be randomly selected, instead some will need to be generated. geektrader is expecting to see all 5727 to appear in the results tab immediately since they all pass the ranking filters of the second build task. I think he's also expecting to see even better strategies coming out from that task in to the results tab and so would I."


^ Exactly that! Anything else is a non-correct implementation of a genetic evolution algo, sorry. I am working with several other platforms, and exactly the above behavior is the case there if starting with such a initial population.

b
#8

bentra

15.02.2021 20:51
Case and point, when using a very high quality start pool, in the first few generations the pool fitness takes a nose dive and then we see relatively slow production of anything that is comparable to the original start pool fitness. There is room for improvement here even if you don't follow my exact logic and suggested methods to improve it. 

PS this would also help a lot with this problem of low quality genes (from mating and mutating) overwhelming a high quality pool:
https://roadmap.strategyquant.com/tasks/sq4_7513

k
#9

Karish

06.05.2021 19:07
Voted for this task.

Votes: +3

Drop files to upload

or

choose files

Max size: 5MB

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

...
Wait please