技能创建器
skill-creator
创建、改进和评估自定义技能,把专业流程转化为可重复使用的 AI 能力。
class-sr【数据与研究】Multi-dataset class symbolic regression with shared and realization-specific free constants.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this sub-skill when the user has multiple realizations of the same phenomenon and wants one shared symbolic form with:
spe_free_consts)If the user has only one dataset, route to the sibling sr sub-skill instead.
If the user mainly needs expression-tree or constant-table manipulation, hand off to the sibling toolkit sub-skill.
physo.ClassSRmulti_X, multi_y, multi_y_weightsclass_free_consts_* and spe_free_consts_*config0b, config1b, config2b)physo.SRphyso.ClassSRphyso.config.config0b.config0bphyso.config.config1b.config1bphyso.config.config2b.config2bphyso.read_pareto_pklphyso.load_exprrun_logger.get_pareto_front()best_expr.free_consts.class_valuesbest_expr.free_consts.spe_valuesbest_expr.get_infix_sympy(evaluate_consts=True)multi_X and multi_y as lists with one element per realization.
X_i must have shape (n_dim, n_samples_i).y_i must have shape (n_samples_i,).multi_y_weights when you need to bias one realization or one region of a realization.class_free_consts_* are shared across realizations.spe_free_consts_* may vary by realization.config0b: quick smoke / demosconfig1b: dimensional-analysis-heavy ClassSR and Milky Way streamsconfig2b: class benchmark style runsb variants for ClassSR because they give more free-constant optimization stepsphyso.ClassSR(...) on CPU for a smoke test, or on the target device if the environment is already verified.best_expr.get_infix_pretty(), run_logger.get_pareto_front(), and best_expr.free_consts.toolkit sub-skill instead of expanding this one.multi_X: list-like of length n_realizations; each item is array-like with shape (n_dim, n_samples_i).multi_y: list-like of length n_realizations; each item is array-like with shape (n_samples_i,).multi_y_weights: one of
n_realizations containing one scalar per realizationn_realizations containing one weight array per realization with shape (n_samples_i,)class_free_consts_names / class_free_consts_units / class_free_consts_init_val: same length, one entry per shared constant.
ClassSR wrapper, pass init values in name order as a list/array-like container.spe_free_consts_names / spe_free_consts_units / spe_free_consts_init_val: same length, one entry per realization-specific constant.
ClassSR wrapper, pass init values in name order as a list/array-like container.spe_free_consts_init_val may use a scalar or a length-n_realizations vector per constant.best_expression: physo.physym.program.Programrun_logger: logger object with Pareto-front accessbest_expression.free_consts.class_values: shape (1, n_class_free_consts)best_expression.free_consts.spe_values: shape (1, n_spe_free_consts, n_realizations)best_expression.get_infix_sympy(evaluate_consts=True): array with one expression per realizationUse the bundled smoke helper for a CPU-safe sanity check:
python skills/disco/physo/sub-skills/class-sr/scripts/smoke_class_sr_quick_start.py
The helper uses tiny deterministic data, short epochs, CPU execution, and temporary log files.
physo, torch, numpy, sympy, pandas, matplotlib, scikit-learn.X_i / y_i pair must match.multi_y_weights length does not match multi_y, or any per-point weight array has the wrong length, fix the list shape first.spe_free_consts_init_val is a vector, its length must match n_realizations.parallel_mode or CUDA behavior is unclear, keep the smoke run on device='cpu' with parallel_mode=False.get_infix_pretty() or get_infix_sympy(); pretty LaTeX rendering is optional.run_logger.get_pareto_front() first and then physo.read_pareto_pkl(...) on the saved _pareto.pkl file.physo/task/tests/class_sr_UnitTest.py — canonical ClassSR task checkphyso/physym/tests/free_const_UnitTest.py — class/spe constant table behaviorphyso/physym/tests/dataset_UnitTest.py — realization and weight-shape validationphyso/benchmark/ClassDataset/tests/ClassProblem_UnitTest.py — benchmark-shaped multi-dataset loadingdemos/class_sr_quick_start.py — source quick-start recipe adapted by the smoke scriptdemos/class_sr/demo_free_fall/demo_free_fall.py — reference ClassSR example with class and spe constantsdemos/class_sr/demo_milky_way_streams/MW_streams_run.py — reference-only, longer benchmark-style runphyso skill for package-level routing and shared troubleshootingtoolkit skill for program inspection, constant-table work, and log loadingbenchmarks skill for benchmark problem loaders and symbolic comparison