Function kldivergence #
Calculate the Kullback-Leibler (KL) divergence between two distributions
Syntax #
math.kldivergence(x, y)
Parameters #
Parameter | Type | Description |
---|---|---|
q |
Array | Matrix | First vector |
p |
Array | Matrix | Second vector |
Returns #
Type | Description |
---|---|
number | Returns distance between q and p |
Throws #
Type | Description —- | ———–
Examples #
math.kldivergence([0.7,0.5,0.4], [0.2,0.9,0.5]) //returns 0.24376698773121153