Skip to content

vanderschaarlab/IGSR

 
 

Repository files navigation

IGSR: Influence-Guided Symbolic Regression

IGSR discovers interpretable closed-form models of the form f(x) = Σ_j w_j · ψ_j(x): a large language model proposes candidate nonlinear basis functions ψ_j, and per-term influence scores Δ_j -- the increase in validation error when term j is removed -- drive a propose-and-prune search wrapped in Monte-Carlo Tree Search (MCTS). The result is a sparse, data-driven linear combination of interpretable terms, fit with ordinary least squares.

Paper: arXiv:2605.29184

IGSR overview

Installation

Tested with Python 3.10 and conda. Clone the repository first:

git clone <REPO_URL>
cd igsr

1. Core install (IGSR only)

The minimal install -- enough to run the IGSR method itself:

conda create -n py310_igsr python=3.10 -y
conda activate py310_igsr
pip install -e .                 # add dev tools (pytest, ruff) with:  pip install -e ".[dev]"

2. Full install (all datasets + main-env baselines)

Adds the remaining datasets (e.g. the COVID/Covasim simulation) and the baselines that share the core environment (GPLearn, SINDy, DyNODE, RNN, Transformer, XGBoost):

pip install -e ".[dev,benchmarks]"

# Optional GPU build of PyTorch. [benchmarks] pins torch==2.6.0 (the default CPU wheel); this swaps it
# for the matching CUDA wheel (same version, so re-install is forced). Use whichever CUDA you have.
pip install torch==2.6.0 --index-url https://download.pytorch.org/whl/cu126 --force-reinstall
pip install nvidia-ml-py         # GPU auto-selection by utilization

The LLM-SRBench dataset is downloaded from HuggingFace and needs a read token:

echo "YOUR_HF_TOKEN" >> ~/.cache/huggingface/token

3. LLM credentials

The LLM configs read each model's deployment / endpoint / key from environment variables, loaded from a .env file at the repository root. Copy the template and fill in the model(s) you plan to use:

cp .env.example .env
# then edit .env -- e.g. the IGSR_AZURE_OPENAI_GPT4O_* vars for Azure OpenAI,
# or IGSR_OPENAI_GPT4O_KEY for the OpenAI API.

4. Own-environment baselines (LLM-SR, ICSR, LaSR / PySR)

These baselines have special or conflicting dependencies, so each lives in its own conda environment cloned from the core one. PySR shares the LaSR environment: the pysr module used by the PySR baseline is the one installed by LaSR (the vendored LibraryAugmentedSymbolicRegression package installs itself as pysr), not the upstream PyPI PySR -- so once the LaSR env is built below, the PySR baseline runs there too.

LLM-SR

conda create -n py310_igsr_llmsr --clone py310_igsr -y
conda activate py310_igsr_llmsr
pip install -r ./src/igsr/method/llmsr/requirements_llmsr.txt

ICSR

conda create -n py310_igsr_icsr --clone py310_igsr -y
conda activate py310_igsr_icsr
pip install -r ./src/igsr/method/icsr/requirements_simplified.txt

LaSR (Julia-backed -- version-sensitive)

# Requires: Python 3.10, Julia 1.11.6, OpenSSL 3.4.0, juliacall==0.9.20, juliapkg==0.1.17.
# Mismatched versions can cause Julia build failures or runtime segfaults.

# Rewrites the hard-coded absolute paths in the vendored .jl project to match your machine:
bash src/igsr/method/LibraryAugmentedSymbolicRegression.jl/replacer.sh

conda create -n py310_igsr_lasr --clone py310_igsr -y
conda activate py310_igsr_lasr
conda install openssl=3.4.0 -c conda-forge -y
pip install -e ./src/igsr/method/LibraryAugmentedSymbolicRegression.jl
python ./src/igsr/method/LibraryAugmentedSymbolicRegression.jl/trigger_install.py   # installs the Julia toolchain

Running

The entry point is experiments/igsr/run.py (configured with Hydra). Choose the method, dataset, and LLM via config overrides; per-run artifacts are written under outputs/:

conda activate py310_igsr
python experiments/igsr/run.py experiment=igsr dataset=cancer llm=azure_gpt4o experiment.n_seeds=1

Configs live in experiments/igsr/conf/{experiment,dataset,llm}/. Baselines are selected the same way, e.g. experiment=gplearn (core env) or experiment=llmsr (run from its own env, py310_igsr_llmsr).

About

Code for Paper "Influence-Guided Symbolic Regression: Scientific Discovery via LLM-Driven Equation Search with Granular Feedback"

Resources

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages