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

Component api #53

Closed granawkins closed 2 years ago

granawkins commented 2 years ago

This is one of two big PRs -- the next will be branch-api -- which tighten up the code using objects and methods but don't change any of the functionality. I did the commits so they can be looked through one-by-one to get the best idea of what's happening.

Two new classes are created: Population and Tree. Their methods are used by BaseGP to replace several calls to different 'fx' functions:

Those 'fx_' functions are (1) separated from Base_GP by replacing all calls to self.[attr or method] with arguments and outputs and (2) called by the new class methods. This results in clunky code for now with lots of things passed around, but future updates will improve this.

The original test_bases still pass. I also wrote new tests for Population and Trees - one of which is still failing but not a big deal. This needs another couple days of review/testing before it's ready to merge, and feedback is much appreciated.