Can PySR constrain the formula with shared f(X) and g(X) in numerator and denominator? #895
-
Hello everyone, I have a modeling scenario where I want to constrain the symbolic expression to a fixed formula structure like this: with the constraint that both the numerator and denominator must share the same f(X) and g(X) functions. Although my input data is X and the target is y, what I actually want is to discover the possible expressions of f(X) and g(X) that fit into a predefined structure. Can PySR enforce that the same f(X) and g(X) appear exactly in both the numerator and denominator? This kind of structure arises from physical constraints (like transmission-line theory), and it would be very helpful to control this behavior. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi, yes you can with templateExpressionSpec: Have a look at the example here: You can define f_predict and g_predict and use those variables again to return the exact form above, something like here: #865 (comment) |
Beta Was this translation helpful? Give feedback.
Hi, yes you can with templateExpressionSpec:
Have a look at the example here:
https://astroautomata.com/PySR/api/#pysr.TemplateExpressionSpec
You can define f_predict and g_predict and use those variables again to return the exact form above, something like here: #865 (comment)