-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
String representation of an expression changes after running a second regression #306
Comments
So, the equations themselves actually are not changing here. The default For fine-grained control, including specifying what the variables should be printed for each feature, see https://astroautomata.com/SymbolicRegression.jl/dev/api/#Printing For example: sr_options1 = mach1.fitresult.options
sr_options2 = mach2.fitresult.options
println(string_tree(r1.equations[r1.best_idx], sr_options1; variable_names=["x1", "x2"]))
println(string_tree(r2.equations[r2.best_idx], sr_options2; variable_names=["x3", "x4"])) which will fix your observed behavior. Basically what happens by default is string_tree(equation, options=(#=last options=#), variable_names=(#=last variable names=#)) which is purely for convenience (so you can quickly print an expression), but doesn't actually change how evaluation of the expression is done. The reason for this behavior is so that the However I have been thinking about having an |
Now I understand the behaviour. This is not intuitive as I really had the feeling I was running two different "lines" of calculations with totally different variables. If you create an Note that with your answer, I also learnt how to get access to the options of a fit, I missed it before! |
Good point, thanks. I don't think this would be too bad to implement. I think there are multiple benefits of having some user-facing expression types – not only making it explicit what the operators and variables are being used in an expression (which as you point out, certainly seems like a bit of a foot gun right now) – but also enabling us to have other metadata in expressions without slowing down the search algorithm. |
Thank you Miles for your kind handling of my report and the incredibly useful package you created with SymbolicRegression. |
Thanks @daloic. Today I worked on an implementation which you can find in SymbolicML/DynamicExpressions.jl#73. Let me know what you think of the proposal. I think it's a much more robust strategy than before, so thanks for pointing this out. |
What happened?
The first equation should be only a function of X1 and X2.
To reproduce the bug, simply run the
bug()
function. Maybe I am doing something wrong.Version
0.24.3
Operating System
Linux
Interface
Script (i.e.,
python my_script.py
)Relevant log output
Extra Info
No response
The text was updated successfully, but these errors were encountered: