imbalanced-learn
Router for imbalanced-learn samplers, workflows, metrics, datasets, and balanced batch generators.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- imbalanced-learn
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Router for imbalanced-learn samplers, workflows, metrics, datasets, and balanced batch generators.
- disable-model-invocation
- true
02 资源文件 6
- 参考文档references/api-overview.md4.9 KB
- 参考文档references/repo-provenance.md978 B
- 参考文档references/repo-routing-metadata.json423 B
- 参考文档references/troubleshooting.md4.1 KB
- 脚本scripts/inspect_signatures.py2.6 KB
- 脚本scripts/package_smoke.py3.7 KB
03 SKILL.md 正文
imbalanced-learn
Use this repo skill for the imbalanced-learn package when the task is about
class imbalance, resampling, imbalance-aware pipelines, evaluation metrics, or
balanced mini-batches for Keras/TensorFlow.
The import root is imblearn. The package is scikit-learn compatible and is
centered on fit_resample workflows for tabular and scientific-python style
data.
Quick start
- If you need the package API, start with this router and then read the relevant sub-skill.
- If you need a fast sanity check, run
scripts/package_smoke.py. - If you need live API names or signatures from the installed environment, run
scripts/inspect_signatures.py.
Minimal import check
from imblearn import FunctionSampler
from imblearn.over_sampling import RandomOverSampler
If that import fails, read references/troubleshooting.md before assuming the
repo skill is stale.
How to choose a sub-skill
sampling-algorithms
Use this when the request mentions:
RandomOverSampler,SMOTE,ADASYN,SMOTENC,SMOTENRandomUnderSampler,TomekLinks,EditedNearestNeighbours,NearMissClusterCentroids,SMOTEENN,SMOTETomekFunctionSampler,sampling_strategy,check_sampling_strategy- sparse, pandas, heterogeneous, or categorical feature handling during resampling
Read sub-skills/sampling-algorithms/SKILL.md first.
model-workflows
Use this when the request mentions:
Pipelineormake_pipeline- leakage-safe resampling with classifiers
BalancedBaggingClassifier,BalancedRandomForestClassifierEasyEnsembleClassifier,RUSBoostClassifierInstanceHardnessCV
Read sub-skills/model-workflows/SKILL.md first.
evaluation-and-data
Use this when the request mentions:
make_imbalance,fetch_datasetsclassification_report_imbalanced,geometric_mean_score- sensitivity/specificity metrics, MA-MAE, or
ValueDifferenceMetric - data-leakage pitfalls and dataset-balancing examples
Read sub-skills/evaluation-and-data/SKILL.md first.
optional-batch-generators
Use this when the request mentions:
balanced_batch_generatorBalancedBatchGenerator- Keras or TensorFlow mini-batch workflows for imbalanced data
Read sub-skills/optional-batch-generators/SKILL.md first.
Cross-cutting rules
- Resample only the training split, not the entire dataset, when the user is trying to avoid leakage.
- Preserve sparse inputs as CSR-compatible workflows where possible, but know that many samplers return dense output.
- Treat pandas support as first-class when the user provides DataFrames.
- Treat TensorFlow/Keras support as optional: useful, but not required for the core CPU package.
- When a workflow needs the exact constructor or signature of a public class or
function, consult the nearest reference file or run
scripts/inspect_signatures.py.
Read these files when needed
references/api-overview.mdfor the compact module and symbol map.references/troubleshooting.mdfor install, import, dtype, sparse, leakage, network, and optional-backend issues.references/repo-provenance.mdfor the source snapshot that produced this skill.references/repo-routing-metadata.jsonfor managed-router placement data.
Root scripts
scripts/package_smoke.pyfor a small end-to-end CPU and optional-backend smoke check.scripts/inspect_signatures.pyfor live API introspection from the installed environment.
What this skill does not do
- It does not replace the sub-skill-level workflow guides.
- It does not ask you to run the original repository examples as runtime skill instructions.
- It does not claim GPU-specific functionality; the package is CPU-oriented, with optional TensorFlow/Keras dependencies.
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).