From 80128cb7d0752fb0956fd3179b5695f681732528 Mon Sep 17 00:00:00 2001 From: "Qazi M. Hanif" Date: Tue, 20 Oct 2026 19:34:00 +0500 Subject: [PATCH 1/5] pir: update to pir-engine 3.6.0 with built-in fallback gates - algorithms/pir/install.sh: install tag v3.6.0 (was v3.5). - experiment/methods/pir/regressor.py: pass gates="all" to the engine; gates is an explicit constructor argument so get_params() records it. The vanilla engine configuration is unchanged. - algorithms/pir/metadata.yml: describe the gates; add the software DOI; drop the outdated Tier A figure from the description. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_019mo31AVugYdfXietM73iWZ --- algorithms/pir/install.sh | 2 +- algorithms/pir/metadata.yml | 14 +++++++------- experiment/methods/pir/regressor.py | 30 +++++++++++++++++++---------- 3 files changed, 28 insertions(+), 18 deletions(-) diff --git a/algorithms/pir/install.sh b/algorithms/pir/install.sh index d3454dfd..e2a3db12 100644 --- a/algorithms/pir/install.sh +++ b/algorithms/pir/install.sh @@ -1,2 +1,2 @@ #!/bin/bash -pip install "git+https://github.com/Qazi-pk/physics-engine.git@v3.5" +pip install "git+https://github.com/Qazi-pk/physics-engine.git@v3.6.0" diff --git a/algorithms/pir/metadata.yml b/algorithms/pir/metadata.yml index 1e4effa4..8c3d1eeb 100644 --- a/algorithms/pir/metadata.yml +++ b/algorithms/pir/metadata.yml @@ -10,10 +10,10 @@ paper: title: "PIR: Physics Intermediate Representation for Automated Discovery of Physical Laws" url: https://doi.org/10.5281/zenodo.21351039 description: > - Classical symbolic regression via monomial-basis search with log-linearization - gate for power-law detection (F3 gate), pairwise structure decomposition, - RANSAC, sparse regression, and iterative residual refinement with Occam - complexity penalty. No neural components. Verified blind Feynman Tier A: - 12/44 EXACT (zero seed wobble, v3.4). Secondary: +12/44 FORM_NUMERIC - (correct functional form, transcendental constant as decimal, reported - separately and never summed into the primary figure). + Classical symbolic regression (no neural components): monomial-basis search + with log-linearization power-law detection, pairwise structure decomposition, + RANSAC, sparse regression, and iterative residual refinement with an Occam + complexity penalty. Since pir-engine 3.6.0, fallback gates run after the + engine when its model is not exact: an exact rational-function gate (P/Q), + an exact exponential gate, and a noise-tolerant power-law gate with exponents + snapped to simple fractions. Software DOI: 10.5281/zenodo.23460311. diff --git a/experiment/methods/pir/regressor.py b/experiment/methods/pir/regressor.py index de48c25f..5e92fb1f 100644 --- a/experiment/methods/pir/regressor.py +++ b/experiment/methods/pir/regressor.py @@ -10,14 +10,21 @@ complexity(est) returns an integer complexity count for the model eval_kwargs method-specific args forwarded to evaluate_model.py -No neural components. Vanilla classical PIR only — this is the configuration -that produced the verified blind Tier A baseline: +No neural components. Classical PIR engine (unchanged vanilla configuration +below), followed since pir-engine 3.6.0 by its built-in fallback gates +(gates="all"), tried in a fixed order only when the engine's model is not +already exact: - 12/44 EXACT (zero seed wobble, v3.4) - +12/44 FORM_NUMERIC secondary (correct functional form, transcendental - constant folded as decimal — reported separately, never summed) + rational y = P(x)/Q(x), low-degree polynomials (accepted only if exact) + exp y = C*exp(sum of monomials) (accepted only if exact) + noisy y = C*prod x_j**(p/q), exponents snapped to simple fractions + (accepted only if its training MSE <= the engine's) -Engine: https://github.com/Qazi-pk/physics-engine (MIT, tag v3.5) +A gate's model replaces the engine's only when it passes its test; any error +inside a gate keeps the engine's model. Thresholds are fixed in the engine. + +Engine: https://github.com/Qazi-pk/physics-engine (MIT, tag v3.6.0) +Software DOI: https://doi.org/10.5281/zenodo.23460311 Paper: https://doi.org/10.5281/zenodo.21351039 """ @@ -26,11 +33,11 @@ import numpy as np # The classical engine. algorithms/pir/install.sh pip-installs this from the -# public repo at tag v3.5. +# public repo at tag v3.6.0. from physics_engine.sklearn_adapter import PIRRegressor from sklearn.base import BaseEstimator, RegressorMixin -# --- Vanilla config that produced the verified blind Tier A result ------------ +# --- Vanilla engine config (unchanged since v3.4) ----------------------------- _PIR_VANILLA_CONFIG = dict( enforce_dimensions=False, # blind sweep ran with dim-filter OFF allowed_powers=[1, 2], # powers 1,2 only (structural cap) @@ -53,15 +60,18 @@ class PIRClassicRegressor(BaseEstimator, RegressorMixin): SRBench's own timeout handler (per gAldeia's review on PR #210). The `max_time` constructor kwarg is still accepted, for API compatibility with the harness's test_params override, but is currently unused. + `gates` is passed to the engine (pir-engine >= 3.6.0); it is an explicit + constructor argument so that it is recorded by get_params(). """ - def __init__(self, max_time=3600, random_state=None, **pir_kwargs): + def __init__(self, max_time=3600, random_state=None, gates="all", **pir_kwargs): self.max_time = max_time self.random_state = random_state + self.gates = gates self.pir_kwargs = {**_PIR_VANILLA_CONFIG, **pir_kwargs} def _build(self): - kw = dict(self.pir_kwargs) + kw = dict(self.pir_kwargs, gates=self.gates) seed = 0 if self.random_state is None else self.random_state try: return PIRRegressor(random_state=seed, **kw) From 6cae0cd3eaa5132cc996c2426070b9f45fda2597 Mon Sep 17 00:00:00 2001 From: Muhammad Hanif Date: Sun, 25 Oct 2026 08:26:17 +0500 Subject: [PATCH 2/5] pir: update to pir-engine 3.7.0 (safeguard) --- algorithms/pir/install.sh | 2 +- algorithms/pir/metadata.yml | 4 +++- experiment/methods/pir/regressor.py | 29 ++++++++++++++++++++++------- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/algorithms/pir/install.sh b/algorithms/pir/install.sh index e2a3db12..77c74fa0 100644 --- a/algorithms/pir/install.sh +++ b/algorithms/pir/install.sh @@ -1,2 +1,2 @@ #!/bin/bash -pip install "git+https://github.com/Qazi-pk/physics-engine.git@v3.6.0" +pip install "git+https://github.com/Qazi-pk/physics-engine.git@v3.7.0" diff --git a/algorithms/pir/metadata.yml b/algorithms/pir/metadata.yml index 8c3d1eeb..37d61d67 100644 --- a/algorithms/pir/metadata.yml +++ b/algorithms/pir/metadata.yml @@ -16,4 +16,6 @@ description: > complexity penalty. Since pir-engine 3.6.0, fallback gates run after the engine when its model is not exact: an exact rational-function gate (P/Q), an exact exponential gate, and a noise-tolerant power-law gate with exponents - snapped to simple fractions. Software DOI: 10.5281/zenodo.23460311. + snapped to simple fractions. Since 3.7.0, a safeguard returns a ridge-linear + model (or the mean) instead when the formula fits clearly worse than that + baseline under cross-validation. Software DOI: 10.5281/zenodo.23631107. diff --git a/experiment/methods/pir/regressor.py b/experiment/methods/pir/regressor.py index 5e92fb1f..9e9aaabb 100644 --- a/experiment/methods/pir/regressor.py +++ b/experiment/methods/pir/regressor.py @@ -23,8 +23,14 @@ A gate's model replaces the engine's only when it passes its test; any error inside a gate keeps the engine's model. Thresholds are fixed in the engine. -Engine: https://github.com/Qazi-pk/physics-engine (MIT, tag v3.6.0) -Software DOI: https://doi.org/10.5281/zenodo.23460311 +Since pir-engine 3.7.0, a safeguard (safeguard=True) then compares the final +formula with a ridge-regression linear model and the mean of y: a formula with +training R^2 >= 0.999 is always kept; otherwise the linear model replaces it +only if its 5-fold cross-validated R^2 is higher by more than 0.05, and the +mean is returned if both are below 0. Rules are fixed in the engine. + +Engine: https://github.com/Qazi-pk/physics-engine (MIT, tag v3.7.0) +Software DOI: https://doi.org/10.5281/zenodo.23631107 Paper: https://doi.org/10.5281/zenodo.21351039 """ @@ -33,7 +39,7 @@ import numpy as np # The classical engine. algorithms/pir/install.sh pip-installs this from the -# public repo at tag v3.6.0. +# public repo at tag v3.7.0. from physics_engine.sklearn_adapter import PIRRegressor from sklearn.base import BaseEstimator, RegressorMixin @@ -60,18 +66,27 @@ class PIRClassicRegressor(BaseEstimator, RegressorMixin): SRBench's own timeout handler (per gAldeia's review on PR #210). The `max_time` constructor kwarg is still accepted, for API compatibility with the harness's test_params override, but is currently unused. - `gates` is passed to the engine (pir-engine >= 3.6.0); it is an explicit - constructor argument so that it is recorded by get_params(). + `gates` (pir-engine >= 3.6.0) and `safeguard` (>= 3.7.0) are passed to + the engine; they are explicit constructor arguments so that they are + recorded by get_params(). """ - def __init__(self, max_time=3600, random_state=None, gates="all", **pir_kwargs): + def __init__( + self, + max_time=3600, + random_state=None, + gates="all", + safeguard=True, + **pir_kwargs, + ): self.max_time = max_time self.random_state = random_state self.gates = gates + self.safeguard = safeguard self.pir_kwargs = {**_PIR_VANILLA_CONFIG, **pir_kwargs} def _build(self): - kw = dict(self.pir_kwargs, gates=self.gates) + kw = dict(self.pir_kwargs, gates=self.gates, safeguard=self.safeguard) seed = 0 if self.random_state is None else self.random_state try: return PIRRegressor(random_state=seed, **kw) From 9f0b8c762eb839094d668228f48fbcfe162af932 Mon Sep 17 00:00:00 2001 From: Muhammad Hanif Date: Sat, 31 Oct 2026 22:44:55 +0500 Subject: [PATCH 3/5] pir: update to pir-engine 3.8.0 (separability=True) --- algorithms/pir/install.sh | 2 +- algorithms/pir/metadata.yml | 5 ++++- experiment/methods/pir/regressor.py | 26 ++++++++++++++++++++------ 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/algorithms/pir/install.sh b/algorithms/pir/install.sh index 77c74fa0..c84a3563 100644 --- a/algorithms/pir/install.sh +++ b/algorithms/pir/install.sh @@ -1,2 +1,2 @@ #!/bin/bash -pip install "git+https://github.com/Qazi-pk/physics-engine.git@v3.7.0" +pip install "git+https://github.com/Qazi-pk/physics-engine.git@v3.8.0" diff --git a/algorithms/pir/metadata.yml b/algorithms/pir/metadata.yml index 37d61d67..c7cc1e7c 100644 --- a/algorithms/pir/metadata.yml +++ b/algorithms/pir/metadata.yml @@ -18,4 +18,7 @@ description: > an exact exponential gate, and a noise-tolerant power-law gate with exponents snapped to simple fractions. Since 3.7.0, a safeguard returns a ridge-linear model (or the mean) instead when the formula fits clearly worse than that - baseline under cross-validation. Software DOI: 10.5281/zenodo.23631107. + baseline under cross-validation. Since 3.8.0, a deterministic separability + stage tests whether y = g(A)*h(B) for a split of the inputs, solves the + parts separately and accepts their product only if it is exact. + Software DOI: 10.5281/zenodo.23827328. diff --git a/experiment/methods/pir/regressor.py b/experiment/methods/pir/regressor.py index 9e9aaabb..56617471 100644 --- a/experiment/methods/pir/regressor.py +++ b/experiment/methods/pir/regressor.py @@ -29,8 +29,15 @@ only if its 5-fold cross-validated R^2 is higher by more than 0.05, and the mean is returned if both are below 0. Rules are fixed in the engine. -Engine: https://github.com/Qazi-pk/physics-engine (MIT, tag v3.7.0) -Software DOI: https://doi.org/10.5281/zenodo.23631107 +Since pir-engine 3.8.0, a separability stage (separability=True) runs after +the engine and before the gates, only when the engine's model is not exact: a +deterministic cross-term test looks for a split of the inputs with +y = g(A)*h(B), the parts are solved separately (at most 4 attempts, each on a +fixed 5,000-row subsample), and the product is accepted only if it reproduces +all training rows exactly (max relative error < 1e-6) and beats the engine. + +Engine: https://github.com/Qazi-pk/physics-engine (MIT, tag v3.8.0) +Software DOI: https://doi.org/10.5281/zenodo.23827328 Paper: https://doi.org/10.5281/zenodo.21351039 """ @@ -39,7 +46,7 @@ import numpy as np # The classical engine. algorithms/pir/install.sh pip-installs this from the -# public repo at tag v3.7.0. +# public repo at tag v3.8.0. from physics_engine.sklearn_adapter import PIRRegressor from sklearn.base import BaseEstimator, RegressorMixin @@ -66,8 +73,8 @@ class PIRClassicRegressor(BaseEstimator, RegressorMixin): SRBench's own timeout handler (per gAldeia's review on PR #210). The `max_time` constructor kwarg is still accepted, for API compatibility with the harness's test_params override, but is currently unused. - `gates` (pir-engine >= 3.6.0) and `safeguard` (>= 3.7.0) are passed to - the engine; they are explicit constructor arguments so that they are + `gates` (pir-engine >= 3.6.0), `safeguard` (>= 3.7.0) and `separability` + (>= 3.8.0) are passed to the engine; they are explicit constructor arguments so that they are recorded by get_params(). """ @@ -77,16 +84,23 @@ def __init__( random_state=None, gates="all", safeguard=True, + separability=True, **pir_kwargs, ): self.max_time = max_time self.random_state = random_state self.gates = gates self.safeguard = safeguard + self.separability = separability self.pir_kwargs = {**_PIR_VANILLA_CONFIG, **pir_kwargs} def _build(self): - kw = dict(self.pir_kwargs, gates=self.gates, safeguard=self.safeguard) + kw = dict( + self.pir_kwargs, + gates=self.gates, + safeguard=self.safeguard, + separability=self.separability, + ) seed = 0 if self.random_state is None else self.random_state try: return PIRRegressor(random_state=seed, **kw) From b54a466afca5c5f4dcd43f73ee1599bc312a537e Mon Sep 17 00:00:00 2001 From: Muhammad Hanif Date: Tue, 3 Nov 2026 23:05:35 +0500 Subject: [PATCH 4/5] PIR: update to pir-engine 3.9.0 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_019mo31AVugYdfXietM73iWZ --- algorithms/pir/install.sh | 2 +- algorithms/pir/metadata.yml | 5 +++-- experiment/methods/pir/regressor.py | 8 +++++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/algorithms/pir/install.sh b/algorithms/pir/install.sh index c84a3563..102d4a21 100644 --- a/algorithms/pir/install.sh +++ b/algorithms/pir/install.sh @@ -1,2 +1,2 @@ #!/bin/bash -pip install "git+https://github.com/Qazi-pk/physics-engine.git@v3.8.0" +pip install "git+https://github.com/Qazi-pk/physics-engine.git@v3.9.0" diff --git a/algorithms/pir/metadata.yml b/algorithms/pir/metadata.yml index c7cc1e7c..a80ffb9c 100644 --- a/algorithms/pir/metadata.yml +++ b/algorithms/pir/metadata.yml @@ -20,5 +20,6 @@ description: > model (or the mean) instead when the formula fits clearly worse than that baseline under cross-validation. Since 3.8.0, a deterministic separability stage tests whether y = g(A)*h(B) for a split of the inputs, solves the - parts separately and accepts their product only if it is exact. - Software DOI: 10.5281/zenodo.23827328. + parts separately and accepts their product only if it is exact. Since 3.9.0 + it also handles sign-changing targets and root and sin/cos factors. + Software DOI: 10.5281/zenodo.23926418. diff --git a/experiment/methods/pir/regressor.py b/experiment/methods/pir/regressor.py index 56617471..5a6cd10c 100644 --- a/experiment/methods/pir/regressor.py +++ b/experiment/methods/pir/regressor.py @@ -35,9 +35,11 @@ y = g(A)*h(B), the parts are solved separately (at most 4 attempts, each on a fixed 5,000-row subsample), and the product is accepted only if it reproduces all training rows exactly (max relative error < 1e-6) and beats the engine. +Since 3.9.0 it also handles targets that change sign and, in a late pass after +the gates, factors that are roots or sin/cos terms; acceptance is still exact. -Engine: https://github.com/Qazi-pk/physics-engine (MIT, tag v3.8.0) -Software DOI: https://doi.org/10.5281/zenodo.23827328 +Engine: https://github.com/Qazi-pk/physics-engine (MIT, tag v3.9.0) +Software DOI: https://doi.org/10.5281/zenodo.23926418 Paper: https://doi.org/10.5281/zenodo.21351039 """ @@ -46,7 +48,7 @@ import numpy as np # The classical engine. algorithms/pir/install.sh pip-installs this from the -# public repo at tag v3.8.0. +# public repo at tag v3.9.0. from physics_engine.sklearn_adapter import PIRRegressor from sklearn.base import BaseEstimator, RegressorMixin From 86aec4d7fbb72ecd8884421df78cbf974bb50015 Mon Sep 17 00:00:00 2001 From: Muhammad Hanif Date: Thu, 12 Nov 2026 15:09:16 +0500 Subject: [PATCH 5/5] pir: update to pir-engine 3.10.0 (noise_tolerant=True) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_019mo31AVugYdfXietM73iWZ --- algorithms/pir/install.sh | 2 +- algorithms/pir/metadata.yml | 7 ++++++- experiment/methods/pir/regressor.py | 24 ++++++++++++++++++------ 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/algorithms/pir/install.sh b/algorithms/pir/install.sh index 102d4a21..896e88bb 100644 --- a/algorithms/pir/install.sh +++ b/algorithms/pir/install.sh @@ -1,2 +1,2 @@ #!/bin/bash -pip install "git+https://github.com/Qazi-pk/physics-engine.git@v3.9.0" +pip install "git+https://github.com/Qazi-pk/physics-engine.git@v3.10.0" diff --git a/algorithms/pir/metadata.yml b/algorithms/pir/metadata.yml index a80ffb9c..ba2107c2 100644 --- a/algorithms/pir/metadata.yml +++ b/algorithms/pir/metadata.yml @@ -22,4 +22,9 @@ description: > stage tests whether y = g(A)*h(B) for a split of the inputs, solves the parts separately and accepts their product only if it is exact. Since 3.9.0 it also handles sign-changing targets and root and sin/cos factors. - Software DOI: 10.5281/zenodo.23926418. + Since 3.10.0, a noise-tolerant stage (at least 2,000 training rows, only + when nothing is exact) fits separable, exponential and rational forms, + snaps exponents and coefficient ratios to simple fractions within their + standard errors, and accepts a form only if it predicts held-out rows as + well as a flexible reference model. + Software DOI: 10.5281/zenodo.24156912. diff --git a/experiment/methods/pir/regressor.py b/experiment/methods/pir/regressor.py index 5a6cd10c..841349b4 100644 --- a/experiment/methods/pir/regressor.py +++ b/experiment/methods/pir/regressor.py @@ -38,8 +38,17 @@ Since 3.9.0 it also handles targets that change sign and, in a late pass after the gates, factors that are roots or sin/cos terms; acceptance is still exact. -Engine: https://github.com/Qazi-pk/physics-engine (MIT, tag v3.9.0) -Software DOI: https://doi.org/10.5281/zenodo.23926418 +Since pir-engine 3.10.0, a noise-tolerant stage (noise_tolerant=True) runs +after the late separability pass and before the safeguard, only when no model +so far is exact and there are at least 2,000 training rows. It fits separable, +power-law-times-exp and short rational forms on 75% of (at most 20,000) rows, +snaps exponents and coefficient ratios to simple fractions within 3 standard +errors, accepts a form only if it predicts the other 25% within 5% of a +flexible reference model, and replaces the current model only if it predicts +those rows better. Rules are fixed in the engine. + +Engine: https://github.com/Qazi-pk/physics-engine (MIT, tag v3.10.0) +Software DOI: https://doi.org/10.5281/zenodo.24156912 Paper: https://doi.org/10.5281/zenodo.21351039 """ @@ -48,7 +57,7 @@ import numpy as np # The classical engine. algorithms/pir/install.sh pip-installs this from the -# public repo at tag v3.9.0. +# public repo at tag v3.10.0. from physics_engine.sklearn_adapter import PIRRegressor from sklearn.base import BaseEstimator, RegressorMixin @@ -75,9 +84,9 @@ class PIRClassicRegressor(BaseEstimator, RegressorMixin): SRBench's own timeout handler (per gAldeia's review on PR #210). The `max_time` constructor kwarg is still accepted, for API compatibility with the harness's test_params override, but is currently unused. - `gates` (pir-engine >= 3.6.0), `safeguard` (>= 3.7.0) and `separability` - (>= 3.8.0) are passed to the engine; they are explicit constructor arguments so that they are - recorded by get_params(). + `gates` (pir-engine >= 3.6.0), `safeguard` (>= 3.7.0), `separability` + (>= 3.8.0) and `noise_tolerant` (>= 3.10.0) are passed to the engine; they + are explicit constructor arguments so that they are recorded by get_params(). """ def __init__( @@ -87,6 +96,7 @@ def __init__( gates="all", safeguard=True, separability=True, + noise_tolerant=True, **pir_kwargs, ): self.max_time = max_time @@ -94,6 +104,7 @@ def __init__( self.gates = gates self.safeguard = safeguard self.separability = separability + self.noise_tolerant = noise_tolerant self.pir_kwargs = {**_PIR_VANILLA_CONFIG, **pir_kwargs} def _build(self): @@ -102,6 +113,7 @@ def _build(self): gates=self.gates, safeguard=self.safeguard, separability=self.separability, + noise_tolerant=self.noise_tolerant, ) seed = 0 if self.random_state is None else self.random_state try: