Metadata-Version: 2.4
Name: symbfitrs
Version: 0.1.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: MacOS
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Rust
Classifier: Topic :: Scientific/Engineering :: Mathematics
Requires-Dist: numpy>=1.23
Requires-Dist: tqdm>=4.60
License-File: LICENSE
Summary: Fast nonlinear least-squares fitting on millisecond CPU budgets.
Keywords: curve fitting,nonlinear least squares,symbolic regression,levenberg-marquardt
Author: William Dennis
License-Expression: MIT
Requires-Python: >=3.10
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Repository, https://github.com/wd7512/symbfitrs

# symbfitrs

A fast CPU fitter for nonlinear equations, written in Rust, for symbolic regression. `uv pip install symbfitrs` (Linux, macOS), then `symbfitrs.compile("a*exp(-b*x) + c").fit(x, y, budget_ms=5)`, or `symbfitrs.Pool(threads=8).fit_many([(expr, x, y), ...])` for batches.

<picture>
  <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/wd7512/symbfitrs/main/docs/benchmark-dark.png">
  <img alt="Share of fits reaching the target against time per fit for twelve solvers: symbfitrs 72% at 1 ms and 86% at 5 ms; the best other, SciPy lm, 47% and 71%" src="https://raw.githubusercontent.com/wd7512/symbfitrs/main/docs/benchmark-light.png">
</picture>

Six suites (NIST StRD, Moré–Garbow–Hillstrom, FitBenchmarking, SAGE-Fit, Stringer 2019, synthetic up to 99 parameters); one thread per fit; every solver at its library defaults (SciPy, Optimistix, Ceres via pyceres, SAGE-Fit, VarProPy, the Rust `varpro` crate; see `bench/baselines.py`); compile time not counted. SAGE-Fit data is Python code the benchmark executes, so fetch only data you trust. The benchmark needs [uv](https://docs.astral.sh/uv/) and [cargo](https://rustup.rs/).

```bash
uv sync && uv run python -m bench.fetch nist fitbenchmarking sagefit stringer2019  # 860 MB
for s in nist_strd mgh fitbenchmarking synthetic_scale sagefit_spb stringer2019_gratings; do
  uv run python -m bench run $s && uv run python -m bench run $s --fitter; done
uv run python -m bench.figure
```

MIT licence; downloaded benchmark data keeps its own.

