-
Notifications
You must be signed in to change notification settings - Fork 217
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
[Feature]: Add complexity calculation for user defined expression #339
Comments
That's a good idea. This would probably have to be done by calling out to the Julia backend's It is a bit tricky because we would have to overload the user-defined operators to work for the expression type so that Another option is to do the complexity calculation in pure Python, but it would add maintenance burden and also cause some issues due to the fact that some of the SymPy operators are mapped to multiple primitive operators (e.g., |
Should be much easier after the PR #429 passes. Perhaps we could make a function to convert a string into a SymbolicRegression.jl equation (via the use of |
Hey @MilesCranmer, I think this method works! I tried this PR on Docker for some examples and it seemed consistent. Appreciate your work. Ideally one would bypass the .fit entirely and just define the PySRRegressor model, but this is already very helpful! Many thanks! Cheers, |
I could potentially define a method that runs all the setup steps involved in (Any help appreciated, as professor life is quite busy 🙂 ) |
Okay the functionality required has now been implemented as #564. First, see #550 (comment) for how to create user-defined expressions in PySR. Next, you can get complexity as follows: model # PySRRegressor that has already been fit, thus having `.julia_options_`
tree # Expression you have defined by hand
jl.compute_complexity(tree, model.julia_options_) |
Feature Request
Hi. I've recently started using PySR and I would like to suggest a new feature that I think would make the code even more user-friendly.
Would it be possible to have more direct access to the function that computes the complexity such that one can compare expressions found by PySR and those found in the literature?
For example:
model.complexity('1 + x_0 + x_1**2')
This would allow the user to easily map the expressions found in the literature on the complexity vs accuracy plots.
Thank you in advance.
The text was updated successfully, but these errors were encountered: