Skip to content
Back to skills

Apt Atomic Loss

ASecurity

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

  • 247 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 9, 2026
testingpythongobash

Security analysis

A100/100

Pro scans all 3 files and shows the line behind each finding

Scanned September 9, 2026

npx -y skills add VectorSpaceLab/AREX-Skill --skill apt_atomic_loss --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Apt Atomic Loss?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Apt Atomic Loss
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-apt-atomic-loss/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-apt-atomic-loss)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
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:

```bash
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.

Files in this skill

  • SKILL.md1.5 KB
  • scripts/atomic_loss.py3.3 KB
  • tests/test_atomic_loss.py1.4 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…