JS_divergence | R Documentation |
Distance measures in convenient forms for the purposes of this
package. JS_divergence
gives the Jensen-Shannon divergence
(see below) between two vectors (understood as distributions over the
index) or between two matrices (row-wise), and cosine_distance
gives the cosine distance between two matrices (row-wise).
JS_divergence(x, y) cosine_distance(x, y)
x, y |
matrices of the same dimensions, or vectors
( |
The Jensen-Shannon divergence between P and Q is given by
(1/2) ∑ P(j) log (2P(j) / (P(j) + Q(j))) + Q(j) log (2Q(j) / (P(j) + Q(j)))
setting x log x = 0 by definition.
For matrices, the result has the distance between x[i,
]
and y[j, ]
in the i, j
position.
topic_divergences
, row_dists
,
model_distances
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.