计划执行与检查节点
executing-plans
按既定实施计划完成工作,保持过程检查和反馈。
stein_kernel_scoring【效率与协作】Compute Kernelized Stein Discrepancy pairwise Stein kernels and U/V-statistic estimates from samples, model scores, and an RBF kernel.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this skill when implementing a goodness-of-fit or sample-quality check from Liu, Lee, and Jordan's Kernelized Stein Discrepancy paper. It is appropriate when samples are available from an unknown distribution and the candidate model can provide score values ∇ log q(x), but likelihood normalizers should not be evaluated.
Do not use this skill for two-sample MMD tests, likelihood-ratio tests, or cases where no differentiable score function is available.
samples: numeric array-like data with shape (n, d) or one-dimensional shape (n,).scores: score vectors for the same samples, or a Python callable that returns them.bandwidth: positive RBF bandwidth, or None to use median pairwise distance.1.0 for degenerate samples.k * [s_x·s_y + s_x·(x-y)/h² + (y-x)·s_y/h² + d/h² - ||x-y||²/h⁴].Run:
python tests/test_stein_kernel_scoring.py
The tests check shape, symmetry, diagonal handling, and stronger KSD under a shifted model score.