Learn R Programming

biogram (version 1.3)

calc_criterion: Calculate value of criterion

Description

Computes a chosen statistical criterion for each feature versus target vector.

Usage

calc_criterion(target, features, criterion_function)

Arguments

target
integer vector with target information (e.g. class labels).
features
integer matrix of features with number of rows equal to the length of the target vector.
criterion_function
a function calculating criterion. For a full list, see test_features.

Value

a integer vector of length equal to the number of features containing computed information gain values.

Details

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.

See Also

test_features.

Examples

Run this code
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)

# hi-squared-based measure
calc_criterion(tar, feats, calc_cs)

# Kullback-Leibler divergence
calc_criterion(tar, feats, calc_kl)

Run the code above in your browser using DataLab