View source: R/ggparallel_specific_utils.R
mutinfo | R Documentation |
Computes mutual information between each feature in the features
data frame and the target
vector.
The features are discretized using the "equalfreq" method from infotheo::discretize()
.
mutinfo(features, target, return_colnames = FALSE)
features |
A data frame of features. These will be discretized using the "equalfreq" method
(see |
target |
A vector (character or factor) representing the variable to compute mutual information with. |
return_colnames |
Logical; if |
If return_colnames = FALSE
, a named numeric vector of mutual information scores is returned (one for each column in features
), sorted in descending order.
The names of the vector correspond to the column names of features
.
If return_colnames = TRUE
, only the ordered column names of features
are returned.
data(iris)
# Compute mutual information scores
mutinfo(iris[1:4], iris[[5]])
# Get column names ordered by mutual information with target column (most mutual info first)
mutinfo(iris[1:4], iris[[5]], return_colnames = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.