AGENT SKILL

sr

Single-dataset symbolic regression with PhySO SR, including units, weights, presets, logging, and Pareto inspection.

License 许可
MIT
最近更新
2026-09-03
Stars
★ 351
Forks
27

01 前言 Front Matter

name
sr
license
MIT
metadata
{ "disco-role": "operating" }
read_when
Use when the user has one X/y dataset and wants physo.SR guidance, dimensional-analysis units, y_weights, candidate_wrapper, config0/config0b, CPU/parallel notes, logs, or a safe quick-start smoke.
description
Single-dataset symbolic regression with PhySO SR, including units, weights, presets, logging, and Pareto inspection.
disable-model-invocation
true

02 资源文件 4

03 SKILL.md 正文

PhySO SR Sub-skill

Role

Use this sub-skill to help a Researcher run single-dataset symbolic regression with physo.SR. It covers preparing one X, y dataset, optional point weights, dimensional-analysis units, free/fixed constants, operator choices, light run configurations, logging, and result/Pareto-front inspection. For root routing across all PhySO sub-skills, see the parent skill at ../../SKILL.md.

Boundaries

Included:

  • One dataset with X shaped (n_dim, n_samples) and y shaped (n_samples,).
  • X_names, X_units, y_name, y_units, fixed constants, and SR free constants.
  • y_weights as either one scalar or one per-sample vector aligned with y.
  • candidate_wrapper, op_names, use_protected_ops, config0/config0b selection, epochs, stop_reward, max_n_evaluations, logging, and CPU-safe execution.
  • Handoff to Pareto/log inspection helpers after a run.

Excluded:

  • Multi-dataset physo.ClassSR, class free constants, and realization-specific free constants; use sibling class-sr when the user has multiple datasets or class/spe constants.
  • Benchmark-problem definitions or maintainer benchmark runners; use sibling benchmarks for packaged Feynman/Class benchmark loaders.
  • Low-level expression/library construction and random-expression sampling; use sibling toolkit for those APIs.
  • Generic PyTorch or scikit-learn regression advice outside the PhySO SR workflow.

Verified entry points

  • physo.SR(X, y, y_weights=1.0, X_names=None, X_units=None, y_name=None, y_units=None, fixed_consts=None, fixed_consts_units=None, free_consts_names=None, free_consts_units=None, free_consts_init_val=None, op_names=None, use_protected_ops=True, stop_reward=1.0, max_n_evaluations=None, stop_after_n_epochs=10, epochs=None, candidate_wrapper=None, run_config=None, get_run_logger=None, get_run_visualiser=None, parallel_mode=True, n_cpus=None, device="cpu")
  • physo.config.config0.config0 and physo.config.config0b.config0b for light SR presets.
  • physo.learn.monitoring.RunLogger and physo.learn.monitoring.RunVisualiser for logs and optional plots.
  • logs.get_pareto_front() from the returned logger.
  • physo.read_pareto_pkl, physo.read_pareto_csv, and physo.load_expr for saved-result inspection.

Operating workflow

  1. Route first. Stay here for one X, y dataset. If the request mentions several realizations, shared formula across datasets, class constants, or per-dataset constants, route to class-sr.
  2. Prepare numeric inputs. Convert tabular data to floating arrays, then transpose feature matrices so X.shape == (n_dim, n_samples) and y.shape == (n_samples,). Keep y_weights either a scalar or a per-sample float array with the same shape as y.
  3. Define units and constants. If dimensional analysis matters, give every variable and constant a consistent units vector of length up to seven; otherwise omit units or use zero vectors. SR free constants are single-dataset/class-style constants only.
  4. Choose operators and wrappers. Start with the default operator set unless the task needs a narrow grammar. Keep candidate_wrapper callable, top-level if multiprocessing is used, differentiable, and implemented with torch operations when free constants are optimized.
  5. Choose a preset. Use config0 for demos and short smokes. Use config0b when a quick SR task has free constants and you want more LBFGS constant-optimization steps without moving to heavier presets. Deep-copy presets before editing.
  6. Run safely. For notebooks, debugging, and the verified CPU smoke path, set parallel_mode=False, n_cpus=1, and device="cpu". This skill does not verify CUDA behavior.
  7. Inspect results. Treat the returned expression as the current best Program; use logs.get_pareto_front() for the complexity/reward/RMSE front, and saved Pareto pkl/csv helpers for later inspection.
  8. Recover from failures. Use references/troubleshooting.md before changing algorithms; most SR failures are shape, units, weights, wrapper, preset-mutation, or optional-display issues.

Input and output contract

Inputs expected by this sub-skill:

  • X: float NumPy array or torch tensor convertible to shape (n_dim, n_samples).
  • y: float vector convertible to shape (n_samples,) with no NaNs.
  • Optional y_weights: scalar, or float vector with the same sample length as y.
  • Optional units: X_units length equals n_dim; y_units, fixed_consts_units, and free_consts_units use the same convention and vector length up to seven.
  • Optional grammar/config: op_names, use_protected_ops, a deep-copied run_config, and a torch-compatible candidate_wrapper.

Outputs returned by physo.SR:

  • expression: a physo.physym.program.Program for the best expression found so far.
  • logs: a RunLogger with histories and get_pareto_front() returning (complexities, programs, rewards, rmse).
  • Optional saved artifacts if the logger/visualiser are configured to save: run CSV logs, Pareto CSV, Pareto pkl, and plots.

Bundled references and helper

Related native tests and examples

Native candidates for later verification of this route:

  • physo.task.tests.sr_UnitTest: deterministic physo.SR calls, including the canonical energy-style quick-start and a reduced-operator case that tolerates prior warnings.
  • physo.physym.tests.execute_UnitTest: lower-level expression execution on CPU/CUDA-capable hosts; use only as execution evidence here, not as CUDA proof.
  • physo.physym.tests.program_display_UnitTest: string, SymPy, LaTeX, and optional tree-display behavior; display extras can fail gracefully.
  • physo.learn.tests.monitoring_UnitTest: SR logging, Pareto-front collection, and cleanup behavior.

Source examples distilled into this sub-skill:

  • The bundled smoke helper adapts the canonical SR quick-start into a tiny CPU-only installed-package check.
  • The y-weights demo material is distilled into the weighted-data workflow reference rather than copied as a runnable notebook.
  • The damped harmonic oscillator demo is useful as a longer, dimensioned SR reference, but its long run settings are not bundled as a smoke helper.
  • Feynman benchmark runners and job-file generators are maintainer/reference material, not SR runtime helpers; use benchmark-focused siblings for packaged benchmark problem loaders.

04 同仓库更多 Skills

VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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).

★ 351