ShuhuaGao / geppy

A framework for gene expression programming (an evolutionary algorithm) in Python
https://geppy.readthedocs.io/en/latest/
GNU Lesser General Public License v3.0
207 stars 76 forks source link

How to add more symbolic functions in pset.add_function() #20

Closed xinyu-2020 closed 4 years ago

xinyu-2020 commented 4 years ago

Hi Shuhua, I am trying to add more symbolic functions but have trouble with several function. I am doing the samples as your 'Use the GEP-RNC algorithm with linear scaling on the UCI Power Plant dataset ' 1.For 'sin()' function I have set pset.add_function(math.sin,1) best_ind=hof[0] symplified_best=gep.simplify(best_ind) But after running,when I simplify the best individual,the GEPPY give me that: Please provide the symbolic function mapping for 'sin' in symbolic_function_map. I don't know HOW TO MAP IT. 2.For 'sqrt()' function I have set def protected_sqrt(x3): if x3<1e-6: return 1 return math.sqrt(x3) and pset.add_function(protected_sqrt,1) But GEPPY give me that: Please provide the symbolic function mapping for 'protected_sqrt' in symbolic_function_map. I don't know HOW TO DO IT,TOO. thanks