klPIE | R Documentation |
This function computes the Kullback-Leibler (KL) divergence between two probability distributions represented by matrices, using a base 10 logarithm. The function calculates KL divergence in both directions (P || Q and Q || P) and handles zero probabilities by replacing them with a minimum value to avoid undefined logarithms.
klPIE(P, Q, min_value = 1e-12)
P |
A numeric matrix representing the first probability distribution. The entire matrix should sum to 1. |
Q |
A numeric matrix representing the second probability distribution. The entire matrix should sum to 1. |
min_value |
A numeric value representing the minimum value to replace
any zero probabilities. Defaults to |
A named numeric vector with two elements:
The KL divergence from P to Q (P || Q).
The KL divergence from Q to P (Q || P).
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.