kstaats / karoo_gp

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

fix sporadic depth error #77

Closed granawkins closed 2 years ago

granawkins commented 2 years ago

Fixes #55

granawkins commented 2 years ago

I like it. So the interactive mode should work the same way I guess:

On Fri, Jul 1, 2022 at 10:19 PM Ezio Melotti @.***> wrote:

@.**** commented on this pull request.

In karoo_gp/base_class.py https://github.com/kstaats/karoo_gp/pull/77#discussion_r912010420:

@@ -159,7 +159,26 @@ def init(

     self.X_hash = None                   # hash of last-used fit data

     self.gen_max = gen_max               # number of generations to evolve

     self.swim = swim                     # culling method
  • self.tree_depth_max = tree_depth_max # max allowed depth

  • if tree_depth_max is None: # max allowed depth

  • default_max = 4

  • if tree_depth_base > default_max:

  • If user inputs a base depth larger than the default max

  • depth, automatically increase the maximum and warn user.

  • self.tree_depth_max = tree_depth_base

  • self.log(f'Warning: tree depth base {tree_depth_base} is'

⬇️ Suggested change

  • self.log(f'Warning: tree depth base {tree_depth_base} is'

  • self.log(f'Warning: tree depth base {tree_depth_base} is '


In karoo_gp/base_class.py https://github.com/kstaats/karoo_gp/pull/77#discussion_r912053326:

  • if tree_depth_max is None: # max allowed depth
  • default_max = 4

I don't like too much the default hardcoded here.

Since now the tree_depth_max defaults to None both in the argparse and in the init args, maybe we can just assume that the tree_depth_max is set to whatever the tree_depth_base is unless otherwise specified, and get rid of both the default of 4 and the warning.

  • tree_depth_base is either the default (4) or the value passed by the user
  • if tree_depth_max is not specified:
    • set tree_depth_max = tree_depth_base
  • if tree_depth_max is specified:
    • if tree_depth_max < tree_depth_base: raise an error
    • if tree_depth_max >= tree_depth_base: everything is ok

— Reply to this email directly, view it on GitHub https://github.com/kstaats/karoo_gp/pull/77#pullrequestreview-1026291896, or unsubscribe https://github.com/notifications/unsubscribe-auth/AL7VFK5QXKWRY3HWUALWYL3VR4D7TANCNFSM52EUGSCQ . You are receiving this because you authored the thread.Message ID: @.***>