mirror of
https://github.com/josdejong/mathjs.git
synced 2026-01-25 15:07:57 +00:00
1.1 KiB
1.1 KiB
| layout |
|---|
| default |
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