model-workflows
Router for imbalanced-learn pipelines, leakage-safe resampling, balanced ensembles, and instance-hardness cross-validation.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- model-workflows
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Router for imbalanced-learn pipelines, leakage-safe resampling, balanced ensembles, and instance-hardness cross-validation.
- disable-model-invocation
- true
02 资源文件 6
- 参考文档references/api-reference.md2.1 KB
- 参考文档references/troubleshooting.md1.4 KB
- 参考文档references/workflows.md1.7 KB
- 脚本scripts/ensemble_smoke.py1.4 KB
- 脚本scripts/model_selection_smoke.py905 B
- 脚本scripts/pipeline_leakage_check.py1.1 KB
03 SKILL.md 正文
model-workflows
Use this sub-skill when the request is about building a model workflow around imbalanced-learn samplers.
This sub-skill owns the package surfaces that combine resampling with model training and validation:
Pipelineandmake_pipelineBalancedBaggingClassifierBalancedRandomForestClassifierEasyEnsembleClassifierRUSBoostClassifierInstanceHardnessCV
What to do first
- Decide whether the user wants a pipeline, an ensemble, or a specialized cross-validation splitter.
- Split the data first and keep resampling on the training side.
- Check whether the final estimator supports
fit,predict, and optionallypredict_probaif the workflow usesInstanceHardnessCV. - If the workflow chains transforms and samplers, remember that imbalanced-learn
pipeline semantics differ from plain scikit-learn in
fit_transform. - Verify the assembled workflow on a tiny synthetic dataset before scaling up.
Typical routing cues
fit_resampleinsidePipeline- leakage-safe cross-validation
BalancedBaggingClassifier,BalancedRandomForestClassifierEasyEnsembleClassifier,RUSBoostClassifierInstanceHardnessCVtransform_input,memory,sample_weight
When to read the bundled references
references/workflows.mdfor safe pipeline patterns and decision points.references/api-reference.mdfor the compact workflow API catalog.references/troubleshooting.mdwhen cross-validation, metadata routing, or estimator compatibility fails.
Common choices
- Use
Pipelineormake_pipelinewhen the main goal is to avoid leakage and let resampling happen only during fit. - Use
BalancedBaggingClassifierwhen a bagging-style ensemble should resample each bootstrap subset. - Use
BalancedRandomForestClassifierwhen the user wants a random-forest-like ensemble with balanced bootstrap samples. - Use
EasyEnsembleClassifierwhen the task wants an AdaBoost-based ensemble on balanced subsets. - Use
RUSBoostClassifierwhen the task wants boosting with under-sampling between iterations. - Use
InstanceHardnessCVwhen the task is binary classification and the user wants hard samples distributed across folds.
Native evidence to keep in mind
These repo tests are the most relevant later verification anchors for this sub-skill:
imblearn/tests/test_pipeline.py::test_make_pipelineimblearn/tests/test_pipeline.py::test_pipeline_methods_pca_svmimblearn/ensemble/tests/test_bagging.py::test_balanced_bagging_classifierimblearn/ensemble/tests/test_forest.py::test_balanced_random_forestimblearn/ensemble/tests/test_easy_ensemble.py::test_easy_ensemble_classifierimblearn/ensemble/tests/test_weight_boosting.py::test_rusboostimblearn/model_selection/tests/test_split.py::test_default_params
Package-specific cautions
Pipeline.fit_transform(X, y)can resample, whilefit(X, y)followed bytransform(X)does not. Do not assume scikit-learn equivalence.InstanceHardnessCVonly supports binary classification and needs an estimator withpredict_proba.- Some ensembles accept
sampler/sampling_strategy/replacementparameters that change the internal balancing behavior; inspect the exact constructor. sample_weightsupport depends on the specific estimator.
Use the scripts
scripts/pipeline_leakage_check.pyfor a tiny leakage-safe pipeline smoke.scripts/ensemble_smoke.pyfor a representative balanced-ensemble check.scripts/model_selection_smoke.pyfor anInstanceHardnessCVsanity check.
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).