sklearn-tuning
Routes KerasTuner SklearnTuner workflows for conditional scikit-learn estimator factories, cross-validation, scoring, groups, sample weights, DataFrame inputs, and pickle-backed model recovery.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- sklearn-tuning
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Routes KerasTuner SklearnTuner workflows for conditional scikit-learn estimator factories, cross-validation, scoring, groups, sample weights, DataFrame inputs, and pickle-backed model recovery.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/api-reference.md4.7 KB
- 参考文档references/troubleshooting.md4.4 KB
- 参考文档references/workflows.md4.8 KB
- 脚本scripts/smoke_sklearn.py4.8 KB
03 SKILL.md 正文
Scikit-learn tuning
Use this sub-skill when the task is about keras_tuner.SklearnTuner, tuning a
scikit-learn estimator factory, cross-validating several estimator families, or
restoring a tuned estimator from a KerasTuner trial. This route is for
scikit-learn models, not Keras neural-network training.
Include here
SklearnTuner(oracle, hypermodel, scoring=None, metrics=None, cv=None, **kwargs).- Conditional
HyperParametersfactories that return classifiers, regressors, or scikit-learnPipelineobjects. - A consistent explicit scorer when model families have different default
scoresemantics. - Custom cross-validation splitters,
groups, andsample_weight. - NumPy and optional pandas DataFrame inputs.
get_best_models()/load_model()recovery ofmodel.pickleartifacts.- Diagnosing invalid input types and absent optional dependencies.
Exclude or route elsewhere
- Keras model training, neural-specific callbacks, and epoch-budget search → the parent tuning route.
- Distributed chief/worker coordination → the distributed-tuning route.
- Image hypermodel constructors → the image-hypermodels route.
Hyperband: it is a neural-training oracle and is not an appropriate Oracle forSklearnTuner.
Fast route
- Confirm scikit-learn is installed; install pandas too if DataFrames are required.
- Build one estimator per trial from
hp, using conditional scopes for branch-specific hyperparameters. - Create a non-neural Oracle with objective
keras_tuner.Objective("score", "max"); Bayesian optimization is a good default for a small space. - Supply an explicit
scoringcallable when comparing model families, then selectcvand passgroupswhen the splitter requires them. - Call
search(X, y, sample_weight=..., groups=...)with NumPy arrays or pandas DataFrames and inspect trial status/metrics. - Restore the winner with
get_best_models()and validate it on held-out data. See workflows.
Read next
- API reference for exact signatures and implementation-backed behavior.
- Workflows for factory, scoring, CV, weighting, DataFrame, and restore patterns.
- Troubleshooting for dependency and input failures.
- From the skill root, run
sub-skills/sklearn-tuning/scripts/smoke_sklearn.pyfor a tiny dependency-aware local check.
Operating cautions
cv=NonemeansKFold(5, shuffle=True, random_state=1).sample_weightis split per fold. It is passed to an estimator'sfitonly whenfitadvertisessample_weight; it is omitted for a scikit-learnPipelineand estimators without that argument.- The tuner saves only the model produced by the final CV fold for each trial, although the trial score is the mean over folds. Treat it as the refit model only after checking the intended deployment workflow.
- DataFrame support depends on pandas being importable when the tuner module is
loaded. Plain lists are not accepted as
Xory.
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).