powered by
Computes Kullback-Leibler divergence between features and target vector.
calc_kl(feature, target_b, len_target, pos_target)
feature vector.
target in bits (as per as.bit).
as.bit
length of the target vector.
number of positive cases in the target vector.
A numeric vector of length 1 representing Kullback-Leibler divergence value.
numeric
Kullback S, Leibler RA On information and sufficiency. Annals of Mathematical Statistics 22 (1):79-86, 1951.
test_features. Kullback-Leibler divergence is calculated using KL.plugin.
test_features
KL.plugin
# NOT RUN { tar <- sample(0L:1, 100, replace = TRUE) feat <- sample(0L:1, 100, replace = TRUE) library(bit) # used to code vector as bit calc_kl(feat, as.bit(tar), 100, sum(tar)) # }
Run the code above in your browser using DataLab