Closed asksak closed 4 years ago
On 1/15/20 2:08 AM, asksak wrote:
Good Day,
In the update of Karoo in 2017, it mentions the inclusion of >,<,<=,>=. However, the latest karoo GP does not seem to accept these functions.
Please excuse me if this question is a repeat, but I am finding it hard to run my project without such functions, will they be included?
I appreciate your reaching out. I will run an experiment to test.
kai
As you asked in the email, here is the list of installed modules: (any commnets)
_tflow_select 2.3.0 mkl
absl-py 0.8.1 py36_0
astor 0.8.0 py36_0
blas 1.0 mkl
c-ares 1.15.0 h1de35cc_1001
ca-certificates 2019.11.27 0
certifi 2019.11.28 py36_0
fastcache 1.1.0 py36h1de35cc_0
gast 0.3.2 py_0
gmp 6.1.2 hb37e062_1
gmpy2 2.0.8 py36h6ef4df4_2
grpcio 1.14.1 py36h9011c5e_0
h5py 2.9.0 py36h3134771_0
hdf5 1.10.4 hfa1e0ec_0
intel-openmp 2019.4 233
joblib 0.14.1 py_0
keras-applications 1.0.8 py_0
keras-preprocessing 1.1.0 py_1
libcxx 4.0.1 hcfea43d_1
libcxxabi 4.0.1 hcfea43d_1
libedit 3.1.20181209 hb402a30_0
libffi 3.2.1 h475c297_4
libgfortran 3.0.1 h93005f0_2
libprotobuf 3.11.2 hd9629dc_0
llvm-openmp 4.0.1 hcfea43d_1
markdown 3.1.1 py36_0
mkl 2019.4 233
mkl-service 2.3.0 py36hfbe908c_0
mkl_fft 1.0.15 py36h5e564d8_0
mkl_random 1.1.0 py36ha771720_0
mock 3.0.5 py36_0
mpc 1.1.0 h6ef4df4_1
mpfr 4.0.1 h3018a27_3
mpmath 1.1.0 py36_0
ncurses 6.1 h0a44026_1
numpy 1.16.4 py36hacdab7b_0
numpy-base 1.16.4 py36h6575580_0
openssl 1.0.2u h1de35cc_0
pip 19.3.1 py36_0
protobuf 3.11.2 py36h0a44026_0
python 3.6.2 hd04bb42_19
readline 7.0 h1de35cc_5
scikit-learn 0.21.2 py36h27c97d8_0
scipy 1.3.2 py36h1410ff5_0
setuptools 44.0.0 py36_0
six 1.13.0 py36_0
sqlite 3.30.1 ha441bb4_0
sympy 1.4 py36_0
tensorboard 1.13.1 py36haf313ee_0
tensorflow 1.13.1 mkl_py36haf07a9b_0
tensorflow-base 1.13.1 mkl_py36hc36dc97_0
tensorflow-estimator 1.13.0 py_0
termcolor 1.1.0 py36_1
tk 8.6.8 ha441bb4_0
werkzeug 0.16.0 py_0
wheel 0.33.6 py36_0
xz 5.2.4 h1de35cc_4
zlib 1.2.11 h1de35cc_3
and here is the run error when i use classify with an added < function with arity 2
Select (c)lassification, (r)egression, (m)atching, or (p)lay (default m): c Select (f)ull, (g)row, or (r)amped 50/50 method (default r): g Enter depth of the initial population of Trees (default 3): Enter maximum Tree depth (default 3): Enter minimum number of nodes for any given Tree (default 3; max 15): Enter number of Trees in each population (default 100): Enter max number of generations (default 10): Display (i)nteractive, (g)eneration, (m)iminal, (s)ilent, or (d)e(b)ug (default m): s
We have constructed the first, stochastic population of 100 Trees
Evaluate the first generation of Trees ...
Traceback (most recent call last):
File "karoo_gp.py", line 251, in
A further comment, MACOSX catalina does not run in 32 bit. Is this a problem?
I appreciate the full details delivered, and am eager to respond but a bit behind at this time. I appreciate your patience.
On 1/21/20 2:53 AM, asksak wrote:
A further comment, MACOSX catalina does not run in 32 bit. Is this a problem?
Were you able to resolve this? I do not have Catalina so I am not able to test this. What does an on-line search tell you? Karoo GP is not explicitly 32-bit, so I do not see how this would be a problem.
What is the exact error you receive?
On 1/21/20 2:53 AM, asksak wrote:
A further comment, MACOSX catalina does not run in 32 bit. Is this a problem?
Thank you for the detailed output. If we review the currently supported operators (see karoo_gp/files/templates/operators_list.txt) this is the list:
OPERATOR EXAMPLE add a + b subtract a - b multiply a b divide a / b pow a ** 2
logical_and a and b logical_or a or b logical_not not a
abs abs(a) log log(a) log1p log1p(a) sign sign(a) square square(a) sqrt sqrt(a)
cos cos(a) sin sin(a) tan tan(a) acos acos(a) asin asin(a) atan atan(a)
No, at this time ">" and "<" are not supported.
I will speak with my colleague Iurii to learn if we can add this, to the next revision. Thank you for your patience.
Cheers, kai
On 1/20/20 5:14 AM, asksak wrote:
and here is the run error when i use classify with an added < function with arity 2
Select (c)lassification, (r)egression, (m)atching, or (p)lay (default m): c Select (f)ull, (g)row, or (r)amped 50/50 method (default r): g Enter depth of the initial population of Trees (default 3): Enter maximum Tree depth (default 3): Enter minimum number of nodes for any given Tree (default 3; max 15): Enter number of Trees in each population (default 100): Enter max number of generations (default 10): Display (i)nteractive, (g)eneration, (m)iminal, (s)ilent, or (d)e(b)ug (default m): s
We have constructed the first, stochastic population of 100 Trees
Evaluate the first generation of Trees ... Traceback (most recent call last): File "karoo_gp.py", line 251, in
gp.fx_karoo_gp(kernel, tree_type, tree_depth_base, tree_depth_max, tree_depth_min, tree_pop_max, gen_max, tourn_size, filename, evolve_repro, evolve_point, evolve_branch, evolve_cross, display, precision, swim, mode) File "modules/karoo_gp_base_class.py", line 188, in fx_karoo_gp self.fx_fitness_gym(self.population_a) # generate expression, evaluate fitness, compare fitness File "modules/karoo_gp_base_class.py", line 1162, in fx_fitness_gym result = self.fx_fitness_eval(expr, self.data_train) File "modules/karoo_gp_base_class.py", line 1278, in fx_fitness_eval rule12 = tf.less_equal(result, 0 - skew) File "/Users/aymensaket/opt/anaconda3/envs/tf/lib/python3.6/site-packages/tensorflow/python/ops/gen_math_ops.py", line 4700, in less_equal "LessEqual", x=x, y=y, name=name) File "/Users/aymensaket/opt/anaconda3/envs/tf/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 610, in _apply_op_helper param_name=input_name) File "/Users/aymensaket/opt/anaconda3/envs/tf/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 60, in _SatisfiesTypeConstraint ", ".join(dtypes.as_dtype(x).name for x in allowed_list))) TypeError: Value passed to parameter 'x' has DataType bool not in list of allowed values: float32, float64, int32, uint8, int16, int8, int64, bfloat16, uint16, float16, uint32, uint64 (tf) Mac-mini:karoo aymensaket$ conda list
thank you
Dear Kai,
I am testing maximum and minimum to replace > and <. However, as arity is 3 I am losing a parameter when trees evolve. I am working on fixing it as in my opinion it is extremely important for better GP utilisation.
Now I wonder if anyone can help with the Null error I get after the first generation when I use regression. Classification does not give this error.
Karoo GP could be the next big thing if we can get enough people to participate in development on github.
Good to hear from you again.
The arity of 3 does work, or at least it did, but I have not attempted an if/then statement for some time (the operator that requires this arity).
To be specific, what happens when you invoke this?
As for the Null error, please send a screenshot or paste the error.
kai
On 2/19/20 9:34 AM, asksak wrote:
Dear Kai,
I am testing maximum and minimum to replace > and <. However, as arity is 3 I am losing a parameter when trees evolve. I am working on fixing it as in my opinion it is extremely important for better GP utilisation.
Now I wonder if anyone can help with the Null error I get after the first generation when I use regression. Classification does not give this error.
Karoo GP could be the next big thing if we can get enough people to participate in development on github.
Might be irrelevant, but in earlier tests with expanding karoo, I found out that python's "max" and "min" function can get reduced by sympify to a higher arity.
Example:
min( min(a,b), min(b,c) ) -> sympify -> min(a, b, c)
The Ast-converter recognizes this as arity-3 function (or arity 4, 5, 6...) - which it is - but the conversion to tensors does not work as planned. Tricky feature interaction. There are many ideas to solve this, but none of them are very convenient. If this is related to the probmen, I may be able to provide some possible solutions, just let me know
Might be irrelevant, but in earlier tests with expanding karoo, I found out that python's "max" and "min" function can get reduced by sympify to a higher arity. Example:
min( min(a,b), min(b,c) ) -> sympify -> min(a, b, c)
The Ast-converter recognizes this as arity-3 function (or arity 4, 5, 6...) - which it is - but the conversion to tensors does not work as planned. Tricky feature interaction. There are many ideas to solve this, but none of them are very convenient. If this is related to the probmen, I may be able to provide some possible solutions, just let me know
Thanks for this. What I have actually done is assign +min and +max to arity 3 +max(a,b). This works well until a crossover or mutation strips it from one node.
I figured therefore that all the functions should maintain an arity it 2 if I am to minimally interfere with the code, so I set it as max(a,b) and min(a,b) and modified the label and evaluation to fit each function, specifically min, max, pow.
This worked fine until I hit the NaN inf wall with sqrt and /. There was a thread somewhere that suggested removing /sin /cos /tan and that solves part of the problem, the / Nan issue is solved by using safe divide instead of divide in tf.
Another problem that pops up is that tournament lead is referenced before assignment and that is clear in the tournament functions in the Karoo Kernel. The tournament lead is a local variable and the if statements in the function will fail in particular cases of mutation.
I like Karoo GP, but my initial reaction is that Koza’s lil-gp is much more flexible, though Karoo is more advanced because of the adaption to TF even with the function limitation.
I’ll work on it in my free time as I can see great potential if I could place the fitness function in a separate file. Koza’s Lil-gp has all modules separate so one can adapt the fitness function to any application. Although that is possible in Karoo, it requires kernel intervention for a program that’s supposed to be plug and play.
Cheers,
On this note, the GP is amazing for many applications, but if the concept is made closer to DNA strand structures and behaviour, who knows!
I apologize for the incredible delay in my response to your last messages. I am coming back to Karoo with a full update, soon.
Your application of 'max(a,b) and min(a,b)' is clever, and appreciated. Thank you. I will conduct my own tests to confirm and add this to the documentation. The 'nan' is a function of dividing by zero. I used to have a catch built-in, but sometimes it does not catch this. Something I need to look into again. As for "tournament lead is referenced before assignment" I have never seen this happen and wonder if it is due to the code changes you have invoked? If you can clearly state when and where this occurs, I can determine how this is happening.
I will be updating Karoo with the most recent libraries by the close of 2020. I encourage you to download this new release, when complete. Stay tuned!
Good Day,
In the update of Karoo in 2017, it mentions the inclusion of >,<,<=,>=. However, the latest karoo GP does not seem to accept these functions.
Please excuse me if this question is a repeat, but I am finding it hard to run my project without such functions, will they be included?