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

evaluate a single Tree against the test data - type error #10

Closed minkymorgan closed 6 years ago

minkymorgan commented 6 years ago

Hello I got this package working with tensorflow and have started testing out the various features. So far I really love the library, but I found an error trying to test a particular tree from the desktop ui. Not sure what the issue is, but raising it here.

Here's the details.

I installed for linux, on centos. I am using tensorflow-gpu. Version 1.5.0 I installed cudnn-9.1-linux-x64-v7.tgz

check my version of tensorflow: [karoo_gp]$ python -c 'import tensorflow as tf; print(tf.version)' 1.5.0

[karoo_gp]$ python karoo_gp_main.py files/data_CLASSIFY.csv

I select classification, and run with defaults until model completes after the model is done, I select "t" and try to test a model the following error is raised:

Karoo GP has an ellapsed time of 42.032015

"It is not the strongest of the species that survive, nor the most intelligent, but the one most responsive to change." --Charles Darwin

Congrats! Your multi-generational Karoo GP run is complete.

Type ? to review your options or q to quit.

 (pause) ?

Select one of the following options:
 i   Interactive display mode
 m   Minimal display mode
 g   Generation display mode
 s   Silent display mode
 db      De-Bug display mode

 ts      adjust the tournament size
 min     adjust the minimum number of nodes
 bal     adjust the balance of genetic operators

 l   list Trees with leading fitness scores
 t   evaluate a single Tree against the test data

 p   print a single Tree to screen
 id      display the current generation ID
 pop     list all Trees in current population
 dir     display current working directory

 cont    continue evolution, starting with the current population
 load    load population_s (seed) to replace population_a (current)
 w   write the evolving population_b to disk
 q   quit Karoo GP without saving population_b

 Remember to archive your final population before your next run!

 (pause) t

 Select a Tree in population_b to test: 8

Traceback (most recent call last): File "karoo_gp_main.py", line 255, in gp.fx_karoo_eol() File "/home/andrew/gep/karoo_gp/karoo_gp_base_class.py", line 884, in fx_karoo_eol self.fx_karoo_pause(1) File "/home/andrew/gep/karoo_gp/karoo_gp_base_class.py", line 577, in fx_karoo_pause if eol == 1: self.fx_karoo_pause(1) # return to pause menu as the GP run is complete File "/home/andrew/gep/karoo_gp/karoo_gp_base_class.py", line 723, in fx_karoo_pause result = self.fx_fitness_eval(expr, self.data_test, get_labels=True) File "/home/andrew/gep/karoo_gp/karoo_gp_base_class.py", line 1463, in fx_fitness_eval if get_labels: labels = tf.map_fn(self.fx_fitness_labels_map, result, dtype=[tf.int32, tf.string], swap_memory=True) File "/usr/lib/python2.7/site-packages/tensorflow/python/ops/functional_ops.py", line 409, in map_fn swap_memory=swap_memory) File "/usr/lib/python2.7/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2934, in while_loop result = loop_context.BuildLoop(cond, body, loop_vars, shape_invariants) File "/usr/lib/python2.7/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2720, in BuildLoop pred, body, original_loop_vars, loop_vars, shape_invariants) File "/usr/lib/python2.7/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2662, in _BuildLoop body_result = body(*packed_vars_for_body) File "/usr/lib/python2.7/site-packages/tensorflow/python/ops/functional_ops.py", line 400, in compute nest.assert_same_structure(dtype or elems, packed_fn_values) File "/usr/lib/python2.7/site-packages/tensorflow/python/util/nest.py", line 197, in assert_same_structure _recursive_assert_same_structure(nest1, nest2, check_types) File "/usr/lib/python2.7/site-packages/tensorflow/python/util/nest.py", line 156, in _recursive_assert_same_structure % (type_nest1, type_nest2)) TypeError: The two structures don't have the same sequence type. First structure has type <type 'list'>, while second structure has type <type 'tuple'>.

kstaats commented 6 years ago

Andrew,

I appreciate your using Karoo. Thank you!

I admit to being about six months behind on development. Got side tracked by other projects, but making my way back to Karoo again. This issue is in fact resolved on my local copy. Please all me 24 hours to test my local version one more time, and sync with the github repository.

Thank you!

Cheers, kai

On 02/24/2018 02:59 PM, Andrew wrote:

Hello I got this package working with tensorflow and have started testing out the various features. So far I really love the library, but I found an error trying to test a particular tree from the desktop ui. Not sure what the issue is, but raising it here.

Here's the details.

I installed for linux, on centos. I am using tensorflow-gpu. Version 1.5.0 I installed cudnn-9.1-linux-x64-v7.tgz

check my version of tensorflow:

[karoo_gp]$ python -c 'import tensorflow as tf; print(tf.version)' 1.5.0

[karoo_gp]$ python karoo_gp_main.py files/data_CLASSIFY.csv

I select classification, and run with defaults until model completes

after the model is done, I select "t" and try to test a model

the following error is raised:

Karoo GP has an ellapsed time of 42.032015

"It is not the strongest of the species that survive, nor the most intelligent, but the one most responsive to change." --Charles Darwin

Congrats! Your multi-generational Karoo GP run is complete.

Type ? to review your options or q to quit.

(pause) ?

Select one of the following options: i Interactive display mode m Minimal display mode g Generation display mode s Silent display mode db De-Bug display mode

ts adjust the tournament size min adjust the minimum number of nodes bal adjust the balance of genetic operators

l list Trees with leading fitness scores t evaluate a single Tree against the test data

p print a single Tree to screen id display the current generation ID pop list all Trees in current population dir display current working directory

cont continue evolution, starting with the current population load load population_s (seed) to replace population_a (current) w write the evolving population_b to disk q quit Karoo GP without saving population_b

Remember to archive your final population before your next run!

(pause) t

Select a Tree in population_b to test: 8 Traceback (most recent call last): File "karoo_gp_main.py", line 255, in gp.fx_karoo_eol() File "/home/andrew/gep/karoo_gp/karoo_gp_base_class.py", line 884, in fx_karoo_eol self.fx_karoo_pause(1) File "/home/andrew/gep/karoo_gp/karoo_gp_base_class.py", line 577, in fx_karoo_pause if eol == 1: self.fx_karoo_pause(1) # return to pause menu as the GP run is complete File "/home/andrew/gep/karoo_gp/karoo_gp_base_class.py", line 723, in fx_karoo_pause result = self.fx_fitness_eval(expr, self.data_test, get_labels=True) File "/home/andrew/gep/karoo_gp/karoo_gp_base_class.py", line 1463, in fx_fitness_eval if get_labels: labels = tf.map_fn(self.fx_fitness_labels_map, result, dtype=[tf.int32, tf.string], swap_memory=True) File "/usr/lib/python2.7/site-packages/tensorflow/python/ops/functional_ops.py", line 409, in map_fn swap_memory=swap_memory) File "/usr/lib/python2.7/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2934, in while_loop result = loop_context.BuildLoop(cond, body, loop_vars, shape_invariants) File "/usr/lib/python2.7/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2720, in BuildLoop pred, body, original_loop_vars, loop_vars, shape_invariants) File "/usr/lib/python2.7/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2662, in _BuildLoop body_result = body(*packed_vars_for_body) File "/usr/lib/python2.7/site-packages/tensorflow/python/ops/functional_ops.py", line 400, in compute nest.assert_same_structure(dtype or elems, packed_fn_values) File "/usr/lib/python2.7/site-packages/tensorflow/python/util/nest.py", line 197, in assert_same_structure _recursive_assert_same_structure(nest1, nest2, check_types) File "/usr/lib/python2.7/site-packages/tensorflow/python/util/nest.py", line 156, in _recursive_assert_same_structure % (type_nest1, type_nest2)) TypeError: The two structures don't have the same sequence type. First structure has type <type 'list'>, while second structure has type <type 'tuple'>.

minkymorgan commented 6 years ago

Hi Kai

thanks so much for getting back to me.

I’d like to help where possible. Mostly I’m doing scala and lua stuff, so my python is rusty.

As an aside - I’ve been asked to speak at a meetup happening here in London in a few weeks (a data science and IoT one) and am thinking about writing up my experiments with Karoo_GP for it.

Before I get back to them - are you ok with that?

thanks Andrew

On 27 Feb 2018, at 00:00, Kai Staats notifications@github.com wrote:

Andrew,

I appreciate your using Karoo. Thank you!

I admit to being about six months behind on development. Got side tracked by other projects, but making my way back to Karoo again. This issue is in fact resolved on my local copy. Please all me 24 hours to test my local version one more time, and sync with the github repository.

Thank you!

Cheers, kai

On 02/24/2018 02:59 PM, Andrew wrote:

Hello I got this package working with tensorflow and have started testing out the various features. So far I really love the library, but I found an error trying to test a particular tree from the desktop ui. Not sure what the issue is, but raising it here.

Here's the details.

I installed for linux, on centos. I am using tensorflow-gpu. Version 1.5.0 I installed cudnn-9.1-linux-x64-v7.tgz

check my version of tensorflow:

[karoo_gp]$ python -c 'import tensorflow as tf; print(tf.version)' 1.5.0

[karoo_gp]$ python karoo_gp_main.py files/data_CLASSIFY.csv

I select classification, and run with defaults until model completes

after the model is done, I select "t" and try to test a model

the following error is raised:

Karoo GP has an ellapsed time of 42.032015

"It is not the strongest of the species that survive, nor the most intelligent, but the one most responsive to change." --Charles Darwin

Congrats! Your multi-generational Karoo GP run is complete.

Type ? to review your options or q to quit.

(pause) ?

Select one of the following options: i Interactive display mode m Minimal display mode g Generation display mode s Silent display mode db De-Bug display mode

ts adjust the tournament size min adjust the minimum number of nodes bal adjust the balance of genetic operators

l list Trees with leading fitness scores t evaluate a single Tree against the test data

p print a single Tree to screen id display the current generation ID pop list all Trees in current population dir display current working directory

cont continue evolution, starting with the current population load load population_s (seed) to replace population_a (current) w write the evolving population_b to disk q quit Karoo GP without saving population_b

Remember to archive your final population before your next run!

(pause) t

Select a Tree in population_b to test: 8 Traceback (most recent call last): File "karoo_gp_main.py", line 255, in gp.fx_karoo_eol() File "/home/andrew/gep/karoo_gp/karoo_gp_base_class.py", line 884, in fx_karoo_eol self.fx_karoo_pause(1) File "/home/andrew/gep/karoo_gp/karoo_gp_base_class.py", line 577, in fx_karoo_pause if eol == 1: self.fx_karoo_pause(1) # return to pause menu as the GP run is complete File "/home/andrew/gep/karoo_gp/karoo_gp_base_class.py", line 723, in fx_karoo_pause result = self.fx_fitness_eval(expr, self.data_test, get_labels=True) File "/home/andrew/gep/karoo_gp/karoo_gp_base_class.py", line 1463, in fx_fitness_eval if get_labels: labels = tf.map_fn(self.fx_fitness_labels_map, result, dtype=[tf.int32, tf.string], swap_memory=True) File "/usr/lib/python2.7/site-packages/tensorflow/python/ops/functional_ops.py", line 409, in map_fn swap_memory=swap_memory) File "/usr/lib/python2.7/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2934, in while_loop result = loop_context.BuildLoop(cond, body, loop_vars, shape_invariants) File "/usr/lib/python2.7/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2720, in BuildLoop pred, body, original_loop_vars, loop_vars, shape_invariants) File "/usr/lib/python2.7/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2662, in _BuildLoop body_result = body(*packed_vars_for_body) File "/usr/lib/python2.7/site-packages/tensorflow/python/ops/functional_ops.py", line 400, in compute nest.assert_same_structure(dtype or elems, packed_fn_values) File "/usr/lib/python2.7/site-packages/tensorflow/python/util/nest.py", line 197, in assert_same_structure _recursive_assert_same_structure(nest1, nest2, check_types) File "/usr/lib/python2.7/site-packages/tensorflow/python/util/nest.py", line 156, in _recursive_assert_same_structure % (type_nest1, type_nest2)) TypeError: The two structures don't have the same sequence type. First structure has type <type 'list'>, while second structure has type <type 'tuple'>.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kstaats/karoo_gp/issues/10#issuecomment-368695469, or mute the thread https://github.com/notifications/unsubscribe-auth/ABBP6NthOFI2mb7bBkqgB6fYlxvguCDPks5tY0WpgaJpZM4SSEAK.

minkymorgan commented 6 years ago

I just double checked, the meetup event is here:

https://www.meetup.com/IoT-Innovators-UK/

I guess my concluding point about Karoo in my talk will be that the code it generates is highly portable, and could be deployed to IoT machines which could be embedded, or at least very tiny and without GPU support. This is in stark contrast to other ML methods where models produced have poor portability to constrained environments.

I’m half way through Candida Ferreira’s GEP book. Finding this whole area fascinating.

A

Sent from my iPhone

On 27 Feb 2018, at 00:00, Kai Staats notifications@github.com wrote:

Andrew,

I appreciate your using Karoo. Thank you!

I admit to being about six months behind on development. Got side tracked by other projects, but making my way back to Karoo again. This issue is in fact resolved on my local copy. Please all me 24 hours to test my local version one more time, and sync with the github repository.

Thank you!

Cheers, kai

On 02/24/2018 02:59 PM, Andrew wrote:

Hello I got this package working with tensorflow and have started testing out the various features. So far I really love the library, but I found an error trying to test a particular tree from the desktop ui. Not sure what the issue is, but raising it here.

Here's the details.

I installed for linux, on centos. I am using tensorflow-gpu. Version 1.5.0 I installed cudnn-9.1-linux-x64-v7.tgz

check my version of tensorflow:

[karoo_gp]$ python -c 'import tensorflow as tf; print(tf.version)' 1.5.0

[karoo_gp]$ python karoo_gp_main.py files/data_CLASSIFY.csv

I select classification, and run with defaults until model completes

after the model is done, I select "t" and try to test a model

the following error is raised:

Karoo GP has an ellapsed time of 42.032015

"It is not the strongest of the species that survive, nor the most intelligent, but the one most responsive to change." --Charles Darwin

Congrats! Your multi-generational Karoo GP run is complete.

Type ? to review your options or q to quit.

(pause) ?

Select one of the following options: i Interactive display mode m Minimal display mode g Generation display mode s Silent display mode db De-Bug display mode

ts adjust the tournament size min adjust the minimum number of nodes bal adjust the balance of genetic operators

l list Trees with leading fitness scores t evaluate a single Tree against the test data

p print a single Tree to screen id display the current generation ID pop list all Trees in current population dir display current working directory

cont continue evolution, starting with the current population load load population_s (seed) to replace population_a (current) w write the evolving population_b to disk q quit Karoo GP without saving population_b

Remember to archive your final population before your next run!

(pause) t

Select a Tree in population_b to test: 8 Traceback (most recent call last): File "karoo_gp_main.py", line 255, in gp.fx_karoo_eol() File "/home/andrew/gep/karoo_gp/karoo_gp_base_class.py", line 884, in fx_karoo_eol self.fx_karoo_pause(1) File "/home/andrew/gep/karoo_gp/karoo_gp_base_class.py", line 577, in fx_karoo_pause if eol == 1: self.fx_karoo_pause(1) # return to pause menu as the GP run is complete File "/home/andrew/gep/karoo_gp/karoo_gp_base_class.py", line 723, in fx_karoo_pause result = self.fx_fitness_eval(expr, self.data_test, get_labels=True) File "/home/andrew/gep/karoo_gp/karoo_gp_base_class.py", line 1463, in fx_fitness_eval if get_labels: labels = tf.map_fn(self.fx_fitness_labels_map, result, dtype=[tf.int32, tf.string], swap_memory=True) File "/usr/lib/python2.7/site-packages/tensorflow/python/ops/functional_ops.py", line 409, in map_fn swap_memory=swap_memory) File "/usr/lib/python2.7/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2934, in while_loop result = loop_context.BuildLoop(cond, body, loop_vars, shape_invariants) File "/usr/lib/python2.7/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2720, in BuildLoop pred, body, original_loop_vars, loop_vars, shape_invariants) File "/usr/lib/python2.7/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2662, in _BuildLoop body_result = body(*packed_vars_for_body) File "/usr/lib/python2.7/site-packages/tensorflow/python/ops/functional_ops.py", line 400, in compute nest.assert_same_structure(dtype or elems, packed_fn_values) File "/usr/lib/python2.7/site-packages/tensorflow/python/util/nest.py", line 197, in assert_same_structure _recursive_assert_same_structure(nest1, nest2, check_types) File "/usr/lib/python2.7/site-packages/tensorflow/python/util/nest.py", line 156, in _recursive_assert_same_structure % (type_nest1, type_nest2)) TypeError: The two structures don't have the same sequence type. First structure has type <type 'list'>, while second structure has type <type 'tuple'>.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

kstaats commented 6 years ago

Andrew,

On 02/26/2018 05:07 PM, Andrew wrote:> Hi Kai

thanks so much for getting back to me.

I’d like to help where possible. Mostly I’m doing scala and lua stuff, so my python is rusty.

As an aside - I’ve been asked to speak at a meetup happening here in London in a few weeks (a data science and IoT one) and am thinking about writing up my experiments with Karoo_GP for it.

Before I get back to them - are you ok with that?

thanks Andrew

I will do all that I can to support your talk. Just let me know what you need.

Karoo works as planned (well, almost :), but there is always room for improvement. My current (stalled) effort is to break the base_class into six class files as it will be less overwhelming to a new user, and you could load parts but not all to interweave with your own code. The genetic operators, for example, are portable. Or you could use the Karoo just to build random trees for your own code.

For a project at Ohio State University and another at the South African Astronomical Observatory I am stripping Karoo down to its bones so that it does only the initial population and genetic operators. All fitness functions will be externalized, that is, processed by outside models specific to those areas of research. So the trees are flattened and passed out ... externally processed ... and then the fitness score is passed back into Karoo to determine which trees continue to the next generation.

Eager to learn more about your work.

Cheers, kai

minkymorgan commented 6 years ago

Kai, Interesting direction, externalising the fitness.

Am I right in interpreting this direction as a move towards a map and reduce architecture? I.e. Generate and send (map) the expression population to n workers each having a chunk of the training/testing data, and then a reduce/collect of the fitness scores to enable a further round of evolution....

A

Sent from my iPhone

On 27 Feb 2018, at 00:41, Kai Staats notifications@github.com wrote:

Andrew,

On 02/26/2018 05:07 PM, Andrew wrote:> Hi Kai

thanks so much for getting back to me.

I’d like to help where possible. Mostly I’m doing scala and lua stuff, so my python is rusty.

As an aside - I’ve been asked to speak at a meetup happening here in London in a few weeks (a data science and IoT one) and am thinking about writing up my experiments with Karoo_GP for it.

Before I get back to them - are you ok with that?

thanks Andrew

I will do all that I can to support your talk. Just let me know what you need.

Karoo works as planned (well, almost :), but there is always room for improvement. My current (stalled) effort is to break the base_class into six class files as it will be less overwhelming to a new user, and you could load parts but not all to interweave with your own code. The genetic operators, for example, are portable. Or you could use the Karoo just to build random trees for your own code.

For a project at Ohio State University and another at the South African Astronomical Observatory I am stripping Karoo down to its bones so that it does only the initial population and genetic operators. All fitness functions will be externalized, that is, processed by outside models specific to those areas of research. So the trees are flattened and passed out ... externally processed ... and then the fitness score is passed back into Karoo to determine which trees continue to the next generation.

Eager to learn more about your work.

Cheers, kai — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

kstaats commented 6 years ago

Andrew,

I have updated Karoo to version 1.8. This includes all current bug fixes and should resolve the issue you originally reported. Let me know, and then we can close the issue. Let's continue our conversation about your use of Karoo and talk off-thread.

Thank you!

Cheers, kai

On 02/24/2018 02:59 PM, Andrew wrote:

Hello I got this package working with tensorflow and have started testing out the various features. So far I really love the library, but I found an error trying to test a particular tree from the desktop ui. Not sure what the issue is, but raising it here.

Here's the details.

I installed for linux, on centos. I am using tensorflow-gpu. Version 1.5.0 I installed cudnn-9.1-linux-x64-v7.tgz

check my version of tensorflow:

[karoo_gp]$ python -c 'import tensorflow as tf; print(tf.version)' 1.5.0

[karoo_gp]$ python karoo_gp_main.py files/data_CLASSIFY.csv

I select classification, and run with defaults until model completes

after the model is done, I select "t" and try to test a model

the following error is raised:

Karoo GP has an ellapsed time of 42.032015

"It is not the strongest of the species that survive, nor the most intelligent, but the one most responsive to change." --Charles Darwin

Congrats! Your multi-generational Karoo GP run is complete.

Type ? to review your options or q to quit.

(pause) ?

Select one of the following options: i Interactive display mode m Minimal display mode g Generation display mode s Silent display mode db De-Bug display mode

ts adjust the tournament size min adjust the minimum number of nodes bal adjust the balance of genetic operators

l list Trees with leading fitness scores t evaluate a single Tree against the test data

p print a single Tree to screen id display the current generation ID pop list all Trees in current population dir display current working directory

cont continue evolution, starting with the current population load load population_s (seed) to replace population_a (current) w write the evolving population_b to disk q quit Karoo GP without saving population_b

Remember to archive your final population before your next run!

(pause) t

Select a Tree in population_b to test: 8 Traceback (most recent call last): File "karoo_gp_main.py", line 255, in gp.fx_karoo_eol() File "/home/andrew/gep/karoo_gp/karoo_gp_base_class.py", line 884, in fx_karoo_eol self.fx_karoo_pause(1) File "/home/andrew/gep/karoo_gp/karoo_gp_base_class.py", line 577, in fx_karoo_pause if eol == 1: self.fx_karoo_pause(1) # return to pause menu as the GP run is complete File "/home/andrew/gep/karoo_gp/karoo_gp_base_class.py", line 723, in fx_karoo_pause result = self.fx_fitness_eval(expr, self.data_test, get_labels=True) File "/home/andrew/gep/karoo_gp/karoo_gp_base_class.py", line 1463, in fx_fitness_eval if get_labels: labels = tf.map_fn(self.fx_fitness_labels_map, result, dtype=[tf.int32, tf.string], swap_memory=True) File "/usr/lib/python2.7/site-packages/tensorflow/python/ops/functional_ops.py", line 409, in map_fn swap_memory=swap_memory) File "/usr/lib/python2.7/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2934, in while_loop result = loop_context.BuildLoop(cond, body, loop_vars, shape_invariants) File "/usr/lib/python2.7/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2720, in BuildLoop pred, body, original_loop_vars, loop_vars, shape_invariants) File "/usr/lib/python2.7/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2662, in _BuildLoop body_result = body(*packed_vars_for_body) File "/usr/lib/python2.7/site-packages/tensorflow/python/ops/functional_ops.py", line 400, in compute nest.assert_same_structure(dtype or elems, packed_fn_values) File "/usr/lib/python2.7/site-packages/tensorflow/python/util/nest.py", line 197, in assert_same_structure _recursive_assert_same_structure(nest1, nest2, check_types) File "/usr/lib/python2.7/site-packages/tensorflow/python/util/nest.py", line 156, in _recursive_assert_same_structure % (type_nest1, type_nest2)) TypeError: The two structures don't have the same sequence type. First structure has type <type 'list'>, while second structure has type <type 'tuple'>.

minkymorgan commented 6 years ago

Fantastic. I’ll test and confirm on my setup.

Andrew

On 28 Feb 2018, at 00:31, Kai Staats notifications@github.com wrote:

Andrew,

I have updated Karoo to version 1.8. This includes all current bug fixes and should resolve the issue you originally reported. Let me know, and then we can close the issue. Let's continue our conversation about your use of Karoo and talk off-thread.

Thank you!

Cheers, kai

On 02/24/2018 02:59 PM, Andrew wrote:

Hello I got this package working with tensorflow and have started testing out the various features. So far I really love the library, but I found an error trying to test a particular tree from the desktop ui. Not sure what the issue is, but raising it here.

Here's the details.

I installed for linux, on centos. I am using tensorflow-gpu. Version 1.5.0 I installed cudnn-9.1-linux-x64-v7.tgz

check my version of tensorflow:

[karoo_gp]$ python -c 'import tensorflow as tf; print(tf.version)' 1.5.0

[karoo_gp]$ python karoo_gp_main.py files/data_CLASSIFY.csv

I select classification, and run with defaults until model completes

after the model is done, I select "t" and try to test a model

the following error is raised:

Karoo GP has an ellapsed time of 42.032015

"It is not the strongest of the species that survive, nor the most intelligent, but the one most responsive to change." --Charles Darwin

Congrats! Your multi-generational Karoo GP run is complete.

Type ? to review your options or q to quit.

(pause) ?

Select one of the following options: i Interactive display mode m Minimal display mode g Generation display mode s Silent display mode db De-Bug display mode

ts adjust the tournament size min adjust the minimum number of nodes bal adjust the balance of genetic operators

l list Trees with leading fitness scores t evaluate a single Tree against the test data

p print a single Tree to screen id display the current generation ID pop list all Trees in current population dir display current working directory

cont continue evolution, starting with the current population load load population_s (seed) to replace population_a (current) w write the evolving population_b to disk q quit Karoo GP without saving population_b

Remember to archive your final population before your next run!

(pause) t

Select a Tree in population_b to test: 8 Traceback (most recent call last): File "karoo_gp_main.py", line 255, in gp.fx_karoo_eol() File "/home/andrew/gep/karoo_gp/karoo_gp_base_class.py", line 884, in fx_karoo_eol self.fx_karoo_pause(1) File "/home/andrew/gep/karoo_gp/karoo_gp_base_class.py", line 577, in fx_karoo_pause if eol == 1: self.fx_karoo_pause(1) # return to pause menu as the GP run is complete File "/home/andrew/gep/karoo_gp/karoo_gp_base_class.py", line 723, in fx_karoo_pause result = self.fx_fitness_eval(expr, self.data_test, get_labels=True) File "/home/andrew/gep/karoo_gp/karoo_gp_base_class.py", line 1463, in fx_fitness_eval if get_labels: labels = tf.map_fn(self.fx_fitness_labels_map, result, dtype=[tf.int32, tf.string], swap_memory=True) File "/usr/lib/python2.7/site-packages/tensorflow/python/ops/functional_ops.py", line 409, in map_fn swap_memory=swap_memory) File "/usr/lib/python2.7/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2934, in while_loop result = loop_context.BuildLoop(cond, body, loop_vars, shape_invariants) File "/usr/lib/python2.7/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2720, in BuildLoop pred, body, original_loop_vars, loop_vars, shape_invariants) File "/usr/lib/python2.7/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2662, in _BuildLoop body_result = body(*packed_vars_for_body) File "/usr/lib/python2.7/site-packages/tensorflow/python/ops/functional_ops.py", line 400, in compute nest.assert_same_structure(dtype or elems, packed_fn_values) File "/usr/lib/python2.7/site-packages/tensorflow/python/util/nest.py", line 197, in assert_same_structure _recursive_assert_same_structure(nest1, nest2, check_types) File "/usr/lib/python2.7/site-packages/tensorflow/python/util/nest.py", line 156, in _recursive_assert_same_structure % (type_nest1, type_nest2)) TypeError: The two structures don't have the same sequence type. First structure has type <type 'list'>, while second structure has type <type 'tuple'>.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kstaats/karoo_gp/issues/10#issuecomment-369077298, or mute the thread https://github.com/notifications/unsubscribe-auth/ABBP6NcnqNkPSkHEcqKug27NLYW3O8J6ks5tZJ5EgaJpZM4SSEAK.

kstaats commented 6 years ago

Andrew,

On 02/26/2018 05:28 PM, Andrew wrote:

I just double checked, the meetup event is here: https://www.meetup.com/IoT-Innovators-UK/

This looks like a great Meetup! Having just read your brief bio, now I am truly honoured. Thank you again for making mention of Karoo!

I guess my concluding point about Karoo in my talk will be that the code it generates is highly portable, and could be deployed to IoT machines which could be embedded, or at least very tiny and without GPU support. This is in stark contrast to other ML methods where models produced have poor portability to constrained environments.

I’m half way through Candida Ferreira’s GEP book. Finding this whole area fascinating.

Indeed, Karoo can be used without GPUs. In fact, a paper I wrote last year (https://arxiv.org/abs/1708.03157) demonstrates this clearly, with an 800x increase in performance on a single CPU over 20 CPU cores by simply applying vectorized data and the C-based TF maths library. GPUs provided a further increase in performance only when the dataset was in the order of millions of data points [rows (instances) x by columns (features)].

I enjoy GP and all evolutionary computation because it mimics something in the realworld. We can intuitively "see" what is happening given even a light education in the biological / evolutionary sciences. I need to get a copy of your book (as I know only a bit about Spark, and yes, Candida's too: https://www.gene-expression-programming.com/Author.asp

Thank you!

Cheers, kai

minkymorgan commented 6 years ago

I can confirm the updated code fixes the problem. thanks! A

On 28 Feb 2018, at 00:35, andrew morgan minkymorgan@gmail.com wrote:

Fantastic. I’ll test and confirm on my setup.

Andrew

On 28 Feb 2018, at 00:31, Kai Staats <notifications@github.com mailto:notifications@github.com> wrote:

Andrew,

I have updated Karoo to version 1.8. This includes all current bug fixes and should resolve the issue you originally reported. Let me know, and then we can close the issue. Let's continue our conversation about your use of Karoo and talk off-thread.

Thank you!

Cheers, kai

On 02/24/2018 02:59 PM, Andrew wrote:

Hello I got this package working with tensorflow and have started testing out the various features. So far I really love the library, but I found an error trying to test a particular tree from the desktop ui. Not sure what the issue is, but raising it here.

Here's the details.

I installed for linux, on centos. I am using tensorflow-gpu. Version 1.5.0 I installed cudnn-9.1-linux-x64-v7.tgz

check my version of tensorflow:

[karoo_gp]$ python -c 'import tensorflow as tf; print(tf.version)' 1.5.0

[karoo_gp]$ python karoo_gp_main.py files/data_CLASSIFY.csv

I select classification, and run with defaults until model completes

after the model is done, I select "t" and try to test a model

the following error is raised:

Karoo GP has an ellapsed time of 42.032015

"It is not the strongest of the species that survive, nor the most intelligent, but the one most responsive to change." --Charles Darwin

Congrats! Your multi-generational Karoo GP run is complete.

Type ? to review your options or q to quit.

(pause) ?

Select one of the following options: i Interactive display mode m Minimal display mode g Generation display mode s Silent display mode db De-Bug display mode

ts adjust the tournament size min adjust the minimum number of nodes bal adjust the balance of genetic operators

l list Trees with leading fitness scores t evaluate a single Tree against the test data

p print a single Tree to screen id display the current generation ID pop list all Trees in current population dir display current working directory

cont continue evolution, starting with the current population load load population_s (seed) to replace population_a (current) w write the evolving population_b to disk q quit Karoo GP without saving population_b

Remember to archive your final population before your next run!

(pause) t

Select a Tree in population_b to test: 8 Traceback (most recent call last): File "karoo_gp_main.py", line 255, in gp.fx_karoo_eol() File "/home/andrew/gep/karoo_gp/karoo_gp_base_class.py", line 884, in fx_karoo_eol self.fx_karoo_pause(1) File "/home/andrew/gep/karoo_gp/karoo_gp_base_class.py", line 577, in fx_karoo_pause if eol == 1: self.fx_karoo_pause(1) # return to pause menu as the GP run is complete File "/home/andrew/gep/karoo_gp/karoo_gp_base_class.py", line 723, in fx_karoo_pause result = self.fx_fitness_eval(expr, self.data_test, get_labels=True) File "/home/andrew/gep/karoo_gp/karoo_gp_base_class.py", line 1463, in fx_fitness_eval if get_labels: labels = tf.map_fn(self.fx_fitness_labels_map, result, dtype=[tf.int32, tf.string], swap_memory=True) File "/usr/lib/python2.7/site-packages/tensorflow/python/ops/functional_ops.py", line 409, in map_fn swap_memory=swap_memory) File "/usr/lib/python2.7/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2934, in while_loop result = loop_context.BuildLoop(cond, body, loop_vars, shape_invariants) File "/usr/lib/python2.7/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2720, in BuildLoop pred, body, original_loop_vars, loop_vars, shape_invariants) File "/usr/lib/python2.7/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2662, in _BuildLoop body_result = body(*packed_vars_for_body) File "/usr/lib/python2.7/site-packages/tensorflow/python/ops/functional_ops.py", line 400, in compute nest.assert_same_structure(dtype or elems, packed_fn_values) File "/usr/lib/python2.7/site-packages/tensorflow/python/util/nest.py", line 197, in assert_same_structure _recursive_assert_same_structure(nest1, nest2, check_types) File "/usr/lib/python2.7/site-packages/tensorflow/python/util/nest.py", line 156, in _recursive_assert_same_structure % (type_nest1, type_nest2)) TypeError: The two structures don't have the same sequence type. First structure has type <type 'list'>, while second structure has type <type 'tuple'>.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kstaats/karoo_gp/issues/10#issuecomment-369077298, or mute the thread https://github.com/notifications/unsubscribe-auth/ABBP6NcnqNkPSkHEcqKug27NLYW3O8J6ks5tZJ5EgaJpZM4SSEAK.

kstaats commented 6 years ago

Andrew,

Kai, Interesting direction, externalising the fitness.

Am I right in interpreting this direction as a move towards a map and reduce architecture? I.e. Generate and send (map) the expression population to n workers each having a chunk of the training/testing data, and then a reduce/collect of the fitness scores to enable a further round of evolution....

(just circling back to this email)

Next time we chat, we can discuss this further. But in brief, yes, you could apply Map and Reduce, but in these instances the externalization of the fitness function is due to the fact that the fitness function is in and of itself an entire application, something you cannot readily place inside of Karoo. For the SAAO weather prediction model, it is a means of searching 5 million time series data points for weather systems similar to the one occurring 'now'; with Ohio State the team is modeling the function of antennae designs (shape, frequency, gain) which require a heavy physics engine and commercial software.

So, we feed the output of a GP (not Karoo at this time) into the physics engine, it builds a model, returns the function as a fitness function (score) and we feed that back into the GP to guide the evolution.

Antennae design via GA and GP has been done many times before. A quick Google search explains more: https://en.wikipedia.org/wiki/Evolved_antenna

Cheers, kai

On 27 Feb 2018, at 00:41, Kai Staats notifications@github.com wrote:

Andrew,

On 02/26/2018 05:07 PM, Andrew wrote:> Hi Kai

thanks so much for getting back to me.

I’d like to help where possible. Mostly I’m doing scala and lua stuff, so my python is rusty.

As an aside - I’ve been asked to speak at a meetup happening here in London in a few weeks (a data science and IoT one) and am thinking about writing up my experiments with Karoo_GP for it.

Before I get back to them - are you ok with that?

thanks Andrew

I will do all that I can to support your talk. Just let me know what you need.

Karoo works as planned (well, almost :), but there is always room for improvement. My current (stalled) effort is to break the base_class into six class files as it will be less overwhelming to a new user, and you could load parts but not all to interweave with your own code. The genetic operators, for example, are portable. Or you could use the Karoo just to build random trees for your own code.

For a project at Ohio State University and another at the South African Astronomical Observatory I am stripping Karoo down to its bones so that it does only the initial population and genetic operators. All fitness functions will be externalized, that is, processed by outside models specific to those areas of research. So the trees are flattened and passed out ... externally processed ... and then the fitness score is passed back into Karoo to determine which trees continue to the next generation.

Eager to learn more about your work.

Cheers, kai — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.