mutual_inf_cd {knnmi} | R Documentation |
Mutual information estimation
Description
Estimate the mutual information MI(X;Y) of the target X
and features Y
where X
is continuous or discrete and Y
is discrete using k-nearest neighbor distances.
Usage
mutual_inf_cd(target, features, k = 3L)
Arguments
target |
input vector. |
features |
input vector or matrix. |
k |
Integer number of nearest neighbors. The default value is 3. |
Details
The features argument is a vector of the same size as the target vector, or a matrix whose column dimension matches the size of the target vector. Discrete values for the features or targets must be numeric or integer types.
Value
Returns the estimated mutual information. The return value is a vector of size 1 if the features argument is a vector. If the features argument is a matrix then the return value is a vector whose size matches the number of rows in the matrix.
References
Ross BC (2014) Mutual Information between Discrete and Continuous Data Sets. PLoS ONE 9(2): e87357. doi:10.1371/journal.pone.0087357
Examples
data(mutual_info_df)
set.seed(654321)
mutual_inf_cd(mutual_info_df$Zc_XdYd, t(mutual_info_df$Xd))
M <- cbind(mutual_info_df$Xd, mutual_info_df$Yd)
mutual_inf_cd(mutual_info_df$Zc_XdYdWd, t(M))