Skip to content

How to select candidate equations using performance of test data more efficiently? #622

Closed Answered by MilesCranmer
leelew asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks!

Would the following help?

import copy

equations = copy.deepcopy(model.equations_)

# this is a pandas dataframe, so we can add new columns:
equations["my_metric"] = [
    my_metric(
        model.predict(Xtest, index=i),
        ytest
    )
    for i in range(len(equations))
]


choice = equations["my_metric"].idxmin()
# ^ or idxmax() if maximizing

model.predict(X, index=index)
# ^ Predict with best (or can pass to .sympy/.latex/.jax/.pytorch)

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by leelew
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