test: compare JAX and Torch exports with the fitted equation - #1397
Merged
MilesCranmer merged 1 commit intoSep 28, 2026
Merged
Conversation
The custom-operator export tests compared exported output with the target data. The search stops at early_stop_condition=1e-5, which can accept constants that miss the target by 0.003 at a few points, so the tests failed on some runners. Compare the exports with the fitted equation instead, which is what the tests check. Co-authored-by: Miles Cranmer <miles.cranmer@gmail.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
MilesCranmer
approved these changes
Sep 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
test_feature_selection_custom_operatorsintest_jax.pyandtest_torch.pycompared exported output with the targety. The fit stops atearly_stop_condition=1e-5, which can accept an equation whose constants missyby up to 0.0034 at 3 of 2,000 points. The check uses 3 decimals, so the tests failed on some runners with identical numbers each time, for example on master for #1390 and #1393 and on #1394.Change
sympy.lambdifyon the selected features and a NumPycos_approx.model.predict.The tests now check export fidelity, which is their purpose, and no longer depend on how close the search gets to
y.Verification
x**6 / 720tox**6 / 700makes the JAX test fail (202 of 2,000 points mismatched), so it still catches a wrong export.