函数 kldivergence #
计算两个分布之间的Kullback-Leibler (KL) 散度
Syntax #
math.kldivergence(x, y)
Parameters #
| Parameter | Type | Description |
|---|---|---|
q |
Array | Matrix | 第一个向量 |
p |
Array | Matrix | 第二个向量 |
Returns #
| Type | Description |
|---|---|
| number | 返回 q 和 p 之间的距离 |
Throws #
Type | Description —- | ———–
Examples #
math.kldivergence([0.7,0.5,0.4], [0.2,0.9,0.5]) //returns 0.24376698773121153