AGENT SKILL

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

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:

  • Pipeline and make_pipeline
  • BalancedBaggingClassifier
  • BalancedRandomForestClassifier
  • EasyEnsembleClassifier
  • RUSBoostClassifier
  • InstanceHardnessCV

What to do first

  1. Decide whether the user wants a pipeline, an ensemble, or a specialized cross-validation splitter.
  2. Split the data first and keep resampling on the training side.
  3. Check whether the final estimator supports fit, predict, and optionally predict_proba if the workflow uses InstanceHardnessCV.
  4. If the workflow chains transforms and samplers, remember that imbalanced-learn pipeline semantics differ from plain scikit-learn in fit_transform.
  5. Verify the assembled workflow on a tiny synthetic dataset before scaling up.

Typical routing cues

  • fit_resample inside Pipeline
  • leakage-safe cross-validation
  • BalancedBaggingClassifier, BalancedRandomForestClassifier
  • EasyEnsembleClassifier, RUSBoostClassifier
  • InstanceHardnessCV
  • transform_input, memory, sample_weight

When to read the bundled references

  • references/workflows.md for safe pipeline patterns and decision points.
  • references/api-reference.md for the compact workflow API catalog.
  • references/troubleshooting.md when cross-validation, metadata routing, or estimator compatibility fails.

Common choices

  • Use Pipeline or make_pipeline when the main goal is to avoid leakage and let resampling happen only during fit.
  • Use BalancedBaggingClassifier when a bagging-style ensemble should resample each bootstrap subset.
  • Use BalancedRandomForestClassifier when the user wants a random-forest-like ensemble with balanced bootstrap samples.
  • Use EasyEnsembleClassifier when the task wants an AdaBoost-based ensemble on balanced subsets.
  • Use RUSBoostClassifier when the task wants boosting with under-sampling between iterations.
  • Use InstanceHardnessCV when 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_pipeline
  • imblearn/tests/test_pipeline.py::test_pipeline_methods_pca_svm
  • imblearn/ensemble/tests/test_bagging.py::test_balanced_bagging_classifier
  • imblearn/ensemble/tests/test_forest.py::test_balanced_random_forest
  • imblearn/ensemble/tests/test_easy_ensemble.py::test_easy_ensemble_classifier
  • imblearn/ensemble/tests/test_weight_boosting.py::test_rusboost
  • imblearn/model_selection/tests/test_split.py::test_default_params

Package-specific cautions

  • Pipeline.fit_transform(X, y) can resample, while fit(X, y) followed by transform(X) does not. Do not assume scikit-learn equivalence.
  • InstanceHardnessCV only supports binary classification and needs an estimator with predict_proba.
  • Some ensembles accept sampler/sampling_strategy/replacement parameters that change the internal balancing behavior; inspect the exact constructor.
  • sample_weight support depends on the specific estimator.

Use the scripts

  • scripts/pipeline_leakage_check.py for a tiny leakage-safe pipeline smoke.
  • scripts/ensemble_smoke.py for a representative balanced-ensemble check.
  • scripts/model_selection_smoke.py for an InstanceHardnessCV sanity check.

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