metrics
Routes scikit-plot metric-curve requests for confusion matrices, ROC, precision-recall, KS, calibration, gain, lift, and silhouette plots.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- metrics
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Routes scikit-plot metric-curve requests for confusion matrices, ROC, precision-recall, KS, calibration, gain, lift, and silhouette plots.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/api-reference.md4.6 KB
- 参考文档references/troubleshooting.md3.1 KB
- 参考文档references/workflows.md3.3 KB
- 脚本scripts/metrics_smoke.py3.0 KB
03 SKILL.md 正文
Metrics
Use this sub-skill for the current scikitplot.metrics plotting functions. These functions consume labels, predictions, probabilities, scores, or cluster labels and return Matplotlib Axes objects.
Route here
- Confusion matrices:
plot_confusion_matrix. - Multiclass or binary ROC curves:
plot_roc; legacy code may still callplot_roc_curve. - Multiclass or binary precision-recall curves:
plot_precision_recall; legacy code may still callplot_precision_recall_curve. - Binary probability diagnostics:
plot_ks_statistic,plot_calibration_curve,plot_cumulative_gain,plot_lift_curve. - Silhouette analysis from
Xplus cluster labels:plot_silhouette. - Quick validation of the metric family:
scripts/metrics_smoke.py.
Inputs to check first
- For confusion matrices, provide
y_trueandy_predwith aligned sample order. - For ROC and precision-recall, pass a 2-D probability matrix shaped
(n_samples, n_classes). - For KS, cumulative gain, lift, and calibration, use binary targets unless the function explicitly supports multiclass.
- For silhouette, provide the feature matrix and one cluster label per sample.
- Pass
ax=when composing figures; every route should return the axes it drew on.
Common decisions
- Use
labels,true_labels, andpred_labelsto reorder or subset confusion-matrix axes. - Use
plot_micro,plot_macro, andclasses_to_ploton the current ROC/PR APIs instead of the oldercurvestuple where possible. - Use
n_binsfor calibration only after confirming enough binary samples per bin. - Keep probability columns in the same class order used by the fitted classifier.
- Set a non-interactive Matplotlib backend such as
Aggfor automation or smoke checks.
Reroute
- Feature importance or learning curves:
../estimators/SKILL.md. - Elbow-curve cluster sweeps:
../clustering/SKILL.md. - PCA variance or 2-D projection:
../decomposition/SKILL.md. - Factory-injected bound methods or deprecated
scikitplot.plotters:../legacy-factories/SKILL.md.
Read next
references/api-reference.mdfor verified signatures, input constraints, and deprecated aliases.references/workflows.mdfor concrete call patterns by plot family.references/troubleshooting.mdfor binary-only restrictions, shape errors, label validation, and compatibility failures.scripts/metrics_smoke.pyfor a tiny Agg-backed smoke run covering the main metric plot families.
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).