Skip to main content

symbolic_data

The model-agnostic symbolic-regression data layer, carved out of flash-ansr: skeleton/expression sampling, priors, (X, y) support sampling, holdout management, and dataset construction.

Both symbolic-regression methods (for training holdout) and the srbf eval framework depend on it, so training, holdout, and evaluation draw from one source of truth. Its only heavy dependency is simplipy; otherwise just numpy/sklearn plus huggingface_hub (for resolving versioned catalogs from the HF asset repo).

Publications

Install

pip install symbolic-data

Quick start

import symbolic_data

# 1. Load a curated catalog (level 1: expressions + their intrinsic per-variable sampling). The
#    curated sets are Hugging Face artifacts (not bundled in the wheel): a bare `name` needs network
#    on first use, then caches; pass an explicit local path for offline use. `load_catalog("name@version")`
#    resolves a versioned catalog from the HF manifest, and `load_catalog("user/repo:name")` loads a
#    third party's published catalog.
feynman = symbolic_data.load_catalog("feynman")            # 100 equations (Udrescu & Tegmark 2020)
entry = feynman["I.6.2a"]
entry.prepared, entry.variables                            # expression + intrinsic per-variable sampling

# 2. Draw (X, y) Problems from a ProblemSource (level 2). Mode is inferred from the config:
#    a declarative/frozen `catalog` ref (set), a generative `catalog` ref (generate, on-the-fly),
#    or inline `problems` (fixed).
src = symbolic_data.ProblemSource({"catalog": "feynman",
                                   "sampling": {"n_support": 32, "n_validation": 32, "noise": 0.01}})
for problem in src:
    if problem.is_placeholder:                                                        # a slot the source could not fill (recorded, not skipped)
        continue
    problem.x_support, problem.y_support, problem.y_support_noisy, problem.expression  # fit / tokenize

# 3. Freeze for exact reproduction (no seeds): materialize() -> a fixed source that re-iterates
#    byte-identical Problems, identical across models/runs.
frozen = src.materialize()

Extensibility

Distributions are pluggable via a registry: in-process with @symbolic_data.DISTRIBUTIONS.register("name"), or across packages via an importlib.metadata entry point in the symbolic_data.distributions group. A registered name drops into the same {"name": ..., "kwargs": ...} config slot as a builtin (e.g. the fastsrb distribution).

Catalogs are extensible through the resolver: publish your own to a Hugging Face dataset repo with a manifest.json, then symbolic_data.load_catalog("your-user/your-repo:name@version").

Versioning / reproducibility

Reproducibility comes from fixed data, not seeds: sampling draws from a threaded numpy.random.Generator (entropy by default), and exact reproduction across runs/models is obtained from a fixed (materialized) catalog rather than by re-seeding. Versioned catalogs resolve from Hugging Face with a pinned revision and a sha256 integrity check. Catalogs are HF artifacts (not bundled in the wheel): a bare name needs network on first use, then caches; pass an explicit local path for fully offline operation.

The public stack: Problem, the unified distribution framework (incl. the fastsrb distribution), and the Catalog a ProblemSource samples from -- either a declarative ProblemCatalog (+ load_catalog + the versioned HF resolver) or an on-the-fly GenerativeCatalog (LampleChartonCatalog: random unary-binary operator trees; build_catalog dispatches a catalog: {type: ...} config). ProblemSource adds the usage policy (draw method, support/validation counts, noise, holdouts/filters, problems_per_expression, unbounded streaming, materialize() + to_catalog() for frozen, byte-reproducible catalogs). Generate-mode is fully Generator-driven (no global np.random); the public generative face is LampleChartonCatalog. Curated catalogs (FastSRB, Feynman, Nguyen) are published to the HF assets repo and resolved by name (not bundled in the wheel). CLI: symbolic-data materialize.

Deferred: a frozen holdout grid; functional-equivalence exclude (currently exact normalized-expression match).

Licensing

The repository is MIT-licensed (see LICENSE) with one carve-out: everything under assets_sa/ is CC BY-SA 4.0 (OEIS-/Wikipedia-derived benchmark catalogs; see assets_sa/LICENSE for the full legal code + derivation statement). Vendored upstream data under assets/upstream/*/ carries per-directory NOTICE + license files; THIRD_PARTY_LICENSES has the summary table. The share-alike catalogs publish to a separate HF repo (psaegert/symbolic-data-assets-sa), never mixed into the permissive artifact repo.

Metadata

Release files for symbolic-data 0.18.0

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

Source distribution (sdist)

Source distribution for symbolic-data 0.18.0
File Size Uploaded
symbolic_data-0.18.0.tar.gz 140.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for symbolic-data 0.18.0
File Interpreter ABI Platform
symbolic_data-0.18.0-py3-none-any.whl Python 3 none any Details

Total release size: 246.3 kB

Release files / symbolic_data-0.18.0.tar.gz

Download URL symbolic_data-0.18.0.tar.gz
Size 140.5 kB
Tags Source
SHA-256 checksum
How to use checksums
968deabf9f552f85b083f11a35128a4fbc8a5df10cbeed34f4a1b1fa9641c8bf
BLAKE2b-256 checksum
How to use checksums
5a71282566a1d467b7e3885a112c85a27c31157d5cd6bba7e7e1179a0045a637
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 3, 2026.

Transparency log

Release files / symbolic_data-0.18.0-py3-none-any.whl

Download URL symbolic_data-0.18.0-py3-none-any.whl
Size 105.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
32a9773bc0c9c41d25349e0e7e55010ab4b34288904caac8ea22c32ecc972e13
BLAKE2b-256 checksum
How to use checksums
cdd833ffb202e172fa5bc9b563b3e94a45d7409a650d30bbf2c22709fa26efe3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 3, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.18.0 This release

2 release files

0.16.2

2 release files

0.16.1

2 release files

0.16.0

2 release files

0.15.0

2 release files

0.14.0

2 release files

0.13.0

2 release files

0.12.4

2 release files

0.12.3

2 release files

0.12.2

2 release files

0.12.1

2 release files

0.9.5

2 release files

0.9.4

2 release files

0.9.3

2 release files

0.9.2

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

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