kernel_entropy.entropy¶
Kernel Language Entropy calculation.
Transforms similarity matrix W into Von Neumann Entropy through: W -> Laplacian -> Heat Kernel -> Density Matrix -> VNE
Functions
|
Compute Kernel Language Entropy from similarity matrix. |
|
Map KLE (nats) to a [0, 1] certainty. |
- kernel_entropy.entropy.kle_from_similarity(W: Tensor, t: float = 1.0) float[source]¶
Compute Kernel Language Entropy from similarity matrix.
- Parameters:
W – N×N symmetric similarity matrix on CUDA (from NLI scoring)
t – Heat kernel lengthscale (default: 1.0)
- Returns:
Von Neumann Entropy (float)
- kernel_entropy.entropy.kle_to_certainty(entropy: float, n_samples: int) float | None[source]¶
Map KLE (nats) to a [0, 1] certainty.
Returns None when n_samples < 2 (insufficient samples to define entropy). Otherwise returns 1 - entropy / log(n_samples), clamped to [0, 1] to absorb numerical noise near the log(N) ceiling. See the response aggregation doc for the log(N) upper bound.