From 086938e48ac4d45845ce4fbe25ae83b65a35d688 Mon Sep 17 00:00:00 2001 From: Allan Scott Date: Mon, 27 Jul 2026 22:19:32 -0400 Subject: [PATCH 1/7] Add lagh: certified symbolic law discovery lagh returns three-track output: machine-checked exact certificates (exhaustive per-point check under a declared error model, with a stated chance-fit significance bound alpha), labeled empirical conjectures, or explicit abstentions. For this harness the conjecture track always answers; certificate status is carried as estimator metadata (track_/tag_/alpha_log10_). Zero-confident-wrong invariant. Method source: https://github.com/jascal/lagh (Apache-2.0), installed from the stable repo via install.sh per the contribution guidelines. --- algorithms/lagh/install.sh | 4 ++++ algorithms/lagh/metadata.yml | 15 +++++++++++++++ algorithms/lagh/regressor.py | 22 ++++++++++++++++++++++ algorithms/lagh/requirements.txt | 2 ++ 4 files changed, 43 insertions(+) create mode 100755 algorithms/lagh/install.sh create mode 100644 algorithms/lagh/metadata.yml create mode 100644 algorithms/lagh/regressor.py create mode 100644 algorithms/lagh/requirements.txt diff --git a/algorithms/lagh/install.sh b/algorithms/lagh/install.sh new file mode 100755 index 000000000..3cf38c46b --- /dev/null +++ b/algorithms/lagh/install.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +# SRBench install hook: pull lagh from its stable source repository. +set -e +pip install "git+https://github.com/jascal/lagh@master" diff --git a/algorithms/lagh/metadata.yml b/algorithms/lagh/metadata.yml new file mode 100644 index 000000000..f3ecba134 --- /dev/null +++ b/algorithms/lagh/metadata.yml @@ -0,0 +1,15 @@ +# SRBench method metadata (contract: algorithms/feat/metadata.yml format) +name: lagh +short_name: lagh +description: > + Certified symbolic law discovery. Outputs are three-track: machine-checked + exact certificates (every point within a declared epsilon; chance-fit + significance bound alpha reported), labeled empirical conjectures, or + explicit abstentions. For this harness the conjecture track always answers; + certificate status is carried as estimator metadata (track_/tag_/ + alpha_log10_). Zero-confident-wrong invariant: the system never claims an + exact law it cannot certify. +authors: James Allan Scott (jascal) +url: https://github.com/jascal/lagh +license: Apache-2.0 +language: python diff --git a/algorithms/lagh/regressor.py b/algorithms/lagh/regressor.py new file mode 100644 index 000000000..f86ea47a7 --- /dev/null +++ b/algorithms/lagh/regressor.py @@ -0,0 +1,22 @@ +"""SRBench entry for lagh (certified symbolic law discovery). + +Contract objects: `est` (sklearn-compatible regressor), `model(est, X)` +(sympy-compatible string), `eval_kwargs`. +""" +from lagh.sklearn import LaghRegressor + +est = LaghRegressor(max_time=3600) + + +def model(est, X=None): + """Sympy-compatible model string, with x_i mapped to X's column names + (SRBench requirement: variable names must match the training DataFrame).""" + m = est.model() + if X is not None and hasattr(X, "columns"): + mapping = {"x_" + str(i): k for i, k in enumerate(X.columns)} + for k, v in reversed(list(mapping.items())): + m = m.replace(k, str(v)) + return m + + +eval_kwargs = {} diff --git a/algorithms/lagh/requirements.txt b/algorithms/lagh/requirements.txt new file mode 100644 index 000000000..05bdf190f --- /dev/null +++ b/algorithms/lagh/requirements.txt @@ -0,0 +1,2 @@ +numpy +sympy From f4214157c4c1067edb2eb965085b8fbd23c73fb7 Mon Sep 17 00:00:00 2001 From: Allan Scott Date: Mon, 27 Jul 2026 22:29:11 -0400 Subject: [PATCH 2/7] ci: bump retired actions so PR CI can run (cache v2 auto-fails) actions/cache v1/v2 were closed down by GitHub in early 2025; every job now fails at 'Set up job' before running. Bump cache v2->v4, checkout v2->v4, setup-miniconda v2->v3 in the PR-triggered workflow only. --- .github/workflows/ci.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 572b55c0b..5d0c11097 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,10 +41,10 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Setup Mambaforge - uses: conda-incubator/setup-miniconda@v2 + uses: conda-incubator/setup-miniconda@v3 with: miniforge-variant: Mambaforge miniforge-version: latest @@ -52,7 +52,7 @@ jobs: use-mamba: true - name: Cache conda - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: /usr/share/miniconda3/envs/srbench key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{hashFiles('environment.yml','experiment/methods/src/*.sh')}}-${{ github.sha }} @@ -85,7 +85,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: generate alg list run: bash ci/get_algorithm_list.sh @@ -111,10 +111,10 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Setup Mambaforge - uses: conda-incubator/setup-miniconda@v2 + uses: conda-incubator/setup-miniconda@v3 with: miniforge-variant: Mambaforge miniforge-version: latest @@ -122,7 +122,7 @@ jobs: use-mamba: true - name: Cache conda - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: /usr/share/miniconda3/envs/srbench key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('environment.yml','experiment/methods/src/*.sh') }}-${{ github.sha }} @@ -156,10 +156,10 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Setup Mambaforge - uses: conda-incubator/setup-miniconda@v2 + uses: conda-incubator/setup-miniconda@v3 with: miniforge-variant: Mambaforge miniforge-version: latest @@ -167,7 +167,7 @@ jobs: use-mamba: true - name: Cache conda - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: /usr/share/miniconda3/envs/srbench key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('environment.yml','experiment/methods/src/*.sh') }}-${{ github.sha }} From b891cd920aff49513ad7e1eeda144f984f8d235e Mon Sep 17 00:00:00 2001 From: Allan Scott Date: Mon, 27 Jul 2026 22:30:47 -0400 Subject: [PATCH 3/7] ci: Mambaforge installers are gone (404) -- use Miniforge3 conda-forge sunset Mambaforge; the latest-release download now 404s and setup-miniconda's own warning says to switch. Miniforge3 ships mamba. --- .github/workflows/ci.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5d0c11097..2d6567325 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,10 +43,10 @@ jobs: name: Checkout code uses: actions/checkout@v4 - - name: Setup Mambaforge + name: Setup Miniforge uses: conda-incubator/setup-miniconda@v3 with: - miniforge-variant: Mambaforge + miniforge-variant: Miniforge3 miniforge-version: latest activate-environment: srbench use-mamba: true @@ -113,10 +113,10 @@ jobs: name: Checkout code uses: actions/checkout@v4 - - name: Setup Mambaforge + name: Setup Miniforge uses: conda-incubator/setup-miniconda@v3 with: - miniforge-variant: Mambaforge + miniforge-variant: Miniforge3 miniforge-version: latest activate-environment: srbench use-mamba: true @@ -158,10 +158,10 @@ jobs: name: Checkout code uses: actions/checkout@v4 - - name: Setup Mambaforge + name: Setup Miniforge uses: conda-incubator/setup-miniconda@v3 with: - miniforge-variant: Mambaforge + miniforge-variant: Miniforge3 miniforge-version: latest activate-environment: srbench use-mamba: true From 27306dae6ca861f4e3136d712553f6ed2b4b5a5b Mon Sep 17 00:00:00 2001 From: Allan Scott Date: Mon, 27 Jul 2026 22:55:29 -0400 Subject: [PATCH 4/7] add srbench_2025 hooks: complexity(), get_population(), get_best_solution() Same regressor file works under both the dev contract and the 2025 living-benchmark contract (experiment/methods layout can be mirrored on request). --- algorithms/lagh/regressor.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/algorithms/lagh/regressor.py b/algorithms/lagh/regressor.py index f86ea47a7..8138c6d3c 100644 --- a/algorithms/lagh/regressor.py +++ b/algorithms/lagh/regressor.py @@ -20,3 +20,20 @@ def model(est, X=None): eval_kwargs = {} + + +def complexity(est): + """Parse-tree node count of the final expression (srbench_2025 fallback; + normally computed from the sympy string).""" + import sympy as sp + e = sp.sympify(est.model()) + return int(sp.count_ops(e, visual=False)) + len(e.free_symbols) + 1 + + +def get_population(est): + """lagh keeps a single certified/conjectured model, not a population.""" + return [est] + + +def get_best_solution(est): + return est From 4e5204e83916220edcaa80d302ca86710e650724 Mon Sep 17 00:00:00 2001 From: Allan Scott Date: Tue, 28 Jul 2026 00:35:08 -0400 Subject: [PATCH 5/7] ci: allow the deprecated PyPI sklearn shim the 2022 env still pulls The root environment's pip section transitively installs the retired 'sklearn' package, which now hard-errors; set the documented escape hatch so the baseline env can build. --- .github/workflows/ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2d6567325..f164f5900 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,6 +2,11 @@ name: CI +env: + # the 2022 baseline env pulls the deprecated PyPI "sklearn" shim, which now + # hard-errors on install; this is the workaround the error message names + SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL: "True" + # Controls when the action will run. on: # Triggers the workflow on push or pull request events but only for the master and dev branches From f10c14e97517c695e43186ac7e9d9d7022ef4709 Mon Sep 17 00:00:00 2001 From: Allan Scott Date: Tue, 28 Jul 2026 06:10:06 -0400 Subject: [PATCH 6/7] ci: merge sklearn escape hatch into the existing env block (duplicate key) --- .github/workflows/ci.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f164f5900..2d6567325 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,11 +2,6 @@ name: CI -env: - # the 2022 baseline env pulls the deprecated PyPI "sklearn" shim, which now - # hard-errors on install; this is the workaround the error message names - SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL: "True" - # Controls when the action will run. on: # Triggers the workflow on push or pull request events but only for the master and dev branches From 7045b036d128d42a6b85d1ba976812ccf65674f5 Mon Sep 17 00:00:00 2001 From: Allan Scott Date: Tue, 28 Jul 2026 06:10:31 -0400 Subject: [PATCH 7/7] ci: sklearn escape hatch inside the existing env block (correct placement) --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2d6567325..88eb4ba05 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,6 +28,9 @@ on: env: CACHE_NUMBER: 0 + # the 2022 baseline env pulls the deprecated PyPI "sklearn" shim, which now + # hard-errors on install; this is the workaround the error message names + SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL: "True" jobs: ################################################################################