PyPhysDisc: Autonomous Discovery of Physical Laws from Noisy Data via Co-evolutionary Symbolic Regression and Smoothing
Description
This repository contains the complete source code, simulation datasets, and analysis scripts required to reproduce the findings presented in the associated manuscript. The study introduces PyPhysDisc, a co-evolutionary framework that couples the evolution of mathematical model structures with the autonomous optimization of data preprocessing parameters (smoothing window size), addressing the "derivative-noise dilemma" in symbolic regression.
Repository Contents:
-
code/pyphysdisc_core.py: The core library implementing the co-evolutionary algorithm. It integrates Genetic Programming (via DEAP) with an adaptive Savitzky-Golay filter gene, treating the smoothing window ($w$) as an evolvable trait. -
code/experiment_runner.py: The master execution script that reproduces all experiments presented in the paper via an interactive menu:-
Experiment 1: Noise Robustness Sweep (Lorenz, Lotka-Volterra, SIR, Duffing).
-
Experiment 2: Ablation Study (Comparison of Fixed Window vs. Co-Evolution).
-
Experiment 3: Convergence Analysis (Impact of the
squareoperator). -
Experiment 4: Computational Scaling Tests.
-
-
code/plotting_utils.py: Plotting scripts to reproduce high-resolution publication figures (Figures 1–4 and Supplementary Figures S1–S7) following CPC style guidelines. -
data/: Folder containing the raw.csvoutputs from the experiments (e.g.,exp_01_results.csv,benchmark_vanderpol.csv), allowing for the reproduction of figures without re-running computationally intensive evolutionary searches. -
requirements.txt: List of Python dependencies (DEAP, NumPy, SciPy, Pandas, etc.) required to run the code. -
README.md: Detailed instructions on installation, usage, and citation.
Methodology Highlights:
-
Benchmark Systems: Lorenz Attractor (Chaotic), Lotka-Volterra (Periodic), SIR Model (Asymptotic/Slow), Duffing Oscillator (Stiff/Nonlinear), and Spinning Pendulum.
-
Technique: Co-evolutionary Symbolic Regression. Unlike standard methods (e.g., SINDy) that require manual preprocessing, PyPhysDisc simultaneously evolves the symbolic equation tree and the smoothing parameters ($w$) to find the Pareto-optimal balance between noise suppression and feature preservation.
-
Key Results:
-
Autonomous Adaptation: The algorithm correctly identifies system-specific time scales (e.g., selecting $w \approx 17$ for Lorenz to preserve chaos, and $w=51$ for SIR to suppress noise).
-
Noise Robustness: Maintains high accuracy ($R^2 > 0.90$) up to 20% noise levels, where fixed-window benchmarks fail.
-
Generality: Successfully recovers non-polynomial laws (e.g., $\sin(\theta)$ in the Spinning Pendulum) without predefined library assumptions.
-
Usage:
To reproduce the full suite of experiments:
-
Install dependencies:
pip install -r requirements.txt -
Run the master script:
python code/experiment_runner.py -
Select the desired experiment from the menu.
Files
benchmark_accuracy.csv
Files
(99.3 kB)
| Name | Size | Download all |
|---|---|---|
|
md5:42d1f35d34e5963e5e32d10f2f3cb2b3
|
12.4 kB | Download |
|
md5:453b90251f85712a8a6ae78157866e05
|
1.8 kB | Preview Download |
|
md5:ac1b729a5a40986b44d212d5bfb5c3df
|
4.9 kB | Download |
|
md5:7c959122e278ff1bb1ec6c2127e4eb93
|
11.2 kB | Download |
|
md5:a2c7a7867f268f87ca7ad907d586d414
|
258 Bytes | Preview Download |
|
md5:80bcfcffbe8a9e7c00bd38881d712c5e
|
3.1 kB | Preview Download |
|
md5:949a718386500792bbce7368f0d9718f
|
5.9 kB | Preview Download |
|
md5:949a718386500792bbce7368f0d9718f
|
5.9 kB | Preview Download |
|
md5:02c99ab3fc3b7930499deedb64a9014e
|
2.0 kB | Preview Download |
|
md5:340abb6cd1b99acf425812db80c58d0c
|
27.6 kB | Preview Download |
|
md5:e9f15a2cfabb817db8f694a1f9388679
|
487 Bytes | Preview Download |
|
md5:99b573739bc0d1fb35907340e744cbd8
|
485 Bytes | Preview Download |
|
md5:6d1a67301b3a0624795e232a00ab0e1f
|
17.4 kB | Download |
|
md5:523e4d1e302358ae204733e767ff44ff
|
4.5 kB | Download |
|
md5:90fe3927fc2d18e295e5dd43863074ad
|
1.1 kB | Preview Download |
|
md5:515a910d1638b7be7a68b586ac6253ed
|
61 Bytes | Preview Download |