kullbackLeiblerDivergence(
first,second):number
Defined in: packages/distance/src/kullback-leibler.ts:34
Directional relative entropy D(first || second) in nats. The vectors describe the same ordered outcomes. Entries must be probabilities and each total must be within the distribution module’s probability-table tolerance of one. Accepted vectors are normalized by their totals. A positive first mass paired with zero second mass returns Infinity. Takes O(n) time and O(1) space.
Parameters
Section titled “Parameters”second
Section titled “second”Returns
Section titled “Returns”number
Throws
Section titled “Throws”With INVALID_DIMENSION or INVALID_PROBABILITIES.