Skip to main content

symbfitrs

A fast CPU fitter for nonlinear equations, written in Rust, for symbolic regression.

Install

uv pip install symbfitrs  # Linux, macOS

Usage

import symbfitrs

# one fit
symbfitrs.compile("a*exp(-b*x) + c").fit(x, y, budget_ms=5)

# a batch, in parallel
symbfitrs.Pool(threads=8).fit_many([(expr, x, y), ...])

# many curves sharing one equation: shrunken fits under a learned population prior
eb = symbfitrs.empirical_bayes("a*exp(-k*x) + c", [(x1, y1), (x2, y2), ...])
eb.params, eb.mean, eb.cov

See docs/empirical-bayes.md for how empirical_bayes works and how it scores.

Benchmarks

Share of fits reaching each suite's loose (top) and strict (bottom) target against time per fit, one thread per fit:

Share of fits reaching the target against time per fit, one panel per suite at a loose and a strict target. symbfitrs leads every suite: at 1 ms it reaches 100% / 98% on NIST against 87% / 85% for native Ceres with autodiff, and 80% / 78% on the synthetic suite against 48% / 39%; symbfitrs Adam reaches 20-52% of loose targets at the full budget while PyTorch Adam, identical step for step but about 300 times slower per step, reaches almost none

Fits in parallel (1 to 5 at once, 4 CPUs), and the speed-up clearing a queue of 5,133 fits:

Share of symbfitrs fits reaching the target against time per fit with 1 to 5 fits running in parallel, mean of four suites: 72% at 1 ms, 93% at 5 ms and 99% at 25 ms with one at a time; 71%, 89% and 98.5% with five in parallel on four CPUs Speed-up in clearing a queue of 5,133 fits with 1 to 5 workers: 1.98x with 2 workers, 2.97x with 3, 3.90x with 4 and 4.19x with 5; wall time 139 s with one worker, 33 s with five

Method

  • Suites: NIST StRD, Moré–Garbow–Hillstrom, FitBenchmarking, Stringer 2019, synthetic up to 99 parameters; SAGE-Fit when fetched.
  • Baselines at their best setting: Ceres in C++ with automatic differentiation on the same compiled expressions, tolerances tightened to 1e-15 (its defaults stop at a relative change of 1e-6); iminuit with tol=1e-6; SciPy, GSL, lmfit and Optimistix at their defaults.
  • Line styles: solid is native with exact derivatives; dashed is driven from Python with finite-difference Jacobians, except PyTorch, which uses autograd.
  • Adam: both run at the usual defaults (lr 1e-3); symbfitrs's follows torch.optim.Adam step for step (bench/adam_check.py) at 2.6–180× less time per step.
  • Timing: setup (compiling, building Ceres's problem, PyTorch's first step) is not timed for any solver.
  • Parallel charts: rerun through the package on the four single-expression suites (not MGH); the queue uses a 100 ms budget per fit, and every fit that settles on its own gives the same loss at every worker count.
  • Version: symbfitrs 0.1.1 plus unreleased commits (v0.1.1-21-g42ecd87 to v0.1.1-30-g6b27e84). 0.1.2 adds one fitter change after that (6d75eee, same results with less work per fit), so the charts were not rerun for it.
  • Machine: one sweep on an Intel Xeon at 2.3 GHz with 4 CPUs (single-thread runs pinned to one core), recorded in docs/benchmark-manifest.json with the commit and library versions.

More solvers and settings are in results/<suite>_rust/summary.md; see bench/baselines.py.

Reproduce

Needs uv and cargo. SAGE-Fit data is Python code the benchmark executes, so fetch only data you trust.

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
uv run python -m bench.eb run && uv run python -m bench.eb figure  # empirical Bayes

For iterating on the fitter itself, python -m bench.jobqueue is a local queue of quick quick-micro / quick-package runs: one worker executes timing jobs one at a time, so parallel ideas cannot confound each other. See docs/queue.md.

Licence

MIT; downloaded benchmark data keeps its own.

Metadata

Release files for symbfitrs 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for symbfitrs 0.1.3
File Size Uploaded Provenance Actions
symbfitrs-0.1.3.tar.gz 73.3 kB With provenance Details for symbfitrs-0.1.3.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for symbfitrs 0.1.3
File Actions
symbfitrs-0.1.3-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details for symbfitrs-0.1.3-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
symbfitrs-0.1.3-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details for symbfitrs-0.1.3-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
symbfitrs-0.1.3-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details for symbfitrs-0.1.3-cp310-abi3-macosx_11_0_arm64.whl
symbfitrs-0.1.3-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details for symbfitrs-0.1.3-cp310-abi3-macosx_10_12_x86_64.whl

Total release size: 1.8 MB

Release files / symbfitrs-0.1.3.tar.gz

Download URL symbfitrs-0.1.3.tar.gz
Size 73.3 kB
Tags Source
SHA-256 checksum
How to use checksums
503c68f10eeefce6022875f3bfb6109a0adf146e962fc4afc205e29a66f69347
BLAKE2b-256 checksum
How to use checksums
46aec668422262f054ae5facc6dda2f691c044449fb2d5cee7d62e5579788765
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Release files / symbfitrs-0.1.3-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL symbfitrs-0.1.3-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 464.0 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
c4958df1e60c65d555e5a77b7ec97072f03de545e8f10e18c7b8f7c943c62889
BLAKE2b-256 checksum
How to use checksums
cd7a8c9ecd19556c54087edb646c6b1c09dc423849aad7e4bfaf4d4fa1c85332
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Release files / symbfitrs-0.1.3-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL symbfitrs-0.1.3-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 433.6 kB
Tags CPython 3.10 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
08b84af97733dcf6ddad59f1c92f0f2b4dc1c30d8b3011503eab1c0de313aa00
BLAKE2b-256 checksum
How to use checksums
7be39ba8e2c70f7fa5fae90a6d1113d56c78bf78e732823edef6b161e325af29
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Release files / symbfitrs-0.1.3-cp310-abi3-macosx_11_0_arm64.whl

Download URL symbfitrs-0.1.3-cp310-abi3-macosx_11_0_arm64.whl
Size 411.9 kB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
212d3b7f7b22e4f8dd6031dd312fde2222153f4e18dd0d6b68c91b0cae78e41a
BLAKE2b-256 checksum
How to use checksums
4f2acac7fa7c3d2990d3861357bce6b7cae65d8b41ed0e996e41212ec6943a0a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Release files / symbfitrs-0.1.3-cp310-abi3-macosx_10_12_x86_64.whl

Download URL symbfitrs-0.1.3-cp310-abi3-macosx_10_12_x86_64.whl
Size 441.4 kB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
a9e545a3e93776dcfd6eb64fae410bc8fa540dbe07b4ad9cde6a4887f7f5118c
BLAKE2b-256 checksum
How to use checksums
a6b5028ede2fd8bc60b158b6821e935b2569311852cb29c887aee97bc83d6c99
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Security for symbfitrs 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 5 files in this release have been uploaded with provenance metadata.

Select from 5 files

Attestation for symbfitrs-0.1.3.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page