AGENT SKILL

ksd_bootstrap_gof

Calibrate a KSD U-statistic goodness-of-fit test with the centered multinomial bootstrap for degenerate U-statistics.

License 许可
Apache-2.0
最近更新
2026-09-03
Stars
★ 351
Forks
27

01 前言 Front Matter

name
ksd_bootstrap_gof
description
Calibrate a KSD U-statistic goodness-of-fit test with the centered multinomial bootstrap for degenerate U-statistics.

02 资源文件 2

03 SKILL.md 正文

KSD Bootstrap Goodness-of-fit Test

Use this skill when you already have a pairwise Stein kernel matrix and need the paper's KSD-U goodness-of-fit decision. The skill implements Algorithm 1's centered multinomial bootstrap, which is designed for the degenerate U-statistic null distribution.

Do not use this skill for ordinary non-degenerate bootstrap tests, V-statistic-only diagnostics, or linear-time KSD calibration.

Inputs

  • stein_matrix: finite square matrix U where U[i,j] = u_q(x_i, x_j).
  • alpha: significance level, usually 0.05.
  • num_bootstrap: bounded number of bootstrap replicates.
  • seed: integer random seed for reproducibility.

Outputs

  • ksd_u: unbiased KSD U-statistic.
  • scaled_observed: n * ksd_u.
  • bootstrap_scaled: bootstrap null samples.
  • p_value: fraction of bootstrap statistics greater than the observed statistic.
  • reject: boolean decision p_value < alpha.

Workflow

  1. Validate the square Stein matrix and exclude diagonal entries for observed KSD-U.
  2. Draw multinomial bootstrap counts of size n with uniform category probabilities.
  3. Center the counts as (w_i - 1/n) before forming pairwise products.
  4. Compare the observed scaled statistic against the bootstrap scaled statistics using the strict > tail rule.
  5. Log the seed and bootstrap count for reproducibility.

Validation

Run:

python tests/test_ksd_bootstrap_gof.py

The tests cover U-statistic calculation, reproducibility, and rejection behavior for a strongly positive Stein matrix.

Limitations

  • Bootstrap counts are intended for bounded recovery and smoke checks; large paper-scale replicates may be expensive.
  • The skill assumes the Stein matrix was computed correctly by a scoring skill.

Refinement Notes

Refinement invariant: treat multinomial draws as empirical probabilities before centering. For a draw count count_i, Equation (16) is implemented as (count_i / n - 1 / n), not raw count_i - 1 / n; raw counts make the bootstrap null too wide and suppress valid KSD-U rejections.

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