Learn R Programming

philentropy (version 0.2.0)

gJSD: Generalized Jensen-Shannon Divergence

Description

This function computes the Generalized Jensen-Shannon Divergence of a probability matrix.

Usage

gJSD(x, unit = "log2", weights = NULL)

Arguments

x

a probability matrix.

unit

a character string specifying the logarithm unit that shall be used to compute distances that depend on log computations.

weights

a numeric vector specifying the weights for each distribution in x.

Default: weights = NULL; in this case all distributions are weighted equally.

Value

The Jensen-Shannon divergence between all possible combinations of comparisons.

Details

Function to compute the Generalized Jensen-Shannon Divergence

See Also

KL, H, JSD, CE, JE

Examples

Run this code
# NOT RUN {
Prob <- rbind(1:10/sum(1:10), 20:29/sum(20:29), 30:39/sum(30:39))

# compute the Generalized JSD comparing the PS probability matrix
gJSD(Prob)

# }

Run the code above in your browser using DataLab