kld_discrete {kldest} | R Documentation |
Analytical KL divergence for two discrete distributions
Description
Analytical KL divergence for two discrete distributions
Usage
kld_discrete(P, Q)
Arguments
P , Q |
Numerical arrays with the same dimensions, representing discrete probability distributions |
Value
A scalar (the Kullback-Leibler divergence)
Examples
# 1-D example
P <- 1:4/10
Q <- rep(0.25,4)
kld_discrete(P,Q)
# The above example in 2-D
P <- matrix(1:4/10,nrow=2)
Q <- matrix(0.25,nrow=2,ncol=2)
kld_discrete(P,Q)
[Package kldest version 1.0.0 Index]