pysr
Use PySR for symbolic regression, interpretable equation discovery, equation export, runtime scaling, and PySR troubleshooting.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- pysr
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Use PySR for symbolic regression, interpretable equation discovery, equation export, runtime scaling, and PySR troubleshooting.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/api-index.md2.2 KB
- 参考文档references/repo-provenance.md1.9 KB
- 参考文档references/repo-routing-metadata.json328 B
- 参考文档references/troubleshooting.md3.0 KB
- 脚本scripts/check_pysr_environment.py3.6 KB
03 SKILL.md 正文
PySR repo skill
Use this skill when a task involves PySR, SymbolicRegression.jl from Python, symbolic regression, interpretable equation discovery from numeric data, scaling-law or formula search, or troubleshooting PySR installation/search/export behavior.
PySR exposes a scikit-learn-style PySRRegressor front end backed by Julia's SymbolicRegression.jl. It returns a Pareto front of equations that trade loss against complexity. Treat PySR as a stochastic search tool: validate data and operators first, run bounded smoke fits, inspect the full Pareto front, then run longer searches only after the setup is sensible.
Install and import check
For ordinary use:
pip install pysr
# or
conda install -c conda-forge pysr
Minimal check:
import pysr
from pysr import PySRRegressor
print(pysr.__version__)
A fresh import pysr can download/resolve Julia packages and the first fit can compile Julia code. Do not misdiagnose that first-run setup cost as a failed search. For runtime/startup details, read sub-skills/runtime-and-scaling/SKILL.md.
Route map
| Task | Read |
|---|---|
Fit ordinary tabular data, choose operators, inspect model.equations_, select equations, debug trivial/slow searches |
sub-skills/fit-and-diagnose/SKILL.md |
| Define custom Julia operators, losses, full objectives, units, constraints, complexity rules, mutations, or plugins | sub-skills/customization-and-constraints/SKILL.md |
Use known expression skeletons, TemplateExpressionSpec, category parameters, shared/vector-valued templates, differential operators, or guesses |
sub-skills/structured-expressions/SKILL.md |
| Export equations to SymPy/LaTeX/NumPy/JAX/PyTorch, inspect hall-of-fame CSVs, reload checkpoints, or configure TensorBoard logging | sub-skills/export-and-artifacts/SKILL.md |
| Install, import, manage JuliaCall, choose threads/processes/Slurm, bound long runs, use CLI tests, or diagnose startup/runtime failures | sub-skills/runtime-and-scaling/SKILL.md |
Fast operating pattern
- Start with data and objective. Confirm
Xhas shape(n_samples, n_features)andyis one-dimensional for one target or two-dimensional for multi-output. Decide whether weights, feature names, units, or denoising are needed. - Choose a small search space. Keep operators minimal. Every unnecessary operator expands the evolutionary search; add custom operators/losses only when domain evidence justifies them.
- Bound first runs. Use low
niterations,timeout_in_seconds,max_evals, andinput_stream="devnull"in scripts/noninteractive contexts. - Inspect the Pareto front.
model.equations_is the primary result. Compare loss and complexity, and passindex=topredict,sympy, orlatexwhen you want a specific row rather than the default selection. - Escalate deliberately. For known structure use templates; for domain rules use finite penalties, constraints, units, or custom objectives; for large jobs use batching or Slurm after the simple case works.
- Persist durable artifacts. Save the construction code and hall-of-fame CSV. Pickle checkpoints are useful but version-sensitive.
Shared references and scripts
references/api-index.mdmaps common public APIs to the owning sub-skill.references/troubleshooting.mdcovers cross-cutting failures and points to the nearest owner.references/repo-provenance.mdrecords the source snapshot used to create this skill.references/repo-routing-metadata.jsoncontains structured routing metadata for managed repo-skill import.scripts/check_pysr_environment.pyperforms a safe package/CLI/API probe without fitting a model by default.
Boundaries
This skill is for using PySR as a package. It does not replace SymbolicRegression.jl's Julia-native documentation for deep backend development, and it does not claim optional JAX, PyTorch, TensorBoard, Slurm, or autodiff backends are installed unless the current environment is checked.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).