Description Usage Arguments Value Examples
Compute the cross entropy between the "true" and "unnatural" distributions
p
and q
from associated time series ps
and qs
,
respectively. Cross entropy’s local variant is equivalent to the
self-information of q
, and as such is implemented by the local block
entropy.
1 | cross_entropy(ps, qs)
|
ps |
Vector specifying a time series drawn from the true distribution. |
qs |
Vector specifying a time series drawn from the unnatural distribution. |
Numeric giving the cross entropy.
1 2 3 4 | ps <- c(0, 1, 1, 0, 1, 0, 0, 1, 0, 0)
qs <- c(0, 0, 0, 0, 0, 1, 1, 0, 0, 1)
cross_entropy(ps, qs) # 1.003530
cross_entropy(qs, ps) # 0.912454
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.