Skip to content

Add PIR (Physics Intermediate Representation) symbolic regression method - #210

Open
Qazi-pk wants to merge 21 commits into
cavalab:masterfrom
Qazi-pk:master
Open

Add PIR (Physics Intermediate Representation) symbolic regression method#210
Qazi-pk wants to merge 21 commits into
cavalab:masterfrom
Qazi-pk:master

Conversation

@Qazi-pk

@Qazi-pk Qazi-pk commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

PIR — Physics Intermediate Representation

Classical symbolic regression engine for automated physical law discovery from data.

Method

  • Monomial-basis search with log-linearization gate for power-law detection
  • Pairwise structure decomposition, RANSAC, sparse regression
  • Iterative residual refinement with Occam complexity penalty
  • No neural components — pure classical pipeline

Blind Feynman Tier A results

12/44 EXACT blind (zero seed wobble), v3.4
Secondary: +12/44 FORM_NUMERIC (correct functional form, transcendental constant as decimal — reported separately, never summed)
Previous baseline: 7/44 (v3.3)

Files

  • algorithms/PIR/regressor.py — sklearn-compatible wrapper
  • algorithms/PIR/install.sh — installs from public repo (MIT license)
  • algorithms/PIR/metadata.yml — method metadata
  • algorithms/PIR/requirements.txt — POT (Python Optimal Transport)

Links

Targeting master per @gAldeia's guidance in #203.

Qazi-pk added 9 commits June 17, 2026 16:39
Added metadata for the Physics Intermediate Representation (PIR) project, including authors, paper title, and description.
Implement PIRClassicRegressor and model function for SRBench.
Added metadata for the Physics Intermediate Representation (PIR) including authors, paper title, and description.
This file implements a classical PIR regressor for SRBench, including configuration and model handling.
@Qazi-pk

Qazi-pk commented Jun 18, 2026

Copy link
Copy Markdown
Contributor Author

12/44 EXACT blind (zero seed wobble), v3.4
Secondary: +12/44 FORM_NUMERIC (correct functional form, transcendental constant as decimal — reported separately, never summed)
Previous baseline: 7/44 (v3.3)

@Qazi-pk

Qazi-pk commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

Update: The install failure is resolved.

The physics-engine package had a packaging issue (subpackages weren't being discovered by setuptools) plus some eager top-level imports pulling in optional modules that aren't needed for the regressor. I've fixed the packaging config and made the top-level imports lazy, tagged v3.4.1, and updated install.sh to point at it. A clean-room install (pip install "git+https://github.com/Qazi-pk/physics-engine.git@v3.4.1" in a fresh venv) now imports PIRRegressor successfully.

The remaining ModuleNotFoundError: No module named 'methods.pir' looks like the shared algorithms/ → methods/ harness mapping that's also failing other methods in this run (brush, eql, bsr, e2et). Happy to adjust the layout if there's a preferred structure — otherwise it appears to be on the infrastructure side. Thanks for taking the time to review.

@Qazi-pk

Qazi-pk commented Jul 13, 2026

Copy link
Copy Markdown
Contributor Author

Update: the ModuleNotFoundError: No module named 'methods.pir' is resolved, and it was on my side.

Cause: my submission only had the regressor under algorithms/pir/, but the harness imports the module from experiment/methods/<name>/. That import path is exactly what the error was pointing at, and I misread it earlier as an infrastructure issue.

Fix:

  • Added experiment/methods/pir/ with __init__.py and regressor.py, mirroring the layout used by gplearn and operon. The module exposes est, model(), complexity(), and eval_kwargs.
  • Removed the duplicate algorithms/pir/regressor.py, so algorithms/pir/ now holds only install.sh, metadata.yml, and requirements.txt — matching the other methods.
  • Switched eval_kwargs from skip_tuning to test_params to match the master-branch evaluate_model() signature.

Docker CI / build-and-test (pir) is now passing. The remaining failures in this run appear to be in other methods and unrelated to this PR.

Thanks for your patience with the back and forth.

@lacava

lacava commented Jul 31, 2026

Copy link
Copy Markdown
Member

thanks for your patience. we finally fixed the other methods that were failing in docker on main. once the tests pass we'll perform our review and update you.

@Qazi-pk

Qazi-pk commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the update, and for fixing the Docker failures on main.

While benchmarking PIR locally through the ground-truth harness, I found and reported a separate bug — #216: -target_noise and -feature_noise are parsed but never passed to evaluate_model(), so target noise is silently ignored on --local runs (the cluster path is unaffected). It includes a two-line fix that worked for me. Happy to open a PR for it if useful — flagging here since it affects local noise-robustness runs.

Looking forward to the review.

lacava added a commit that referenced this pull request Aug 13, 2026
every push and PR rebuilds all 27 images, because the gate in build-and-test
is hardcoded to should_run=true (5b13029). check-changes already computes what
changed, but nothing consumes it. one method submission can cost a lot: #209
went through 16 full 27-image runs, #210 and #212 another 24 between them.

pull requests now build only the methods they touch. everything else - pushes
to master/dev, the new weekly schedule, manual dispatch - still rebuilds
everything, so a method that breaks from upstream drift without anyone
touching it still gets caught. that drift is calendar-driven, which is what
the schedule is for; during a quiet stretch there are no merges to catch it.

- a method rebuilds if either algorithms/<name>/ or experiment/methods/<name>/
  changed. the second one matters: a regressor.py edit has to retest the
  method even though the install is untouched.
- changes to shared build inputs (dockerfiles, base_environment, scripts,
  entry.sh, configure.sh, workflows) still rebuild everything.
- build-and-test always runs and always reports for every algorithm, so the
  check names stay present and can be marked required. only the docker build
  step is skipped.
- dropped always() from build-and-test. with the gate inside the job, a failed
  check-changes would have left an empty build list, skipped every build and
  reported green.
- check-changes no longer diffs against github.event.before, so a force-push
  to a CI branch no longer fails the job.

also fixes a long-standing bug: changed-experiments used awk field $2 on
experiment/methods/<name>/..., which is the literal string "methods", not the
method name. it needs $3. nothing consumed that output before, so it never
showed up.
lacava and others added 3 commits August 13, 2026 12:07
scripts/check_method_layout.py (added on master after this PR's branch
diverged) requires algorithms/<name>/metadata.yml to have top-level
name, authors, email, description, and url keys unless the method is
grandfathered. pir isn't in the grandfathered set, and the existing
email/url were only nested under authors[]/paper, not top-level -
causing the validate-layout check to fail.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants