sreval
An honest evaluator for symbolic regression: triple-equivalence testing that reports its own failure rate.
Why this exists
Symbolic regression is supposed to find the equation, not merely a function that fits. The published benchmark results show those are very different achievements: a method can score above 0.999 on a coefficient of determination while recovering the correct expression structure zero percent of the time. An evaluation that reports only accuracy cannot tell a discovery from a good curve fit.
Testing structure directly is the fix, but no single structural test is reliable:
| Test | Strength | Failure mode |
|---|---|---|
| Symbolic simplification | Exact when it terminates | Times out, throws, or fails to reduce a genuinely zero difference. Scoring those as method failures charges the search for a defect in the scorer. |
| Numerical probing | Robust and cheap | Cannot distinguish "equivalent everywhere" from "agrees on the region we sampled", which is exactly what breaks under extrapolation. |
| Structural edit distance | The only one giving graded credit | Sensitive to algebraically equivalent rewrites that a human would call the same answer. |
So sreval runs all three, reports them separately, reports whether they agreed, and
publishes the symbolic-test failure rate as a first-class number. That last one is the
contribution: it is a property of the measurement apparatus that the field currently absorbs
silently into the scores of the methods being measured.
Install
pip install sreval # numpy only
pip install "sreval[symbolic]" # adds sympy, needed for the symbolic test
Use
import numpy as np
from sreval import check, summarise
verdict = check(
candidate_infix="x*(a + b)",
truth_infix="x*a + x*b",
variables=["x", "a", "b"],
candidate_fn=lambda X: X[:, 0] * (X[:, 1] + X[:, 2]),
truth_fn=lambda X: X[:, 0] * X[:, 1] + X[:, 0] * X[:, 2],
box=[(-3.0, 3.0), (-3.0, 3.0), (-3.0, 3.0)],
candidate_tokens=["mul", "v0", "add", "v1", "v2"],
truth_tokens=["add", "mul", "v0", "v1", "mul", "v0", "v2"],
)
verdict.recovered # True: an algebraic rewrite of the same expression
verdict.agreed # True: the symbolic and numerical tests concur
verdict.structural.distance # graded and non-zero: written differently
report = summarise([verdict])
report.symbolic_failure_rate # the number nobody else publishes
report.notes # plain-language statements of what the rates mean
Accuracy and recovery are reported separately, always
from sreval import accuracy_solution, description_length
accuracy_solution is named at length on purpose. An accuracy solution is not a recovery, and the
gap between those two rates is the measurement this package was built to expose. Nothing in the
API merges them for you.
description_length is the recommended rule for picking one point off a Pareto front. Selecting the
most accurate member reproduces the field's headline failure, because the most accurate member of a
front is routinely the most over-parameterised one.
Scope, honestly
- It does not perform symbolic regression. It evaluates results from any engine.
- It does not decide whether a discovered equation is true. Fitting is not discovering, and no equivalence test changes that.
- The structural distance is a sequence edit distance over the pre-order traversal, not a full tree edit distance. The former is O(n*m), the latter O(n^2 m^2), and at the expression sizes symbolic regression actually produces the two agree closely enough that the extra cost buys nothing. This is stated because the number is reported, and a reported metric with an implicit definition is not reproducible.
Provenance
Written from published specifications. The widely used reference implementation of this evaluation protocol is GPL-3.0 licensed and no part of it is reproduced here, which is what allows this package to be MIT.
Built for SymLab, a public research lab on symbolic regression, and extracted as a standalone package because the evaluation problem is not specific to that lab.
Developed by Felipe Santibanez-Leal.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sreval-0.1.0.tar.gz.
File metadata
- Download URL: sreval-0.1.0.tar.gz
- Upload date:
- Size: 13.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
87cbf4e5cd1340f2b1612ecaca6a2a8c17e47eaa7e8ae149b00c780ed1a1590b
|
|
| MD5 |
7abaf509db99c25015414a51de17133e
|
|
| BLAKE2b-256 |
9e451ef80d4bc702079ed3b51cfce310522697a292a7640a2d9611d1a3bfab8f
|
Provenance
The following attestation bundles were made for sreval-0.1.0.tar.gz:
Publisher:
publish-pypi.yml on fsantibanezleal/CAOS_SREVAL
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sreval-0.1.0.tar.gz -
Subject digest:
87cbf4e5cd1340f2b1612ecaca6a2a8c17e47eaa7e8ae149b00c780ed1a1590b - Sigstore transparency entry: 2216270379
- Sigstore integration time:
-
Permalink:
fsantibanezleal/CAOS_SREVAL@8b9af3bfe8592bea237a492c9c0d66c64439598b -
Branch / Tag:
refs/tags/v0.01.000 - Owner: https://github.com/fsantibanezleal
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@8b9af3bfe8592bea237a492c9c0d66c64439598b -
Trigger Event:
release
-
Statement type:
File details
Details for the file sreval-0.1.0-py3-none-any.whl.
File metadata
- Download URL: sreval-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a10a2551d9c4f56ba8700cfbd39ca546f92febbd276747b590fb7898fe9077b6
|
|
| MD5 |
e9a9d6e991b4f81c8daf80fa578839a4
|
|
| BLAKE2b-256 |
97a41b456711af31e582145082170fc3d9439b145a68c41193c13c5e4eb8c9c3
|
Provenance
The following attestation bundles were made for sreval-0.1.0-py3-none-any.whl:
Publisher:
publish-pypi.yml on fsantibanezleal/CAOS_SREVAL
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sreval-0.1.0-py3-none-any.whl -
Subject digest:
a10a2551d9c4f56ba8700cfbd39ca546f92febbd276747b590fb7898fe9077b6 - Sigstore transparency entry: 2216270395
- Sigstore integration time:
-
Permalink:
fsantibanezleal/CAOS_SREVAL@8b9af3bfe8592bea237a492c9c0d66c64439598b -
Branch / Tag:
refs/tags/v0.01.000 - Owner: https://github.com/fsantibanezleal
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@8b9af3bfe8592bea237a492c9c0d66c64439598b -
Trigger Event:
release
-
Statement type: