Repository navigation
feat: optional Rust backend - #1429
Draft
MilesCranmerBot wants to merge 4 commits into
Draft
MilesCranmerBot wants to merge 4 commits into
MilesCranmerBot wants to merge 4 commits into
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
MilesCranmerBot
force-pushed
the
rust-backend
branch
5 times, most recently
from
October 18, 2026 00:26
1684edc to
17103f9
Compare
Co-authored-by: Miles Cranmer <miles.cranmer@gmail.com>
Co-authored-by: Miles Cranmer <miles.cranmer@gmail.com>
Co-authored-by: Miles Cranmer <miles.cranmer@gmail.com>
MilesCranmerBot
force-pushed
the
rust-backend
branch
from
October 18, 2026 19:32
17103f9 to
0a46d9e
Compare
Co-authored-by: Miles Cranmer <miles.cranmer@gmail.com>
MilesCranmerBot
force-pushed
the
rust-backend
branch
from
October 18, 2026 21:59
0a46d9e to
3bafa3a
Compare
This branch has not been deployed
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.
Adds an optional Rust backend,
PySRRegressor(backend="rust"), which runs the search with symbolic_regression.rs through its Python packagesymbolic-regression-rs. The Julia backend stays the default, and nothing changes for existing users.This depends on the Python package landing in symbolic_regression.rs (astroautomata/symbolic_regression.rs#57) and being published to PyPI as
symbolic-regression-rs0.1.0. Until then, CI builds it from a pinned commit.What changes
backend="julia"(default) or"rust". A newpysr[rust]extra installssymbolic-regression-rs.import pysrstill loads Julia exactly as before, andbackend="rust"works with that normal import. SettingPYSR_BACKEND=rustbeforeimport pysrskips Julia entirely (juliacall is never imported, so Julia is never installed or started), makes"rust"the default backend, and makes Julia-only objects such aspysr.jlraise an error that says to unset the variable.loss_function,loss_function_expression,complexity_mapping,turbo,bumper,autodiff_backend,logger_spec,cluster_manager/procsand related multiprocessing options,fast_cycle, type specs,precision=16, custom Julia mutations or plugins) raiseValueErrornaming the parameter when set to non-default values. The Rust engine takes real float32/float64 data.equations_has the same columns and dtypes, scores, SymPy/JAX/PyTorch exports andfrom_filebehavior as the Julia path. Ordinary expressions predict through the same SymPy-lambdified functions; template expressions predict with the engine's evaluator, since their equation strings are not SymPy.warm_startresumes from the engine's state, kept inrust_state_stream_; pickled regressors predict after unpickling.from_filenow loads CSV-only multi-output runs, which raisedFileNotFoundErrorbefore (first commit, with a test).PYSR_BACKEND, and the options the Rust backend does not support.PYSR_BACKEND=rust.Verification
PYSR_BACKEND=rust. They cover fits and predictions,equations_columns and dtypes against the Julia path, exports, multi-output, units, guesses, templates, string losses and early stops, warm start, pickling, options taking effect (operator complexity, nested constraints, seeds,maxsize), errors for Julia-only parameters, and the missing-package message.PYSR_BACKEND=rustimports every PySR module, fits and predicts without importing juliacall, and never creates a Julia installation.PYSR_BACKENDunset, an independent check found the import order, environment variables,__all__, andpysr.jlunchanged.