assessment
Use Fairlearn assessment APIs for MetricFrame, group fairness metrics, bootstrapped confidence intervals, model comparison, and subgroup plots.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- assessment
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Use Fairlearn assessment APIs for MetricFrame, group fairness metrics, bootstrapped confidence intervals, model comparison, and subgroup plots.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/metricframe-workflows.md4.7 KB
- 参考文档references/plotting-and-confidence-intervals.md4.0 KB
- 参考文档references/troubleshooting.md2.5 KB
- 脚本scripts/smoke_assessment.py4.4 KB
03 SKILL.md 正文
Fairlearn assessment
Use this sub-skill when the task is about assessing model behavior across groups: MetricFrame, sensitive_features, group metrics, demographic parity/equalized odds metrics, intersections, control features, confidence intervals, plot_model_comparison, plot_roc_curve_by_group, or the experimental plot_metric_frame helper.
Quick workflow
- Align
y_true,y_predor scores, andsensitive_featuresrow-for-row. - Choose overall utility metrics and fairness-sensitive group metrics before mitigation.
- Build a
MetricFramewith a metric callable or a metric dictionary. - Inspect
overall,by_group,group_min(),group_max(),difference(), andratio(). - For uncertainty, set both
n_bootandci_quantiles; if either is set alone Fairlearn raises a bootstrap parameter error. - For plots, confirm matplotlib is installed, then use pandas plotting,
plot_roc_curve_by_group,plot_model_comparison, or the experimentalplot_metric_frameimport path.
Read these references
references/metricframe-workflows.mdforMetricFrameinputs/outputs, metric helpers, derived metrics, sample parameters, intersections, and persistence patterns.references/plotting-and-confidence-intervals.mdfor plotting helpers, headless plotting, ROC-by-group, model comparison, and bootstrap confidence intervals.references/troubleshooting.mdfor missing matplotlib, length mismatches, custom metric failures, bootstrap errors, and experimental plotting import issues.scripts/smoke_assessment.pyfor a tiny synthetic assessment and optional plot smoke check.
Core APIs to recognize
fairlearn.metrics.MetricFrame- Base metrics:
selection_rate,count,true_positive_rate,true_negative_rate,false_positive_rate,false_negative_rate,mean_prediction - Fairness metrics:
demographic_parity_difference,demographic_parity_ratio,equalized_odds_difference,equalized_odds_ratio,equal_opportunity_difference,equal_opportunity_ratio - Dynamic helpers:
make_derived_metric, generated<metric>_{difference,ratio,group_min,group_max}functions - Plots:
plot_model_comparison,plot_roc_curve_by_group, andplot_metric_framefromfairlearn.experimental.enable_metric_frame_plotting
Boundary rules
- This sub-skill owns assessment only. If the user asks how to change the model, route to preprocessing, reductions, postprocessing, or adversarial after summarizing the assessment target.
- This sub-skill can evaluate any sklearn-compatible model's predictions; it does not require Fairlearn mitigation algorithms.
- Dataset fetchers are owned by
../datasets/; use this sub-skill only after the data is loaded and predictions/scores are available. - Plot dependency diagnosis starts here for assessment plots, but package-wide install recovery lives in
../../references/troubleshooting.mdand../installation/.
Operating rules
- Always name the sensitive features and their intended grouping semantics in the report.
- Do not report a single fairness metric as a final fairness verdict. Include overall utility, subgroup metrics, and context limitations.
- Use
control_featureswhen comparing sensitive-feature disparities within slices such as model version, region, or time bucket. - For multiple sensitive features, prefer a pandas DataFrame with named columns so group/intersection labels are intelligible.
- For custom metrics that need
sample_weightor other side inputs, passsample_paramswith the same row alignment asy_trueandy_pred. - In headless environments set
MPLBACKEND=Aggor callmatplotlib.use("Agg")before plotting.
Fast validation
Run a no-network smoke check:
python sub-skills/assessment/scripts/smoke_assessment.py
Run plot coverage in a matplotlib-capable environment:
python sub-skills/assessment/scripts/smoke_assessment.py --plot --output-dir /tmp/fairlearn-assessment-plots
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).