Package com.bayesserver.statistics
Class KullbackLeibler
- java.lang.Object
-
- com.bayesserver.statistics.KullbackLeibler
-
public final class KullbackLeibler extends Object
Calculate the Kullback–Leibler divergence between 2 distributions with the same variables, D(P||Q). A value of 0 indicates that the two distributions behave in a very similar or identical way.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static double
divergence(Distribution priorQ, Distribution posteriorP, LogarithmBase logarithm)
Calculates the Kullback-Leibler divergence D(P||Q).
-
-
-
Method Detail
-
divergence
public static double divergence(Distribution priorQ, Distribution posteriorP, LogarithmBase logarithm)
Calculates the Kullback-Leibler divergence D(P||Q). Supports multivariate distributions. Supports discrete or continuous distributions.- Parameters:
priorQ
- The distribution Q in D(P||Q), e.g. the Prior.posteriorP
- The distribution P in D(P||Q), e.g. the Posterior.logarithm
- The base of the computation.- Returns:
- The Kullback-Leibler divergence in NATS if the logarithm is natural, BITS if the logarithm is base 2.
-
-