Skip to content
Discussion options

You must be logged in to vote

I mean if you want, you could just force it with something like:

FunctionTemplate = TemplateExpressionSpec(
    expressions=["f"],
    variable_names=["x"],
    parameters={"a": 1, "b": 1},
    combine="abs(a[1]) + abs(b[1]) / (sqrt(x) + 0 * f(x))
)

Note the 0 * f(x) term, which will kill the contribution from f.

Obviously it will still do a redundant search over the space of symbolic expressions for f, but this would indeed let you use it.

Basically the backend is set up to assume there is always SOME symbolic expression that is being optimized. i.e., it's just not written with the assumption that anybody would use it for regular constant fitting. But I guess you could hack it in like this!

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@MilesCranmer
Comment options

@RaymondWKWong
Comment options

@MilesCranmer
Comment options

@MilesCranmer
Comment options

Answer selected by RaymondWKWong
@MilesCranmer
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
PySR PySR-related discussion
2 participants