Open asksak opened 2 years ago
Note that Sympify caused a similar error in the last version when I tried to code comparison operators. It evaluated parts of some statements.
Try with ‘==‘ instead?
Thanks for the feedback though, that's something we should recognize early and give a clearer error message.
On Wed, 24 Aug 2022 at 23:35 asksak @.***> wrote:
Note that Sympify caused a similar error in the last version when I tried to code comparison operators. It evaluated parts of some statements.
— Reply to this email directly, view it on GitHub https://github.com/kstaats/karoo_gp/issues/91#issuecomment-1225966989, or unsubscribe https://github.com/notifications/unsubscribe-auth/AL7VFK35PQWZR6LBPJLQ2CLV2ZFNVANCNFSM57P7WDKQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Try with ‘==‘ instead?
Thanks for the feedback though, that's something we should recognize early and give a clearer error message.
On Wed, 24 Aug 2022 at 23:35 asksak @.***> wrote:
Note that Sympify caused a similar error in the last version when I tried
to code comparison operators. It evaluated parts of some statements.
—
Reply to this email directly, view it on GitHub
https://github.com/kstaats/karoo_gp/issues/91#issuecomment-1225966989,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AL7VFK35PQWZR6LBPJLQ2CLV2ZFNVANCNFSM57P7WDKQ
.
You are receiving this because you are subscribed to this thread.Message
ID: @.***>
By the way the operator is >= I don't know why this editor removed the >. I tried removing OR and keeping >= and the run completes successfully, but if >= and or are in the operator list it crashes.
Note the error at the end:
TypeError: '>=' not supported between instances of 'GreaterThan' and 'GreaterThan'
On the other hand, if settings are
c,r,5,5,3,120,1000
The session will run with no problem.
You may ask why I modified the generations to be able to reach 1000; well according to my experience this is important to reach better fitness values, and no, the result would not be overfitted.
Ok, let me take a look. Can you send the exact command-line prompt you're using? like python3 karoo-gp.py -pop 120
etc.
This is the command line prompt:
sudo nice -1 python karoo-gp.py
My problems are:
I hope this helps
If you need me to do specific tests, I would be more than happy
Hello,
I got a consistent error with one of my setups. The data is error free and works with other operator setups but not this one:
+,2 -,2
`Evaluate all Trees in Generation 4 ValueError: Error from parse_expr with transformed code: "(((Symbol ('A17x' ))>=(Symbol ('A6x' )))>=((Symbol ('A3x' ))>=(Symbol ('A22x' ))))"
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/Users/aymansalsaket/Desktop/new/karoo-gp.py", line 593, in
gp.fit(X, y)
File "/Users/aymansalsaket/Desktop/new/karoo_gp/base_class.py", line 802, in fit
super().fit(X, y, *args, **kwargs)
File "/Users/aymansalsaket/Desktop/new/karoo_gp/base_class.py", line 458, in fit
self.population.evaluate(X_train, y_train, self.X_train_hash)
File "/Users/aymansalsaket/Desktop/new/karoo_gp/population.py", line 93, in evaluate
predictions = self.model.batch_predict(X, self.trees, X_hash)
File "/Users/aymansalsaket/Desktop/new/karoo_gp/base_class.py", line 492, in batch_predict
y = self.engine.predict(trees, X, X_hash)
File "/Users/aymansalsaket/Desktop/new/karoo_gp/engine.py", line 155, in predict
expr = tree.expression
File "/Users/aymansalsaket/Desktop/new/karoo_gp/tree.py", line 78, in expression
return self.root.parse(simplified=True)
File "/Users/aymansalsaket/Desktop/new/karoo_gp/node.py", line 317, in parse
return (f'({self.children[0].parse(simplified)}{ws}{self.label}'
File "/Users/aymansalsaket/Desktop/new/karoo_gp/node.py", line 318, in parse
f'{ws}{self.children[1].parse(simplified)})')
File "/Users/aymansalsaket/Desktop/new/karoo_gp/node.py", line 318, in parse
f'{ws}{self.children[1].parse(simplified)})')
File "/Users/aymansalsaket/Desktop/new/karoo_gp/node.py", line 318, in parse
f'{ws}{self.children[1].parse(simplified)})')
File "/Users/aymansalsaket/Desktop/new/karoo_gp/node.py", line 322, in parse
f'{ws}else{ws}{self.children[2].parse(simplified)})')
File "/Users/aymansalsaket/Desktop/new/karoo_gp/node.py", line 321, in parse
f'{ws}if{ws}{self.children[1].parse(simplified)}'
File "/Users/aymansalsaket/Desktop/new/karoo_gp/node.py", line 289, in parse
result = str(sympify(raw_expr))
File "/opt/anaconda3/envs/Master-TF/lib/python3.9/site-packages/sympy/core/sympify.py", line 495, in sympify
expr = parse_expr(a, local_dict=locals, transformations=transformations, evaluate=evaluate)
File "/opt/anaconda3/envs/Master-TF/lib/python3.9/site-packages/sympy/parsing/sympy_parser.py", line 1105, in parse_expr
raise e from ValueError(f"Error from parse_expr with transformed code: {code!r}")
File "/opt/anaconda3/envs/Master-TF/lib/python3.9/site-packages/sympy/parsing/sympy_parser.py", line 1096, in parse_expr
rv = eval_expr(code, local_dict, global_dict)
File "/opt/anaconda3/envs/Master-TF/lib/python3.9/site-packages/sympy/parsing/sympy_parser.py", line 915, in eval_expr
expr = eval(
File "", line 1, in
TypeError: '>=' not supported between instances of 'GreaterThan' and 'GreaterThan'
`