kstaats / karoo_gp

A Genetic Programming platform for Python with TensorFlow for wicked-fast CPU and GPU support.
Other
157 stars 61 forks source link

Fittest tree issue #95

Open asksak opened 2 years ago

asksak commented 2 years ago

In GP, the fittest tree in a generation is, in one scenario, carried forward to the next generation.

With this in mind, the fittest tree in any generation cannot be lower than the inherited tree.

In my tests, I noticed that the fittest tree value drops, which does not conform to the "survival of the fittest" as described by Koza.

I wonder what you think?

granawkins commented 1 year ago

This is functioning correctly. For each tree in the next generation, 7 random trees are chosen from the current generation as 'potential parents'. In most cases, the fittest of the bunch gets chosen, but not always.

This is an interesting topic within GP usually called 'elitism'. Two approaches we could take are:

  1. Carrying forward the fittest (N=1 or 2) trees each generation, regardless
  2. Maintain a 'hall of fame' with the fittest trees across all generations
kstaats commented 1 year ago

Yes, many experiments in elitism have been conducted for a few decades. I did my own with Karoo, early on. It seems counter intuitive, but yes, if you select the most fit trees every time (bypassing the tournament with a random selection), you can find the ultimate solution less capable at solving the given problem.

I do not have the full history to this issue #95 and prior conversations, and so I only ask immediately, Are you yet using the Tournament with ~7% random selection? Or something else to choose the parents?

On 9/21/22 06:11, Grant wrote:

This is functioning correctly. For each tree in the next generation, 7 random trees are chosen from the current generation as 'potential parents'. In most cases, the fittest of the bunch gets chosen, but not always.

This is an interesting topic within GP usually called 'elitism'. Two approaches we could take are:

  1. Carrying forward the fittest (N=1 or 2) trees each generation, regardless
  2. Maintain a 'hall of fame' with the fittest trees across all generations

— Reply to this email directly, view it on GitHub https://github.com/kstaats/karoo_gp/issues/95#issuecomment-1253689881, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADUKG7WJMJNHCQKUPIKFA23V7MCPBANCNFSM573LBFZA. You are receiving this because you are subscribed to this thread.Message ID: @.***>

granawkins commented 1 year ago

Yep, still using the same tournament/selection process. The default population size is 100, the default tournament size is 7, so you end up with 7% random selection by default. If you were to just increase population to 200, you'd have 3.5% though, as the input for tournament size is a number, not a percentage.

On Tue, Sep 27, 2022 at 5:53 AM Kai Staats @.***> wrote:

Yes, many experiments in elitism have been conducted for a few decades. I did my own with Karoo, early on. It seems counter intuitive, but yes, if you select the most fit trees every time (bypassing the tournament with a random selection), you can find the ultimate solution less capable at solving the given problem.

I do not have the full history to this issue #95 and prior conversations, and so I only ask immediately, Are you yet using the Tournament with ~7% random selection? Or something else to choose the parents?

On 9/21/22 06:11, Grant wrote:

This is functioning correctly. For each tree in the next generation, 7 random trees are chosen from the current generation as 'potential parents'. In most cases, the fittest of the bunch gets chosen, but not always.

This is an interesting topic within GP usually called 'elitism'. Two approaches we could take are:

  1. Carrying forward the fittest (N=1 or 2) trees each generation, regardless
  2. Maintain a 'hall of fame' with the fittest trees across all generations

— Reply to this email directly, view it on GitHub https://github.com/kstaats/karoo_gp/issues/95#issuecomment-1253689881,

or unsubscribe < https://github.com/notifications/unsubscribe-auth/ADUKG7WJMJNHCQKUPIKFA23V7MCPBANCNFSM573LBFZA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/kstaats/karoo_gp/issues/95#issuecomment-1258739104, or unsubscribe https://github.com/notifications/unsubscribe-auth/AL7VFK5KGLP55URJFF3QTKTWAISORANCNFSM573LBFZA . You are receiving this because you commented.Message ID: @.***>

kstaats commented 1 year ago

Ok. Good. But yes, the number of individuals selected should be a percent, not a fixed number.

On 9/26/22 18:21, Grant wrote:

Yep, still using the same tournament/selection process. The default population size is 100, the default tournament size is 7, so you end up with 7% random selection by default. If you were to just increase population to 200, you'd have 3.5% though, as the input for tournament size is a number, not a percentage.

On Tue, Sep 27, 2022 at 5:53 AM Kai Staats @.***> wrote:

Yes, many experiments in elitism have been conducted for a few decades. I did my own with Karoo, early on. It seems counter intuitive, but yes, if you select the most fit trees every time (bypassing the tournament with a random selection), you can find the ultimate solution less capable at solving the given problem.

I do not have the full history to this issue #95 and prior conversations, and so I only ask immediately, Are you yet using the Tournament with ~7% random selection? Or something else to choose the parents?

On 9/21/22 06:11, Grant wrote:

This is functioning correctly. For each tree in the next generation, 7 random trees are chosen from the current generation as 'potential parents'. In most cases, the fittest of the bunch gets chosen, but not always.

This is an interesting topic within GP usually called 'elitism'. Two approaches we could take are:

  1. Carrying forward the fittest (N=1 or 2) trees each generation, regardless
  2. Maintain a 'hall of fame' with the fittest trees across all generations

— Reply to this email directly, view it on GitHub https://github.com/kstaats/karoo_gp/issues/95#issuecomment-1253689881,

or unsubscribe < https://github.com/notifications/unsubscribe-auth/ADUKG7WJMJNHCQKUPIKFA23V7MCPBANCNFSM573LBFZA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/kstaats/karoo_gp/issues/95#issuecomment-1258739104, or unsubscribe https://github.com/notifications/unsubscribe-auth/AL7VFK5KGLP55URJFF3QTKTWAISORANCNFSM573LBFZA . You are receiving this because you commented.Message ID: @.***>