symbolic-data 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- symbolic_data-0.1.0/LICENSE +21 -0
- symbolic_data-0.1.0/PKG-INFO +74 -0
- symbolic_data-0.1.0/README.md +49 -0
- symbolic_data-0.1.0/pyproject.toml +38 -0
- symbolic_data-0.1.0/setup.cfg +4 -0
- symbolic_data-0.1.0/src/symbolic_data/__init__.py +19 -0
- symbolic_data-0.1.0/src/symbolic_data/benchmarks/__init__.py +4 -0
- symbolic_data-0.1.0/src/symbolic_data/benchmarks/fastsrb.py +524 -0
- symbolic_data-0.1.0/src/symbolic_data/compilation.py +27 -0
- symbolic_data-0.1.0/src/symbolic_data/config_io.py +155 -0
- symbolic_data-0.1.0/src/symbolic_data/datasets.py +77 -0
- symbolic_data-0.1.0/src/symbolic_data/distributions.py +174 -0
- symbolic_data-0.1.0/src/symbolic_data/holdout.py +106 -0
- symbolic_data-0.1.0/src/symbolic_data/paths.py +68 -0
- symbolic_data-0.1.0/src/symbolic_data/prior_factory.py +31 -0
- symbolic_data-0.1.0/src/symbolic_data/registry.py +133 -0
- symbolic_data-0.1.0/src/symbolic_data/samples.py +255 -0
- symbolic_data-0.1.0/src/symbolic_data/skeleton_pool.py +817 -0
- symbolic_data-0.1.0/src/symbolic_data/skeleton_sampling.py +129 -0
- symbolic_data-0.1.0/src/symbolic_data/structure.py +24 -0
- symbolic_data-0.1.0/src/symbolic_data/support_sampling.py +457 -0
- symbolic_data-0.1.0/src/symbolic_data/sympy_timeout.py +89 -0
- symbolic_data-0.1.0/src/symbolic_data/tensor_ops.py +55 -0
- symbolic_data-0.1.0/src/symbolic_data/token_ops.py +72 -0
- symbolic_data-0.1.0/src/symbolic_data.egg-info/PKG-INFO +74 -0
- symbolic_data-0.1.0/src/symbolic_data.egg-info/SOURCES.txt +31 -0
- symbolic_data-0.1.0/src/symbolic_data.egg-info/dependency_links.txt +1 -0
- symbolic_data-0.1.0/src/symbolic_data.egg-info/requires.txt +13 -0
- symbolic_data-0.1.0/src/symbolic_data.egg-info/top_level.txt +1 -0
- symbolic_data-0.1.0/tests/test_datasets.py +49 -0
- symbolic_data-0.1.0/tests/test_holdout_manager.py +95 -0
- symbolic_data-0.1.0/tests/test_registry.py +120 -0
- symbolic_data-0.1.0/tests/test_samples.py +137 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Paul Saegert
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: symbolic-data
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Model-agnostic symbolic-regression data layer: skeleton/expression sampling, priors, holdout, datasets.
|
|
5
|
+
Author: Paul Saegert
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/psaegert/symbolic-data
|
|
8
|
+
Project-URL: Repository, https://github.com/psaegert/symbolic-data
|
|
9
|
+
Keywords: symbolic-regression,dataset,sampling,holdout,expression
|
|
10
|
+
Requires-Python: >=3.11
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Requires-Dist: numpy
|
|
14
|
+
Requires-Dist: scikit-learn
|
|
15
|
+
Requires-Dist: simplipy>=0.3.1
|
|
16
|
+
Requires-Dist: pyyaml
|
|
17
|
+
Requires-Dist: tqdm
|
|
18
|
+
Requires-Dist: huggingface_hub
|
|
19
|
+
Provides-Extra: sympy
|
|
20
|
+
Requires-Dist: sympy; extra == "sympy"
|
|
21
|
+
Provides-Extra: dev
|
|
22
|
+
Requires-Dist: pytest; extra == "dev"
|
|
23
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
|
|
26
|
+
# symbolic_data
|
|
27
|
+
|
|
28
|
+
The model-agnostic symbolic-regression **data layer**, carved out of
|
|
29
|
+
[flash-ansr](https://github.com/psaegert/flash-ansr): skeleton/expression sampling,
|
|
30
|
+
priors, `(X, y)` support sampling, holdout management, and dataset construction.
|
|
31
|
+
|
|
32
|
+
Both symbolic-regression methods (for training holdout) and the
|
|
33
|
+
[srbf](https://github.com/psaegert/srbf) eval framework depend on it, so training,
|
|
34
|
+
holdout, and evaluation draw from one source of truth. Depends only on
|
|
35
|
+
[`simplipy`](https://github.com/psaegert/simplipy) + numpy/sklearn.
|
|
36
|
+
|
|
37
|
+
## Install
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pip install symbolic-data
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Quick start
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
import symbolic_data
|
|
47
|
+
|
|
48
|
+
# 1. Sample (X, y) problems from a skeleton pool (the model-agnostic seam)
|
|
49
|
+
pool = symbolic_data.SkeletonPool.from_config("skeleton_pool.yaml")
|
|
50
|
+
pool.create(100)
|
|
51
|
+
for sample in symbolic_data.iter_samples(pool, n_support=32, noise_level=0.01, seed=0):
|
|
52
|
+
sample.x_support, sample.y_support, sample.expression # ready to fit / tokenize
|
|
53
|
+
|
|
54
|
+
# 2. Load a benchmark (spec fetched + cached from the psaegert/ansr-data HF dataset)
|
|
55
|
+
fastsrb = symbolic_data.load_benchmark("fastsrb")
|
|
56
|
+
dataset = fastsrb.sample("II.38.3", n_points=100)
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Extensibility
|
|
60
|
+
|
|
61
|
+
Distributions and benchmarks are pluggable via registries: in-process with
|
|
62
|
+
`@symbolic_data.DISTRIBUTIONS.register("name")` / `@symbolic_data.BENCHMARKS.register("name")`, or
|
|
63
|
+
across packages via `importlib.metadata` entry points (groups `symbolic_data.distributions`,
|
|
64
|
+
`symbolic_data.benchmarks`). A registered name drops into the same config slot as a builtin.
|
|
65
|
+
|
|
66
|
+
## Versioning / reproducibility
|
|
67
|
+
|
|
68
|
+
v1 guarantees **leak-safety** (a seeded, shipped holdout grid + a robust symbolic/numeric
|
|
69
|
+
matcher), not cross-consumer byte-identical regeneration (the rng-Generator threading is a
|
|
70
|
+
separate, later phase). Benchmark specs are HF-versioned and stamped on `.provenance`.
|
|
71
|
+
|
|
72
|
+
> Status: v0.1.0. Registry, `iter_samples` seam, and `load_benchmark` (FastSRB) are in.
|
|
73
|
+
> Deferred: the MIA matched-control audit, curated benchmark loaders (Feynman/Nguyen), the
|
|
74
|
+
> canonical-v1 holdout grid mint, and cross-consumer byte-identical sampling.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# symbolic_data
|
|
2
|
+
|
|
3
|
+
The model-agnostic symbolic-regression **data layer**, carved out of
|
|
4
|
+
[flash-ansr](https://github.com/psaegert/flash-ansr): skeleton/expression sampling,
|
|
5
|
+
priors, `(X, y)` support sampling, holdout management, and dataset construction.
|
|
6
|
+
|
|
7
|
+
Both symbolic-regression methods (for training holdout) and the
|
|
8
|
+
[srbf](https://github.com/psaegert/srbf) eval framework depend on it, so training,
|
|
9
|
+
holdout, and evaluation draw from one source of truth. Depends only on
|
|
10
|
+
[`simplipy`](https://github.com/psaegert/simplipy) + numpy/sklearn.
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pip install symbolic-data
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Quick start
|
|
19
|
+
|
|
20
|
+
```python
|
|
21
|
+
import symbolic_data
|
|
22
|
+
|
|
23
|
+
# 1. Sample (X, y) problems from a skeleton pool (the model-agnostic seam)
|
|
24
|
+
pool = symbolic_data.SkeletonPool.from_config("skeleton_pool.yaml")
|
|
25
|
+
pool.create(100)
|
|
26
|
+
for sample in symbolic_data.iter_samples(pool, n_support=32, noise_level=0.01, seed=0):
|
|
27
|
+
sample.x_support, sample.y_support, sample.expression # ready to fit / tokenize
|
|
28
|
+
|
|
29
|
+
# 2. Load a benchmark (spec fetched + cached from the psaegert/ansr-data HF dataset)
|
|
30
|
+
fastsrb = symbolic_data.load_benchmark("fastsrb")
|
|
31
|
+
dataset = fastsrb.sample("II.38.3", n_points=100)
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Extensibility
|
|
35
|
+
|
|
36
|
+
Distributions and benchmarks are pluggable via registries: in-process with
|
|
37
|
+
`@symbolic_data.DISTRIBUTIONS.register("name")` / `@symbolic_data.BENCHMARKS.register("name")`, or
|
|
38
|
+
across packages via `importlib.metadata` entry points (groups `symbolic_data.distributions`,
|
|
39
|
+
`symbolic_data.benchmarks`). A registered name drops into the same config slot as a builtin.
|
|
40
|
+
|
|
41
|
+
## Versioning / reproducibility
|
|
42
|
+
|
|
43
|
+
v1 guarantees **leak-safety** (a seeded, shipped holdout grid + a robust symbolic/numeric
|
|
44
|
+
matcher), not cross-consumer byte-identical regeneration (the rng-Generator threading is a
|
|
45
|
+
separate, later phase). Benchmark specs are HF-versioned and stamped on `.provenance`.
|
|
46
|
+
|
|
47
|
+
> Status: v0.1.0. Registry, `iter_samples` seam, and `load_benchmark` (FastSRB) are in.
|
|
48
|
+
> Deferred: the MIA matched-control audit, curated benchmark loaders (Feynman/Nguyen), the
|
|
49
|
+
> canonical-v1 holdout grid mint, and cross-consumer byte-identical sampling.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "symbolic-data"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Model-agnostic symbolic-regression data layer: skeleton/expression sampling, priors, holdout, datasets."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.11"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
authors = [{ name = "Paul Saegert" }]
|
|
13
|
+
keywords = ["symbolic-regression", "dataset", "sampling", "holdout", "expression"]
|
|
14
|
+
dependencies = [
|
|
15
|
+
"numpy",
|
|
16
|
+
"scikit-learn",
|
|
17
|
+
"simplipy>=0.3.1",
|
|
18
|
+
"pyyaml",
|
|
19
|
+
"tqdm",
|
|
20
|
+
"huggingface_hub",
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
[project.optional-dependencies]
|
|
24
|
+
sympy = ["sympy"]
|
|
25
|
+
dev = ["pytest", "pytest-cov"]
|
|
26
|
+
|
|
27
|
+
[project.urls]
|
|
28
|
+
Homepage = "https://github.com/psaegert/symbolic-data"
|
|
29
|
+
Repository = "https://github.com/psaegert/symbolic-data"
|
|
30
|
+
|
|
31
|
+
[tool.setuptools.packages.find]
|
|
32
|
+
where = ["src"]
|
|
33
|
+
|
|
34
|
+
[tool.flake8]
|
|
35
|
+
max-line-length = 250
|
|
36
|
+
extend-ignore = ["E203", "W503"]
|
|
37
|
+
per-file-ignores = ["__init__.py:F401"]
|
|
38
|
+
exclude = [".git", "__pycache__", "build", "dist", ".venv", "venv"]
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""symbolic_data -- the model-agnostic symbolic-regression data layer.
|
|
2
|
+
|
|
3
|
+
Skeleton/expression sampling, priors, (X, y) support sampling, holdout management, and
|
|
4
|
+
dataset construction -- carved out of flash-ansr so symbolic-regression methods and the
|
|
5
|
+
srbf eval framework share one data substrate. Depends only on simplipy + numpy/sklearn.
|
|
6
|
+
"""
|
|
7
|
+
from symbolic_data.skeleton_pool import SkeletonPool, NoValidSampleFoundError
|
|
8
|
+
from symbolic_data.holdout import HoldoutManager
|
|
9
|
+
from symbolic_data.skeleton_sampling import SkeletonSampler
|
|
10
|
+
from symbolic_data.support_sampling import SupportSampler, SupportSamplingError
|
|
11
|
+
from symbolic_data.distributions import get_distribution, DISTRIBUTIONS, BASE_DISTRIBUTIONS
|
|
12
|
+
from symbolic_data.prior_factory import build_prior_callable
|
|
13
|
+
from symbolic_data.registry import Registry
|
|
14
|
+
from symbolic_data.samples import Sample, sample_from_skeleton, iter_samples
|
|
15
|
+
from symbolic_data.tensor_ops import mask_unused_variable_columns
|
|
16
|
+
from symbolic_data.datasets import load_benchmark, BENCHMARKS
|
|
17
|
+
from symbolic_data.benchmarks import FastSRBBenchmark
|
|
18
|
+
from symbolic_data.paths import get_path, get_root, substitute_root_path
|
|
19
|
+
from symbolic_data.config_io import load_config, save_config
|