Computes a chosen statistical criterion for each feature versus target vector.
calc_criterion(target, features, criterion_function)
target |
|
---|---|
features |
|
criterion_function | a function calculating criterion. For a full list, see
|
a integer
vector of length equal to the number of features
containing computed information gain values.
The permutation test implemented in biogram
uses several criterions to filter
important features. Each can be used by test_features
by specifying the
criterion
parameter.
Both target
and features
must be binary, i.e. contain only 0
and 1 values.
tar <- sample(0L:1, 100, replace = TRUE) feats <- matrix(sample(0L:1, 400, replace = TRUE), ncol = 4) # Information Gain calc_criterion(tar, feats, calc_ig)#> [1] 1.704418e-04 1.846969e-04 4.841145e-03 2.021023e-06# hi-squared-based measure calc_criterion(tar, feats, calc_cs)#> [1] 0.0340877092 0.0369378521 0.9668802586 0.0004042021# Kullback-Leibler divergence calc_criterion(tar, feats, calc_kl)#> [1] 6.860279e-04 7.398274e-04 1.968873e-02 8.165554e-06