UNPKG

636 BMarkdownView Raw
1<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
2
3# Function kldivergence
4
5Calculate the Kullback-Leibler (KL) divergence between two distributions
6
7
8## Syntax
9
10```js
11math.kldivergence(x, y)
12```
13
14### Parameters
15
16Parameter | Type | Description
17--------- | ---- | -----------
18`q` | Array &#124; Matrix | First vector
19`p` | Array &#124; Matrix | Second vector
20
21### Returns
22
23Type | Description
24---- | -----------
25number | Returns distance between q and p
26
27
28## Examples
29
30```js
31math.kldivergence([0.7,0.5,0.4], [0.2,0.9,0.5]) //returns 0.24376698773121153
32
33```
34
35