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.
  • 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

Licence

MIT; downloaded benchmark data keeps its own.

Metadata

Release files for symbfitrs 0.1.2

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.2
File Size Uploaded Provenance Actions
symbfitrs-0.1.2.tar.gz 64.2 kB With provenance Details for symbfitrs-0.1.2.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for symbfitrs 0.1.2
File Actions
symbfitrs-0.1.2-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.2-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
symbfitrs-0.1.2-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details for symbfitrs-0.1.2-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
symbfitrs-0.1.2-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details for symbfitrs-0.1.2-cp310-abi3-macosx_11_0_arm64.whl
symbfitrs-0.1.2-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details for symbfitrs-0.1.2-cp310-abi3-macosx_10_12_x86_64.whl

Total release size: 1.8 MB

Release files / symbfitrs-0.1.2.tar.gz

Download URL symbfitrs-0.1.2.tar.gz
Size 64.2 kB
Tags Source
SHA-256 checksum
How to use checksums
676b3d4e19550df14e9c38a36bfee456d5e9dd0339acec5fa28a5f146686639e
BLAKE2b-256 checksum
How to use checksums
5c2a76379e89e175f0f9c4ce40b07c2731079b24c27152642619f8efadfa5f14
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 Nov 30, 2026.

Transparency log

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

Download URL symbfitrs-0.1.2-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 455.8 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
a67b4c17881399e44372a30f4865c96b9f26e819b2dc571207d2b14dde1d9426
BLAKE2b-256 checksum
How to use checksums
e71d7f869ecd16180382c689a8431f25838608527fc052267af9640f5fcd85d0
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 Nov 30, 2026.

Transparency log

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

Download URL symbfitrs-0.1.2-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 428.4 kB
Tags CPython 3.10 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
4fbde601d253b3e7114349d1572e04a1e7d3f0a9da3cb49f295374f322947082
BLAKE2b-256 checksum
How to use checksums
2b6d9bc90226fe15389682cf56f7ee77bc6a16f641f3d2914a042e55572338d5
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 Nov 30, 2026.

Transparency log

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

Download URL symbfitrs-0.1.2-cp310-abi3-macosx_11_0_arm64.whl
Size 406.6 kB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
8b20f003b41265933fc45ecda3129d8ac9ec528c23aa31375086418a2d7f4d10
BLAKE2b-256 checksum
How to use checksums
fe6fdd2268a179dd6852773dfdb2543d34b2b82b9677c25f8716d2616d39d661
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 Nov 30, 2026.

Transparency log

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

Download URL symbfitrs-0.1.2-cp310-abi3-macosx_10_12_x86_64.whl
Size 433.2 kB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
59a53deda3281b50629ba19a8569b3e42f1857a430630d63a402b7215715b68c
BLAKE2b-256 checksum
How to use checksums
bbb0ab223a48ae1390940ec113bdb830da6ee0a4ee1faab926af23f054cb309d
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 Nov 30, 2026.

Transparency log

Security for symbfitrs 0.1.2

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.2.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 Nov 30, 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