Particle Entropy Reward
Use this skill when a CIC-style recovery or implementation needs the entropy-based intrinsic reward over state-transition embeddings. Do not use this skill to compute the contrastive loss or downstream task reward.
Inputs
embeddings: two-dimensional transition embedding matrix.k: number of nearest neighbors to average, clamped tobatch_size - 1.epsilon: positive distance stabilizer before logarithms.
Outputs
rewards: per-transition intrinsic reward values based on average log nearest-neighbor distances.diagnostics: min, max, mean reward, effectivek, and neighbor distances.
Workflow
- Validate a batch of at least two embedding vectors.
- Compute pairwise Euclidean distances.
- Exclude self-distances from neighbor lists.
- Select the nearest
kneighbors for each point. - Average
log(distance + epsilon)as the intrinsic reward. - Use reward diagnostics to verify finite, diverse exploration signal.
Validation
Run:
python scripts/entropy_reward.py --demo
python tests/test_entropy_reward.py
Limitations
This skill implements the reward estimator only. It does not interact with an RL environment or train a policy.