界面已本地化;技能介绍与说明文档按所选语言由 AI 自动翻译,代码、命令、路径和专业术语保留原文,以原作者文档为准。
探索技能
效率与协作 · SKILL.md

apt_atomic_loss

apt_atomic_loss

【效率与协作】Evaluate equation-6 atomic APT categorical probabilities and density-ratio losses for finite parameter atom sets.

独立 GitHub 快照 · 自动分类 · 以原作者文档为准

技能说明

GitHub

name: apt_atomic_loss description: Evaluate equation-6 atomic APT categorical probabilities and density-ratio losses for finite parameter atom sets.

APT Atomic Loss

Use this skill when APT cannot evaluate the transformed-density normalizer in closed form and a recovery can instead evaluate finite atom sets. The skill computes equation-6 probabilities and the cross-entropy loss for the generating parameter.

Inputs

  • A finite atom set Theta.
  • Posterior-estimator log densities log q(theta_i | x).
  • Prior log densities log p(theta_i).
  • Index of the atom that generated the observation.

Outputs

  • Normalized atom probabilities.
  • Atomic negative log likelihood.
  • Ratio diagnostics showing whether probability ratios match posterior/prior score ratios.

Workflow

  1. Validate matching array lengths, a valid true index, and finite prior density for the true atom.
  2. Compute scores log_q_i - log_prior_i.
  3. Normalize scores with log-sum-exp.
  4. Return -log(probability[true_index]).
  5. Use ratio diagnostics for mechanism checks in reduced recovery.

Validation

Run:

python tests/test_atomic_loss.py

The tests verify normalization, constant-shift invariance, score ordering, loss reduction after a targeted update, and rejection of a true atom outside prior support.

Limitations

  • This helper is deterministic and framework-free. It does not backpropagate through a neural network.
  • Full APT with MAFs or MDNs should use the same probability semantics but would rely on a deep learning framework for gradients.
我的收藏