# sr-rs SR-RS: A portable symbolic regression engine in Rust, patterned after Cranmer's SymbolicRegression.jl. **Rust symbolic regression** with: - 🦀 **Core in Rust** (fast evaluators, SIMD where available) - 🐍 **Python bindings** (PyO3, scikit-learn-style API) - 🌐 **WASM target** (`wasm-bindgen`, in-browser demo) - ♻️ **Rewrite-based simplification** (optional `egg` integration) - 🎯 Multi-objective search (error vs. complexity), constant-fitting, protected operators, and export to SymPy/LaTeX ## Quick start ### Native (Rust) ```bash cargo run --example quickstart Python # inside container or host with Rust toolchain make py python -c "from symreg_rs import SymbolicRegressor; print(SymbolicRegressor().fit_predict([[0.0],[1.0]], [0.0,1.0]))" WebAssembly demo make wasm && make demo # open http://localhost:8000/index.html Design highlights Expression AST with typed operations and arity checks Fast vectorized evaluator (feature simd) GP loop with tournament selection, variation (mutate/crossover), and Pareto archiving Constant optimization via LM/Argmin (optional) Simplification via identities + (optional) egg equality saturation See docs/DESIGN.md and docs/PORTING.md for details and porting guidance. 9) Usage snippets Rust use symreg_rs::{GpConfig, SymbolicRegressor}; let x = vec![vec![0.0], vec![1.0]]; let y = vec![0.0, 1.0]; let sr = SymbolicRegressor::default(); let expr = sr.fit(&x, &y); Python from symreg_rs import PySymbolicRegressor as SR sr = SR(pop_size=256, gens=20, num_vars=1) preds = sr.fit_predict([[0.0],[1.0]],[0.0,1.0]) 10) Next steps (recommended) Wire up constant fitting (Argmin LM) in fitness.rs. Add exporters: to SymPy string and LaTeX. Implement subtree crossover/mutation and depth/size limits. Add vectorized evaluator (std::simd) + rayon parallelism. Optional: integrate egg for global simplification. This scaffold should compile with minor tweaks (crate names/versions). From here, we can iterate on the porting branch to reach feature parity with your preferred SR baseline.