Title: | Tools for Information-Based Feature Selection and Scoring |
---|---|
Description: | A toolbox of fast, native and parallel implementations of various information-based importance criteria estimators and feature selection filters based on them, inspired by the overview by Brown, Pocock, Zhao and Lujan (2012) <https://www.jmlr.org/papers/v13/brown12a.html>. Contains, among other, minimum redundancy maximal relevancy ('mRMR') method by Peng, Long and Ding (2005) <doi:10.1109/TPAMI.2005.159>; joint mutual information ('JMI') method by Yang and Moody (1999) <https://papers.nips.cc/paper/1779-data-visualization-and-feature-selection-new-algorithms-for-nongaussian-data>; double input symmetrical relevance ('DISR') method by Meyer and Bontempi (2006) <doi:10.1007/11732242_9> as well as joint mutual information maximisation ('JMIM') method by Bennasar, Hicks and Setchi (2015) <doi:10.1016/j.eswa.2015.07.007>. |
Authors: | Miron B. Kursa [aut, cre] |
Maintainer: | Miron B. Kursa <[email protected]> |
License: | GPL-3 |
Version: | 11.0.0 |
Built: | 2024-10-31 21:24:32 UTC |
Source: | CRAN |
Praznik is a collection of tools for information theory-based feature selection and scoring.
The first part of the package consists of efficient implementations of several popular information filters, feature selection approaches based on greedy optimisation of certain feature inclusion criterion.
In a nutshell, an algorithm of this class requires an information system and a predefined number of features to selected
, and works like this.
To start, it estimates mutual information between each feature and the decision, find a feature with maximal such score and stores it as a first on a list of selected features,
.
Then, it estimates a value of a certain criterion function
for each feature
; this function also depends on
and the set of already selected features
.
As in the first step, the previously unselected feature with a greatest value of the criterion function is selected next.
This is repeated until the method would gather
features, or, in case of some methods, when no more informative features can be found.
The methods implemented in praznik consider the following criteria.
The mutual information maximisation filter, MIM
, simply selects top- features of best mutual information, that is
The minimal conditional mutual information maximisation proposed by F. Fleauret, CMIM
, uses
this method is also effectively identical to the information fragments method.
The minimum redundancy maximal relevancy proposed by H. Peng et al., MRMR
, uses
The joint mutual information filter by H. Yang and J. Moody, JMI
, uses
The double input symmetrical relevance filter by P. Meyer and G. Bontempi, DISR
, uses
The minimal joint mutual information maximisation filter by M. Bennasar, Y. Hicks and R. Setchi, JMIM
, uses
The minimal normalised joint mutual information maximisation filter by the same authors, NJMIM
, uses
The third-order joint mutual information filter by Sechidis et al., JMI3
, uses
While CMIM
, JMIM
and NJMIM
consider minimal value over already selected features, they may use a somewhat more sophisticated and faster algorithm.
The second part of the package provides methods for scoring features, useful on its own as well as building blocks for more sophisticated algorithms. In particular, the package exposes the following functions:
hScores
returns
jhScores
returns
miScores
returns
cmiScores
returns, for a given condition vector ,
jmiScores
returns
njmiScores
returns
minCmiScores
, maxCmiScores
and minMaxCmiScores
return
and/or
maxJmiScores
returns
triScores
returns, for every triple of features,
These function generally also have their *Matrix
counterparts, which efficiently build a matrix of scores between all pairs of features.
This is especially useful for network inference tasks.
Estimation of mutual information and its generalisations is a hard task; still, praznik aims at speed and simplicity and hence only offers basic, maximum likelihood estimator applicable on discrete data. For convenience, praznik automatically and silently coerces non-factor inputs into about ten equally-spaced bins, following the heuristic often used in literature.
Furthermore, praznik provides kTransform
function for converting continuous features into discrete ones with Kendall transformation, a novel approach based on Kendall correlation coefficient which allows for multivariate reasoning based on monotonicity agreement.
Additionally, praznik has a limited, experimental support for replacing entropic statistics with Gini impurity-based; in such framework, entropy is replaced by Gini impurity
which leads to an impurity gain
a counterpart of mutual information or information gain. It does not possess most of elegant properties of mutual information, yet values of both are usually highly correlated; moreover, Gini gain is computationally easier to calculate, hence it often replaces MI in performance-sensitive applications, like optimising splits in decision trees.
In a present version, praznik includes impScores
for generating values of for all features (an analog of
miScores
, as well as JIM
, a Gini gain-based feature selection method otherwise identical to JMI
.
Maintainer: Miron B. Kursa [email protected] (ORCID)
"Praznik: High performance information-based feature selection" M.B. Kursa. SoftwareX 16, 100819 (2021).
"Conditional Likelihood Maximisation: A Unifying Framework for Information Theoretic Feature Selection" G. Brown et al. JMLR (2012).
Useful links:
The method starts with a feature of a maximal mutual information with the decision .
Then, it greedily adds feature
with a maximal value of the following criterion:
where is the set of already selected features.
CMI(X, Y, k = 3, threads = 0)
CMI(X, Y, k = 3, threads = 0)
X |
Attribute table, given as a data frame with either factors (preferred), booleans, integers (treated as categorical) or reals (which undergo automatic categorisation; see below for details).
Single vector will be interpreted as a data.frame with one column.
|
Y |
Decision attribute; should be given as a factor, but other options are accepted, exactly like for attributes.
|
k |
Number of attributes to select.
Must not exceed |
threads |
Number of threads to use; default value, 0, means all available to OpenMP. |
A list with two elements: selection
, a vector of indices of the selected features in the selection order, and score
, a vector of corresponding feature scores.
Names of both vectors will correspond to the names of features in X
.
Both vectors will be at most of a length k
, as the selection may stop sooner, even during initial selection, in which case both vectors will be empty.
The method requires input to be discrete to use empirical estimators of distribution, and, consequently, information gain or entropy.
To allow smoother user experience, praznik automatically coerces non-factor vectors in inputs, which requires additional time, memory and may yield confusing results – the best practice is to convert data to factors prior to feeding them in this function.
Real attributes are cut into about 10 equally-spaced bins, following the heuristic often used in literature.
Precise number of cuts depends on the number of objects; namely, it is , but never less than 2 and never more than 10.
Integers (which technically are also numeric) are treated as categorical variables (for compatibility with similar software), so in a very different way – one should be aware that an actually numeric attribute which happens to be an integer could be coerced into a
-level categorical, which would have a perfect mutual information score and would likely become a very disruptive false positive.
data(MadelonD) CMI(MadelonD$X,MadelonD$Y,20)
data(MadelonD) CMI(MadelonD$X,MadelonD$Y,20)
The method starts with a feature of a maximal mutual information with the decision .
Then, it greedily adds feature
with a maximal value of the following criterion:
where is the set of already selected features.
CMIM(X, Y, k = 3, threads = 0)
CMIM(X, Y, k = 3, threads = 0)
X |
Attribute table, given as a data frame with either factors (preferred), booleans, integers (treated as categorical) or reals (which undergo automatic categorisation; see below for details).
Single vector will be interpreted as a data.frame with one column.
|
Y |
Decision attribute; should be given as a factor, but other options are accepted, exactly like for attributes.
|
k |
Number of attributes to select.
Must not exceed |
threads |
Number of threads to use; default value, 0, means all available to OpenMP. |
A list with two elements: selection
, a vector of indices of the selected features in the selection order, and score
, a vector of corresponding feature scores.
Names of both vectors will correspond to the names of features in X
.
Both vectors will be at most of a length k
, as the selection may stop sooner, even during initial selection, in which case both vectors will be empty.
The method requires input to be discrete to use empirical estimators of distribution, and, consequently, information gain or entropy.
To allow smoother user experience, praznik automatically coerces non-factor vectors in inputs, which requires additional time, memory and may yield confusing results – the best practice is to convert data to factors prior to feeding them in this function.
Real attributes are cut into about 10 equally-spaced bins, following the heuristic often used in literature.
Precise number of cuts depends on the number of objects; namely, it is , but never less than 2 and never more than 10.
Integers (which technically are also numeric) are treated as categorical variables (for compatibility with similar software), so in a very different way – one should be aware that an actually numeric attribute which happens to be an integer could be coerced into a
-level categorical, which would have a perfect mutual information score and would likely become a very disruptive false positive.
"Fast Binary Feature Selection using Conditional Mutual Information Maximisation" F. Fleuret, JMLR (2004)
"Object recognition with informative features and linear classification" M. Vidal-Naquet and S. Ullman, IEEE Conference on Computer Vision and Pattern Recognition (2003).
data(MadelonD) CMIM(MadelonD$X,MadelonD$Y,20)
data(MadelonD) CMIM(MadelonD$X,MadelonD$Y,20)
Calculates conditional mutual information between each two features given another one, that is
cmiMatrix(X, Z, zeroDiag = TRUE, threads = 0)
cmiMatrix(X, Z, zeroDiag = TRUE, threads = 0)
X |
Attribute table, given as a data frame with either factors (preferred), booleans, integers (treated as categorical) or reals (which undergo automatic categorisation; see below for details).
Single vector will be interpreted as a data.frame with one column.
|
Z |
Condition; should be given as a factor, but other options are accepted, as for features. |
zeroDiag |
Boolean flag, whether the diagonal should be filled with zeroes, or with degenerated scores for two identical copies of a feature. |
threads |
Number of threads to use; default value, 0, means all available to OpenMP. |
A numerical matrix with scores, with row and column names copied from X
.
The method requires input to be discrete to use empirical estimators of distribution, and, consequently, information gain or entropy.
To allow smoother user experience, praznik automatically coerces non-factor vectors in inputs, which requires additional time, memory and may yield confusing results – the best practice is to convert data to factors prior to feeding them in this function.
Real attributes are cut into about 10 equally-spaced bins, following the heuristic often used in literature.
Precise number of cuts depends on the number of objects; namely, it is , but never less than 2 and never more than 10.
Integers (which technically are also numeric) are treated as categorical variables (for compatibility with similar software), so in a very different way – one should be aware that an actually numeric attribute which happens to be an integer could be coerced into a
-level categorical, which would have a perfect mutual information score and would likely become a very disruptive false positive.
cmiMatrix(iris[,-5],iris[,5])
cmiMatrix(iris[,-5],iris[,5])
Calculates conditional mutual information between each features and the decision, that is
cmiScores(X, Y, Z, threads = 0)
cmiScores(X, Y, Z, threads = 0)
X |
Attribute table, given as a data frame with either factors (preferred), booleans, integers (treated as categorical) or reals (which undergo automatic categorisation; see below for details).
Single vector will be interpreted as a data.frame with one column.
|
Y |
Decision attribute; should be given as a factor, but other options are accepted, exactly like for attributes.
|
Z |
Condition; should be given as a factor, but other options are accepted, as for features. |
threads |
Number of threads to use; default value, 0, means all available to OpenMP. |
A numerical vector with conditional mutual information scores, with names copied from X
.
The method requires input to be discrete to use empirical estimators of distribution, and, consequently, information gain or entropy.
To allow smoother user experience, praznik automatically coerces non-factor vectors in inputs, which requires additional time, memory and may yield confusing results – the best practice is to convert data to factors prior to feeding them in this function.
Real attributes are cut into about 10 equally-spaced bins, following the heuristic often used in literature.
Precise number of cuts depends on the number of objects; namely, it is , but never less than 2 and never more than 10.
Integers (which technically are also numeric) are treated as categorical variables (for compatibility with similar software), so in a very different way – one should be aware that an actually numeric attribute which happens to be an integer could be coerced into a
-level categorical, which would have a perfect mutual information score and would likely become a very disruptive false positive.
cmiScores(iris[,-5],iris$Species,iris$Sepal.Length)
cmiScores(iris[,-5],iris$Species,iris$Sepal.Length)
The method starts with a feature of a maximal mutual information with the decision .
Then, it greedily adds feature
with a maximal value of the following criterion:
where is the set of already selected features.
DISR(X, Y, k = 3, threads = 0)
DISR(X, Y, k = 3, threads = 0)
X |
Attribute table, given as a data frame with either factors (preferred), booleans, integers (treated as categorical) or reals (which undergo automatic categorisation; see below for details).
Single vector will be interpreted as a data.frame with one column.
|
Y |
Decision attribute; should be given as a factor, but other options are accepted, exactly like for attributes.
|
k |
Number of attributes to select.
Must not exceed |
threads |
Number of threads to use; default value, 0, means all available to OpenMP. |
A list with two elements: selection
, a vector of indices of the selected features in the selection order, and score
, a vector of corresponding feature scores.
Names of both vectors will correspond to the names of features in X
.
Both vectors will be at most of a length k
, as the selection may stop sooner, even during initial selection, in which case both vectors will be empty.
DISR is a normalised version of JMI
; JMIM
and NJMIM
are modifications of JMI and DISR in which minimal joint information over already selected features is used instead of a sum.
The method requires input to be discrete to use empirical estimators of distribution, and, consequently, information gain or entropy.
To allow smoother user experience, praznik automatically coerces non-factor vectors in inputs, which requires additional time, memory and may yield confusing results – the best practice is to convert data to factors prior to feeding them in this function.
Real attributes are cut into about 10 equally-spaced bins, following the heuristic often used in literature.
Precise number of cuts depends on the number of objects; namely, it is , but never less than 2 and never more than 10.
Integers (which technically are also numeric) are treated as categorical variables (for compatibility with similar software), so in a very different way – one should be aware that an actually numeric attribute which happens to be an integer could be coerced into a
-level categorical, which would have a perfect mutual information score and would likely become a very disruptive false positive.
"On the Use of Variable Complementarity for Feature Selection in Cancer Classification" P. Meyer and G. Bontempi, (2006)
data(MadelonD) DISR(MadelonD$X,MadelonD$Y,20)
data(MadelonD) DISR(MadelonD$X,MadelonD$Y,20)
Calculates directed normalised mutual information between each two features, that is
dnmiMatrix(X, zeroDiag = TRUE, threads = 0)
dnmiMatrix(X, zeroDiag = TRUE, threads = 0)
X |
Attribute table, given as a data frame with either factors (preferred), booleans, integers (treated as categorical) or reals (which undergo automatic categorisation; see below for details).
Single vector will be interpreted as a data.frame with one column.
|
zeroDiag |
Boolean flag, whether the diagonal should be filled with zeroes, or with degenerated scores for two identical copies of a feature. |
threads |
Number of threads to use; default value, 0, means all available to OpenMP. |
A numerical matrix with scores, with row and column names copied from X
.
The method requires input to be discrete to use empirical estimators of distribution, and, consequently, information gain or entropy.
To allow smoother user experience, praznik automatically coerces non-factor vectors in inputs, which requires additional time, memory and may yield confusing results – the best practice is to convert data to factors prior to feeding them in this function.
Real attributes are cut into about 10 equally-spaced bins, following the heuristic often used in literature.
Precise number of cuts depends on the number of objects; namely, it is , but never less than 2 and never more than 10.
Integers (which technically are also numeric) are treated as categorical variables (for compatibility with similar software), so in a very different way – one should be aware that an actually numeric attribute which happens to be an integer could be coerced into a
-level categorical, which would have a perfect mutual information score and would likely become a very disruptive false positive.
dnmiMatrix(iris)
dnmiMatrix(iris)
Calculates entropy of each feature, that is
hScores(X, threads = 0)
hScores(X, threads = 0)
X |
Attribute table, given as a data frame with either factors (preferred), booleans, integers (treated as categorical) or reals (which undergo automatic categorisation; see below for details).
Single vector will be interpreted as a data.frame with one column.
|
threads |
Number of threads to use; default value, 0, means all available to OpenMP. |
A numerical vector with entropy scores, with names copied from X
.
The method requires input to be discrete to use empirical estimators of distribution, and, consequently, information gain or entropy.
To allow smoother user experience, praznik automatically coerces non-factor vectors in inputs, which requires additional time, memory and may yield confusing results – the best practice is to convert data to factors prior to feeding them in this function.
Real attributes are cut into about 10 equally-spaced bins, following the heuristic often used in literature.
Precise number of cuts depends on the number of objects; namely, it is , but never less than 2 and never more than 10.
Integers (which technically are also numeric) are treated as categorical variables (for compatibility with similar software), so in a very different way – one should be aware that an actually numeric attribute which happens to be an integer could be coerced into a
-level categorical, which would have a perfect mutual information score and would likely become a very disruptive false positive.
hScores(iris[,-5])
hScores(iris[,-5])
Calculates conditional mutual information between each feature and the decision given each other feature, that is
icmiMatrix(X, Y, threads = 0)
icmiMatrix(X, Y, threads = 0)
X |
Attribute table, given as a data frame with either factors (preferred), booleans, integers (treated as categorical) or reals (which undergo automatic categorisation; see below for details).
Single vector will be interpreted as a data.frame with one column.
|
Y |
Decision attribute; should be given as a factor, but other options are accepted, exactly like for attributes.
|
threads |
Number of threads to use; default value, 0, means all available to OpenMP. |
A numerical matrix with scores, with row and column names copied from X
.
The method requires input to be discrete to use empirical estimators of distribution, and, consequently, information gain or entropy.
To allow smoother user experience, praznik automatically coerces non-factor vectors in inputs, which requires additional time, memory and may yield confusing results – the best practice is to convert data to factors prior to feeding them in this function.
Real attributes are cut into about 10 equally-spaced bins, following the heuristic often used in literature.
Precise number of cuts depends on the number of objects; namely, it is , but never less than 2 and never more than 10.
Integers (which technically are also numeric) are treated as categorical variables (for compatibility with similar software), so in a very different way – one should be aware that an actually numeric attribute which happens to be an integer could be coerced into a
-level categorical, which would have a perfect mutual information score and would likely become a very disruptive false positive.
Diagonal is always zero with this score. The function name comes from the reasoning that this is an "interaction-CMI" showing how feature pairs interact in explaining the decision.
icmiMatrix(iris[,-5],iris[,5])
icmiMatrix(iris[,-5],iris[,5])
Calculates Gini impurity between each feature and the decision, that is
impScores(X, Y, threads = 0)
impScores(X, Y, threads = 0)
X |
Attribute table, given as a data frame with either factors (preferred), booleans, integers (treated as categorical) or reals (which undergo automatic categorisation; see below for details).
Single vector will be interpreted as a data.frame with one column.
|
Y |
Decision attribute; should be given as a factor, but other options are accepted, exactly like for attributes.
|
threads |
Number of threads to use; default value, 0, means all available to OpenMP. |
A numerical vector with Gini impurity scores, with names copied from X
.
The method requires input to be discrete to use empirical estimators of distribution, and, consequently, information gain or entropy.
To allow smoother user experience, praznik automatically coerces non-factor vectors in inputs, which requires additional time, memory and may yield confusing results – the best practice is to convert data to factors prior to feeding them in this function.
Real attributes are cut into about 10 equally-spaced bins, following the heuristic often used in literature.
Precise number of cuts depends on the number of objects; namely, it is , but never less than 2 and never more than 10.
Integers (which technically are also numeric) are treated as categorical variables (for compatibility with similar software), so in a very different way – one should be aware that an actually numeric attribute which happens to be an integer could be coerced into a
-level categorical, which would have a perfect mutual information score and would likely become a very disruptive false positive.
impScores(iris[,-5],iris$Species)
impScores(iris[,-5],iris$Species)
Calculates joint entropy of each feature and a condition Y
, that is
jhScores(X, Y, threads = 0)
jhScores(X, Y, threads = 0)
X |
Attribute table, given as a data frame with either factors (preferred), booleans, integers (treated as categorical) or reals (which undergo automatic categorisation; see below for details).
Single vector will be interpreted as a data.frame with one column.
|
Y |
Decision attribute; should be given as a factor, but other options are accepted, exactly like for attributes.
|
threads |
Number of threads to use; default value, 0, means all available to OpenMP. |
A numerical vector with entropy scores, with names copied from X
.
The method requires input to be discrete to use empirical estimators of distribution, and, consequently, information gain or entropy.
To allow smoother user experience, praznik automatically coerces non-factor vectors in inputs, which requires additional time, memory and may yield confusing results – the best practice is to convert data to factors prior to feeding them in this function.
Real attributes are cut into about 10 equally-spaced bins, following the heuristic often used in literature.
Precise number of cuts depends on the number of objects; namely, it is , but never less than 2 and never more than 10.
Integers (which technically are also numeric) are treated as categorical variables (for compatibility with similar software), so in a very different way – one should be aware that an actually numeric attribute which happens to be an integer could be coerced into a
-level categorical, which would have a perfect mutual information score and would likely become a very disruptive false positive.
jhScores(iris[,-5],iris[,5])
jhScores(iris[,-5],iris[,5])
The method starts with a feature of a maximal impurity gain with the decision .
Then, it greedily adds feature
with a maximal value of the following criterion:
where is the set of already selected features, and
is the Gini impurity gain from partitioning according to
.
JIM(X, Y, k = 3, threads = 0)
JIM(X, Y, k = 3, threads = 0)
X |
Attribute table, given as a data frame with either factors (preferred), booleans, integers (treated as categorical) or reals (which undergo automatic categorisation; see below for details).
Single vector will be interpreted as a data.frame with one column.
|
Y |
Decision attribute; should be given as a factor, but other options are accepted, exactly like for attributes.
|
k |
Number of attributes to select.
Must not exceed |
threads |
Number of threads to use; default value, 0, means all available to OpenMP. |
A list with two elements: selection
, a vector of indices of the selected features in the selection order, and score
, a vector of corresponding feature scores.
Names of both vectors will correspond to the names of features in X
.
Both vectors will be at most of a length k
, as the selection may stop sooner, even during initial selection, in which case both vectors will be empty.
This is an impurity-based version of JMI
; expect similar results in slightly shorter time.
The method requires input to be discrete to use empirical estimators of distribution, and, consequently, information gain or entropy.
To allow smoother user experience, praznik automatically coerces non-factor vectors in inputs, which requires additional time, memory and may yield confusing results – the best practice is to convert data to factors prior to feeding them in this function.
Real attributes are cut into about 10 equally-spaced bins, following the heuristic often used in literature.
Precise number of cuts depends on the number of objects; namely, it is , but never less than 2 and never more than 10.
Integers (which technically are also numeric) are treated as categorical variables (for compatibility with similar software), so in a very different way – one should be aware that an actually numeric attribute which happens to be an integer could be coerced into a
-level categorical, which would have a perfect mutual information score and would likely become a very disruptive false positive.
data(MadelonD) JIM(MadelonD$X,MadelonD$Y,20)
data(MadelonD) JIM(MadelonD$X,MadelonD$Y,20)
The method starts with a feature of a maximal mutual information with the decision .
Then, it greedily adds feature
with a maximal value of the following criterion:
where is the set of already selected features.
JMI(X, Y, k = 3, threads = 0)
JMI(X, Y, k = 3, threads = 0)
X |
Attribute table, given as a data frame with either factors (preferred), booleans, integers (treated as categorical) or reals (which undergo automatic categorisation; see below for details).
Single vector will be interpreted as a data.frame with one column.
|
Y |
Decision attribute; should be given as a factor, but other options are accepted, exactly like for attributes.
|
k |
Number of attributes to select.
Must not exceed |
threads |
Number of threads to use; default value, 0, means all available to OpenMP. |
A list with two elements: selection
, a vector of indices of the selected features in the selection order, and score
, a vector of corresponding feature scores.
Names of both vectors will correspond to the names of features in X
.
Both vectors will be at most of a length k
, as the selection may stop sooner, even during initial selection, in which case both vectors will be empty.
DISR
is a normalised version of JMI; JMIM
and NJMIM
are modifications of JMI and DISR in which minimal joint information over already selected features is used instead of a sum.
The method requires input to be discrete to use empirical estimators of distribution, and, consequently, information gain or entropy.
To allow smoother user experience, praznik automatically coerces non-factor vectors in inputs, which requires additional time, memory and may yield confusing results – the best practice is to convert data to factors prior to feeding them in this function.
Real attributes are cut into about 10 equally-spaced bins, following the heuristic often used in literature.
Precise number of cuts depends on the number of objects; namely, it is , but never less than 2 and never more than 10.
Integers (which technically are also numeric) are treated as categorical variables (for compatibility with similar software), so in a very different way – one should be aware that an actually numeric attribute which happens to be an integer could be coerced into a
-level categorical, which would have a perfect mutual information score and would likely become a very disruptive false positive.
"Data Visualization and Feature Selection: New Algorithms for Nongaussian Data" H. Yang and J. Moody, NIPS (1999)
data(MadelonD) JMI(MadelonD$X,MadelonD$Y,20)
data(MadelonD) JMI(MadelonD$X,MadelonD$Y,20)
The method starts with two features: of a maximal mutual information with the decision
, and
of a maximal value of
, as would be selected second by a regular
JMI
.
Then, it greedily adds feature with a maximal value of the following criterion:
where is the set of already selected features.
JMI3(X, Y, k = 3, threads = 0)
JMI3(X, Y, k = 3, threads = 0)
X |
Attribute table, given as a data frame with either factors (preferred), booleans, integers (treated as categorical) or reals (which undergo automatic categorisation; see below for details).
Single vector will be interpreted as a data.frame with one column.
|
Y |
Decision attribute; should be given as a factor, but other options are accepted, exactly like for attributes.
|
k |
Number of attributes to select.
Must not exceed |
threads |
Number of threads to use; default value, 0, means all available to OpenMP. |
A list with two elements: selection
, a vector of indices of the selected features in the selection order, and score
, a vector of corresponding feature scores.
Names of both vectors will correspond to the names of features in X
.
Both vectors will be at most of a length k
, as the selection may stop sooner, even during initial selection, in which case both vectors will be empty.
This method has a complexity of , while other filters have
— for larger
, it will be substantially slower.
In the original paper, special shrinkage estimator of MI is used; in praznik, all algorithms use ML estimators, so is
JMI3
.
The method requires input to be discrete to use empirical estimators of distribution, and, consequently, information gain or entropy.
To allow smoother user experience, praznik automatically coerces non-factor vectors in inputs, which requires additional time, memory and may yield confusing results – the best practice is to convert data to factors prior to feeding them in this function.
Real attributes are cut into about 10 equally-spaced bins, following the heuristic often used in literature.
Precise number of cuts depends on the number of objects; namely, it is , but never less than 2 and never more than 10.
Integers (which technically are also numeric) are treated as categorical variables (for compatibility with similar software), so in a very different way – one should be aware that an actually numeric attribute which happens to be an integer could be coerced into a
-level categorical, which would have a perfect mutual information score and would likely become a very disruptive false positive.
"Efficient feature selection using shrinkage estimators" K. Sechidis, L. Azzimonti, A. Pocock, G. Corani, J. Weatherall and G. Brown. Machine Learning, 108 (8-9), pp. 1261-1286 (2019)
## Not run: data(MadelonD) JMI3(MadelonD$X,MadelonD$Y,20) ## End(Not run)
## Not run: data(MadelonD) JMI3(MadelonD$X,MadelonD$Y,20) ## End(Not run)
The method starts with a feature of a maximal mutual information with the decision .
Then, it greedily adds feature
with a maximal value of the following criterion:
where is the set of already selected features.
JMIM(X, Y, k = 3, threads = 0)
JMIM(X, Y, k = 3, threads = 0)
X |
Attribute table, given as a data frame with either factors (preferred), booleans, integers (treated as categorical) or reals (which undergo automatic categorisation; see below for details).
Single vector will be interpreted as a data.frame with one column.
|
Y |
Decision attribute; should be given as a factor, but other options are accepted, exactly like for attributes.
|
k |
Number of attributes to select.
Must not exceed |
threads |
Number of threads to use; default value, 0, means all available to OpenMP. |
A list with two elements: selection
, a vector of indices of the selected features in the selection order, and score
, a vector of corresponding feature scores.
Names of both vectors will correspond to the names of features in X
.
Both vectors will be at most of a length k
, as the selection may stop sooner, even during initial selection, in which case both vectors will be empty.
NJMIM
is a normalised version of JMIM; JMI
and DISR
are modifications of JMIM and NJMIM in which a sum of joint information over already selected features is used instead of a minimum.
The method requires input to be discrete to use empirical estimators of distribution, and, consequently, information gain or entropy.
To allow smoother user experience, praznik automatically coerces non-factor vectors in inputs, which requires additional time, memory and may yield confusing results – the best practice is to convert data to factors prior to feeding them in this function.
Real attributes are cut into about 10 equally-spaced bins, following the heuristic often used in literature.
Precise number of cuts depends on the number of objects; namely, it is , but never less than 2 and never more than 10.
Integers (which technically are also numeric) are treated as categorical variables (for compatibility with similar software), so in a very different way – one should be aware that an actually numeric attribute which happens to be an integer could be coerced into a
-level categorical, which would have a perfect mutual information score and would likely become a very disruptive false positive.
"Feature selection using Joint Mutual Information Maximisation" M. Bennasar, Y. Hicks and R. Setchi, (2015)
data(MadelonD) JMIM(MadelonD$X,MadelonD$Y,20)
data(MadelonD) JMIM(MadelonD$X,MadelonD$Y,20)
Calculates mutual information between each feature and a joint mix of each other feature with a given feature, that is
jmiMatrix(X, Z, zeroDiag = TRUE, threads = 0)
jmiMatrix(X, Z, zeroDiag = TRUE, threads = 0)
X |
Attribute table, given as a data frame with either factors (preferred), booleans, integers (treated as categorical) or reals (which undergo automatic categorisation; see below for details).
Single vector will be interpreted as a data.frame with one column.
|
Z |
Condition; should be given as a factor, but other options are accepted, as for features. |
zeroDiag |
Boolean flag, whether the diagonal should be filled with zeroes, or with degenerated scores for two identical copies of a feature. |
threads |
Number of threads to use; default value, 0, means all available to OpenMP. |
A numerical matrix with scores, with row and column names copied from X
.
The method requires input to be discrete to use empirical estimators of distribution, and, consequently, information gain or entropy.
To allow smoother user experience, praznik automatically coerces non-factor vectors in inputs, which requires additional time, memory and may yield confusing results – the best practice is to convert data to factors prior to feeding them in this function.
Real attributes are cut into about 10 equally-spaced bins, following the heuristic often used in literature.
Precise number of cuts depends on the number of objects; namely, it is , but never less than 2 and never more than 10.
Integers (which technically are also numeric) are treated as categorical variables (for compatibility with similar software), so in a very different way – one should be aware that an actually numeric attribute which happens to be an integer could be coerced into a
-level categorical, which would have a perfect mutual information score and would likely become a very disruptive false positive.
jmiMatrix(iris[,-5],iris[,5])
jmiMatrix(iris[,-5],iris[,5])
Calculates joint mutual information between each feature joint with some other vector Z
with the decision, that is
This is the same as conditional mutual information between X and Y plus a constant that depends on Y and Z, that is
jmiScores(X, Y, Z, threads = 0)
jmiScores(X, Y, Z, threads = 0)
X |
Attribute table, given as a data frame with either factors (preferred), booleans, integers (treated as categorical) or reals (which undergo automatic categorisation; see below for details).
Single vector will be interpreted as a data.frame with one column.
|
Y |
Decision attribute; should be given as a factor, but other options are accepted, exactly like for attributes.
|
Z |
Other vector; should be given as a factor, but other options are accepted, as for features. |
threads |
Number of threads to use; default value, 0, means all available to OpenMP. |
A numerical vector with joint mutual information scores, with names copied from X
.
The method requires input to be discrete to use empirical estimators of distribution, and, consequently, information gain or entropy.
To allow smoother user experience, praznik automatically coerces non-factor vectors in inputs, which requires additional time, memory and may yield confusing results – the best practice is to convert data to factors prior to feeding them in this function.
Real attributes are cut into about 10 equally-spaced bins, following the heuristic often used in literature.
Precise number of cuts depends on the number of objects; namely, it is , but never less than 2 and never more than 10.
Integers (which technically are also numeric) are treated as categorical variables (for compatibility with similar software), so in a very different way – one should be aware that an actually numeric attribute which happens to be an integer could be coerced into a
-level categorical, which would have a perfect mutual information score and would likely become a very disruptive false positive.
jmiScores(iris[,-5],iris$Species,iris$Sepal.Length)
jmiScores(iris[,-5],iris$Species,iris$Sepal.Length)
Convenience function for joining factors.
joinf(...)
joinf(...)
... |
One or more features to merge.
Given as single vectors or data.frames.
Accepted feature types are factor (preferred), booleans, integers (treated as categorical) or reals (which undergo automatic categorisation).
|
Joint factor, with levels l1
to l<n>
.
Vacant combinations are dropped.
You can pass a single vector to this function to see how praznik interprets it.
joinf(c(1,2,1,2),c(1,1,2,2))
joinf(c(1,2,1,2),c(1,1,2,2))
This function attempts to reverse Kendall transformation using a simple ranking agreement method, which always restores original ranking if the input corresponds to one, or a reasonable best-effort guess if not.
Namely, each objects gets a score based on its relation with each other object, 2 points for a win ('>'
) and 1 point for a tie ('='
); these scores are used to calculate ranks.
This function can also be directly given greater-than scores, for instance confidence scores from some classifier trained on Kendall-transformed data.
kInverse(x)
kInverse(x)
x |
A Kendall-transformed feature to be converted back into a ranking.
To be interpreted as a such, it must be a factor with levels being a subset of |
Vector of ranks corresponding to x
.
An order of elements in x
is crucial; if it is not the same as generated by the kTransform
, results will be wrong.
This function cannot assert that the order is correct.
"Kendall transformation brings a robust categorical representation of ordinal data" M.B. Kursa. SciRep 12, 8341 (2022).
kInverse(kTransform(1:7))
kInverse(kTransform(1:7))
Kendall transformation
kTransform(x)
kTransform(x)
x |
Vector or data frame to be Kendall-transformed; allowed feature types are numeric, integer (treated as numeric), ordered factor, logical and unordered factor with two or less levels.
|
A transformed vector or data frame with transformed columns.
"Kendall transformation brings a robust categorical representation of ordinal data" M.B. Kursa. SciRep 12, 8341 (2022).
kTransform(data.frame(Asc=1:3,Desc=3:1,Vsh=c(2,1,2)))
kTransform(data.frame(Asc=1:3,Desc=3:1,Vsh=c(2,1,2)))
Madelon is a synthetic data set from the NIPS 2003 feature selection challenge, generated by Isabelle Guyon. It contains 480 irrelevant and 20 relevant features, including 5 informative and 15 redundant. In this version, the originally numerical features have been pre-cut into 10 bins, as well as their names have been altered to reveal 20 relevant features (as identified by the Boruta method).
data(MadelonD)
data(MadelonD)
A list with two elements, X
containing a data frame with predictors, and Y
, the decision.
Features are in the same order as in the original data; the names of relevant ones start with Rel
, while of irrelevant ones with Irr
.
https://archive.ics.uci.edu/ml/datasets/Madelon
For each feature, calculates the conditional mutual information between this feature and the decision, conditioned on all other features, and returns the maximal value, that is
maxCmiScores(X, Y, threads = 0)
maxCmiScores(X, Y, threads = 0)
X |
Attribute table, given as a data frame with either factors (preferred), booleans, integers (treated as categorical) or reals (which undergo automatic categorisation; see below for details).
Single vector will be interpreted as a data.frame with one column.
|
Y |
Decision attribute; should be given as a factor, but other options are accepted, exactly like for attributes.
|
threads |
Number of threads to use; default value, 0, means all available to OpenMP. |
A numerical vector with maximal pairwise conditional mutual information scores, with names copied from X
.
The method requires input to be discrete to use empirical estimators of distribution, and, consequently, information gain or entropy.
To allow smoother user experience, praznik automatically coerces non-factor vectors in inputs, which requires additional time, memory and may yield confusing results – the best practice is to convert data to factors prior to feeding them in this function.
Real attributes are cut into about 10 equally-spaced bins, following the heuristic often used in literature.
Precise number of cuts depends on the number of objects; namely, it is , but never less than 2 and never more than 10.
Integers (which technically are also numeric) are treated as categorical variables (for compatibility with similar software), so in a very different way – one should be aware that an actually numeric attribute which happens to be an integer could be coerced into a
-level categorical, which would have a perfect mutual information score and would likely become a very disruptive false positive.
maxCmiScores(iris[,-5],iris$Species)
maxCmiScores(iris[,-5],iris$Species)
Calculates joint mutual information between each joint feature pair with the decision, and yields maximal value for each feature, that is
maxJmiScores(X, Y, threads = 0)
maxJmiScores(X, Y, threads = 0)
X |
Attribute table, given as a data frame with either factors (preferred), booleans, integers (treated as categorical) or reals (which undergo automatic categorisation; see below for details).
Single vector will be interpreted as a data.frame with one column.
|
Y |
Decision attribute; should be given as a factor, but other options are accepted, exactly like for attributes.
|
threads |
Number of threads to use; default value, 0, means all available to OpenMP. |
A numerical vector with maximal pairwise joint mutual information scores, with names copied from X
.
The method requires input to be discrete to use empirical estimators of distribution, and, consequently, information gain or entropy.
To allow smoother user experience, praznik automatically coerces non-factor vectors in inputs, which requires additional time, memory and may yield confusing results – the best practice is to convert data to factors prior to feeding them in this function.
Real attributes are cut into about 10 equally-spaced bins, following the heuristic often used in literature.
Precise number of cuts depends on the number of objects; namely, it is , but never less than 2 and never more than 10.
Integers (which technically are also numeric) are treated as categorical variables (for compatibility with similar software), so in a very different way – one should be aware that an actually numeric attribute which happens to be an integer could be coerced into a
-level categorical, which would have a perfect mutual information score and would likely become a very disruptive false positive.
maxJmiScores(iris[,-5],iris$Species)
maxJmiScores(iris[,-5],iris$Species)
Calculates mutual information between all features and the decision, then returns top k.
MIM(X, Y, k = 3, threads = 0)
MIM(X, Y, k = 3, threads = 0)
X |
Attribute table, given as a data frame with either factors (preferred), booleans, integers (treated as categorical) or reals (which undergo automatic categorisation; see below for details).
Single vector will be interpreted as a data.frame with one column.
|
Y |
Decision attribute; should be given as a factor, but other options are accepted, exactly like for attributes.
|
k |
Number of attributes to select.
Must not exceed |
threads |
Number of threads to use; default value, 0, means all available to OpenMP. |
A list with two elements: selection
, a vector of indices of the selected features in the selection order, and score
, a vector of corresponding feature scores.
Names of both vectors will correspond to the names of features in X
.
Both vectors will be at most of a length k
, as the selection may stop sooner, even during initial selection, in which case both vectors will be empty.
The method requires input to be discrete to use empirical estimators of distribution, and, consequently, information gain or entropy.
To allow smoother user experience, praznik automatically coerces non-factor vectors in inputs, which requires additional time, memory and may yield confusing results – the best practice is to convert data to factors prior to feeding them in this function.
Real attributes are cut into about 10 equally-spaced bins, following the heuristic often used in literature.
Precise number of cuts depends on the number of objects; namely, it is , but never less than 2 and never more than 10.
Integers (which technically are also numeric) are treated as categorical variables (for compatibility with similar software), so in a very different way – one should be aware that an actually numeric attribute which happens to be an integer could be coerced into a
-level categorical, which would have a perfect mutual information score and would likely become a very disruptive false positive.
data(MadelonD) MIM(MadelonD$X,MadelonD$Y,20)
data(MadelonD) MIM(MadelonD$X,MadelonD$Y,20)
Calculates mutual information between each two features, that is
miMatrix(X, zeroDiag = TRUE, threads = 0)
miMatrix(X, zeroDiag = TRUE, threads = 0)
X |
Attribute table, given as a data frame with either factors (preferred), booleans, integers (treated as categorical) or reals (which undergo automatic categorisation; see below for details).
Single vector will be interpreted as a data.frame with one column.
|
zeroDiag |
Boolean flag, whether the diagonal should be filled with zeroes, or with degenerated scores for two identical copies of a feature. |
threads |
Number of threads to use; default value, 0, means all available to OpenMP. |
A numerical matrix with scores, with row and column names copied from X
.
The method requires input to be discrete to use empirical estimators of distribution, and, consequently, information gain or entropy.
To allow smoother user experience, praznik automatically coerces non-factor vectors in inputs, which requires additional time, memory and may yield confusing results – the best practice is to convert data to factors prior to feeding them in this function.
Real attributes are cut into about 10 equally-spaced bins, following the heuristic often used in literature.
Precise number of cuts depends on the number of objects; namely, it is , but never less than 2 and never more than 10.
Integers (which technically are also numeric) are treated as categorical variables (for compatibility with similar software), so in a very different way – one should be aware that an actually numeric attribute which happens to be an integer could be coerced into a
-level categorical, which would have a perfect mutual information score and would likely become a very disruptive false positive.
miMatrix(iris)
miMatrix(iris)
For each feature, calculates the conditional mutual information between this feature and the decision, conditioned on all other features, and returns the minimal value, that is
minCmiScores(X, Y, threads = 0)
minCmiScores(X, Y, threads = 0)
X |
Attribute table, given as a data frame with either factors (preferred), booleans, integers (treated as categorical) or reals (which undergo automatic categorisation; see below for details).
Single vector will be interpreted as a data.frame with one column.
|
Y |
Decision attribute; should be given as a factor, but other options are accepted, exactly like for attributes.
|
threads |
Number of threads to use; default value, 0, means all available to OpenMP. |
A numerical vector with minimal pairwise conditional mutual information scores, with names copied from X
.
The method requires input to be discrete to use empirical estimators of distribution, and, consequently, information gain or entropy.
To allow smoother user experience, praznik automatically coerces non-factor vectors in inputs, which requires additional time, memory and may yield confusing results – the best practice is to convert data to factors prior to feeding them in this function.
Real attributes are cut into about 10 equally-spaced bins, following the heuristic often used in literature.
Precise number of cuts depends on the number of objects; namely, it is , but never less than 2 and never more than 10.
Integers (which technically are also numeric) are treated as categorical variables (for compatibility with similar software), so in a very different way – one should be aware that an actually numeric attribute which happens to be an integer could be coerced into a
-level categorical, which would have a perfect mutual information score and would likely become a very disruptive false positive.
minCmiScores(iris[,-5],iris$Species)
minCmiScores(iris[,-5],iris$Species)
For each feature, calculates the conditional mutual information between this feature and the decision, conditioned on all other features, and returns extreme values, that is
and
minMaxCmiScores(X, Y, threads = 0)
minMaxCmiScores(X, Y, threads = 0)
X |
Attribute table, given as a data frame with either factors (preferred), booleans, integers (treated as categorical) or reals (which undergo automatic categorisation; see below for details).
Single vector will be interpreted as a data.frame with one column.
|
Y |
Decision attribute; should be given as a factor, but other options are accepted, exactly like for attributes.
|
threads |
Number of threads to use; default value, 0, means all available to OpenMP. |
A numerical matrix with minimal (first row) and maximal (second row) pairwise conditional mutual information scores, with names copied from X
.
The method requires input to be discrete to use empirical estimators of distribution, and, consequently, information gain or entropy.
To allow smoother user experience, praznik automatically coerces non-factor vectors in inputs, which requires additional time, memory and may yield confusing results – the best practice is to convert data to factors prior to feeding them in this function.
Real attributes are cut into about 10 equally-spaced bins, following the heuristic often used in literature.
Precise number of cuts depends on the number of objects; namely, it is , but never less than 2 and never more than 10.
Integers (which technically are also numeric) are treated as categorical variables (for compatibility with similar software), so in a very different way – one should be aware that an actually numeric attribute which happens to be an integer could be coerced into a
-level categorical, which would have a perfect mutual information score and would likely become a very disruptive false positive.
minMaxCmiScores(iris[,-5],iris$Species)
minMaxCmiScores(iris[,-5],iris$Species)
Calculates mutual information between each feature and the decision, that is
miScores(X, Y, threads = 0)
miScores(X, Y, threads = 0)
X |
Attribute table, given as a data frame with either factors (preferred), booleans, integers (treated as categorical) or reals (which undergo automatic categorisation; see below for details).
Single vector will be interpreted as a data.frame with one column.
|
Y |
Decision attribute; should be given as a factor, but other options are accepted, exactly like for attributes.
|
threads |
Number of threads to use; default value, 0, means all available to OpenMP. |
A numerical vector with mutual information scores, with names copied from X
.
The method requires input to be discrete to use empirical estimators of distribution, and, consequently, information gain or entropy.
To allow smoother user experience, praznik automatically coerces non-factor vectors in inputs, which requires additional time, memory and may yield confusing results – the best practice is to convert data to factors prior to feeding them in this function.
Real attributes are cut into about 10 equally-spaced bins, following the heuristic often used in literature.
Precise number of cuts depends on the number of objects; namely, it is , but never less than 2 and never more than 10.
Integers (which technically are also numeric) are treated as categorical variables (for compatibility with similar software), so in a very different way – one should be aware that an actually numeric attribute which happens to be an integer could be coerced into a
-level categorical, which would have a perfect mutual information score and would likely become a very disruptive false positive.
miScores(iris[,-5],iris$Species)
miScores(iris[,-5],iris$Species)
The method starts with a feature of a maximal mutual information with the decision .
Then, it greedily adds feature
with a maximal value of the following criterion:
where is the set of already selected features.
MRMR(X, Y, k = if (positive) ncol(X) else 3, positive = FALSE, threads = 0)
MRMR(X, Y, k = if (positive) ncol(X) else 3, positive = FALSE, threads = 0)
X |
Attribute table, given as a data frame with either factors (preferred), booleans, integers (treated as categorical) or reals (which undergo automatic categorisation; see below for details).
Single vector will be interpreted as a data.frame with one column.
|
Y |
Decision attribute; should be given as a factor, but other options are accepted, exactly like for attributes.
|
k |
Number of attributes to select.
Must not exceed |
positive |
If true, algorithm won't return features with negative scores (i.e., with redundancy term higher than the relevance therm).
In that case, |
threads |
Number of threads to use; default value, 0, means all available to OpenMP. |
A list with two elements: selection
, a vector of indices of the selected features in the selection order, and score
, a vector of corresponding feature scores.
Names of both vectors will correspond to the names of features in X
.
Both vectors will be at most of a length k
, as the selection may stop sooner, even during initial selection, in which case both vectors will be empty.
The method requires input to be discrete to use empirical estimators of distribution, and, consequently, information gain or entropy.
To allow smoother user experience, praznik automatically coerces non-factor vectors in inputs, which requires additional time, memory and may yield confusing results – the best practice is to convert data to factors prior to feeding them in this function.
Real attributes are cut into about 10 equally-spaced bins, following the heuristic often used in literature.
Precise number of cuts depends on the number of objects; namely, it is , but never less than 2 and never more than 10.
Integers (which technically are also numeric) are treated as categorical variables (for compatibility with similar software), so in a very different way – one should be aware that an actually numeric attribute which happens to be an integer could be coerced into a
-level categorical, which would have a perfect mutual information score and would likely become a very disruptive false positive.
"Feature Selection Based on Mutual Information: Criteria of Max-Dependency, Max-Relevance, and Min-Redundancy" H. Peng et al. IEEE Pattern Analysis and Machine Intelligence (PAMI) (2005)
data(MadelonD) MRMR(MadelonD$X,MadelonD$Y,20)
data(MadelonD) MRMR(MadelonD$X,MadelonD$Y,20)
The method starts with a feature of a maximal mutual information with the decision .
Then, it greedily adds feature
with a maximal value of the following criterion:
where is the set of already selected features.
NJMIM(X, Y, k = 3, threads = 0)
NJMIM(X, Y, k = 3, threads = 0)
X |
Attribute table, given as a data frame with either factors (preferred), booleans, integers (treated as categorical) or reals (which undergo automatic categorisation; see below for details).
Single vector will be interpreted as a data.frame with one column.
|
Y |
Decision attribute; should be given as a factor, but other options are accepted, exactly like for attributes.
|
k |
Number of attributes to select.
Must not exceed |
threads |
Number of threads to use; default value, 0, means all available to OpenMP. |
A list with two elements: selection
, a vector of indices of the selected features in the selection order, and score
, a vector of corresponding feature scores.
Names of both vectors will correspond to the names of features in X
.
Both vectors will be at most of a length k
, as the selection may stop sooner, even during initial selection, in which case both vectors will be empty.
NJMIM is a normalised version of JMIM
; JMI
and DISR
are modifications of JMIM and NJMIM in which a sum of joint information over already selected features is used instead of a minimum.
It stops returning features when the best score reaches 0.
The method requires input to be discrete to use empirical estimators of distribution, and, consequently, information gain or entropy.
To allow smoother user experience, praznik automatically coerces non-factor vectors in inputs, which requires additional time, memory and may yield confusing results – the best practice is to convert data to factors prior to feeding them in this function.
Real attributes are cut into about 10 equally-spaced bins, following the heuristic often used in literature.
Precise number of cuts depends on the number of objects; namely, it is , but never less than 2 and never more than 10.
Integers (which technically are also numeric) are treated as categorical variables (for compatibility with similar software), so in a very different way – one should be aware that an actually numeric attribute which happens to be an integer could be coerced into a
-level categorical, which would have a perfect mutual information score and would likely become a very disruptive false positive.
"Feature selection using Joint Mutual Information Maximisation" M. Bennasar, Y. Hicks and R. Setchi, (2015)
data(MadelonD) NJMIM(MadelonD$X,MadelonD$Y,20)
data(MadelonD) NJMIM(MadelonD$X,MadelonD$Y,20)
Calculates normalised mutual information between each feature and a joint mix of each other feature with a given feature, that is
njmiMatrix(X, Z, zeroDiag = TRUE, threads = 0)
njmiMatrix(X, Z, zeroDiag = TRUE, threads = 0)
X |
Attribute table, given as a data frame with either factors (preferred), booleans, integers (treated as categorical) or reals (which undergo automatic categorisation; see below for details).
Single vector will be interpreted as a data.frame with one column.
|
Z |
Condition; should be given as a factor, but other options are accepted, as for features. |
zeroDiag |
Boolean flag, whether the diagonal should be filled with zeroes, or with degenerated scores for two identical copies of a feature. |
threads |
Number of threads to use; default value, 0, means all available to OpenMP. |
A numerical matrix with scores, with row and column names copied from X
.
The method requires input to be discrete to use empirical estimators of distribution, and, consequently, information gain or entropy.
To allow smoother user experience, praznik automatically coerces non-factor vectors in inputs, which requires additional time, memory and may yield confusing results – the best practice is to convert data to factors prior to feeding them in this function.
Real attributes are cut into about 10 equally-spaced bins, following the heuristic often used in literature.
Precise number of cuts depends on the number of objects; namely, it is , but never less than 2 and never more than 10.
Integers (which technically are also numeric) are treated as categorical variables (for compatibility with similar software), so in a very different way – one should be aware that an actually numeric attribute which happens to be an integer could be coerced into a
-level categorical, which would have a perfect mutual information score and would likely become a very disruptive false positive.
njmiMatrix(iris[,-5],iris[,5])
njmiMatrix(iris[,-5],iris[,5])
Calculated normalised mutual information between each feature joint with some other vector Z
and the decision, that is
This is the same as in the criterion used by DISR
and NJMIM
.
njmiScores(X, Y, Z, threads = 0)
njmiScores(X, Y, Z, threads = 0)
X |
Attribute table, given as a data frame with either factors (preferred), booleans, integers (treated as categorical) or reals (which undergo automatic categorisation; see below for details).
Single vector will be interpreted as a data.frame with one column.
|
Y |
Decision attribute; should be given as a factor, but other options are accepted, exactly like for attributes.
|
Z |
Other vector; should be given as a factor, but other options are accepted, as for features. |
threads |
Number of threads to use; default value, 0, means all available to OpenMP. |
A numerical vector with the normalised joint mutual information scores, with names copied from X
.
The method requires input to be discrete to use empirical estimators of distribution, and, consequently, information gain or entropy.
To allow smoother user experience, praznik automatically coerces non-factor vectors in inputs, which requires additional time, memory and may yield confusing results – the best practice is to convert data to factors prior to feeding them in this function.
Real attributes are cut into about 10 equally-spaced bins, following the heuristic often used in literature.
Precise number of cuts depends on the number of objects; namely, it is , but never less than 2 and never more than 10.
Integers (which technically are also numeric) are treated as categorical variables (for compatibility with similar software), so in a very different way – one should be aware that an actually numeric attribute which happens to be an integer could be coerced into a
-level categorical, which would have a perfect mutual information score and would likely become a very disruptive false positive.
njmiScores(iris[,-5],iris$Species,iris$Sepal.Length)
njmiScores(iris[,-5],iris$Species,iris$Sepal.Length)
Calculates normalised mutual information between each two features, that is
nmiMatrix(X, zeroDiag = TRUE, threads = 0)
nmiMatrix(X, zeroDiag = TRUE, threads = 0)
X |
Attribute table, given as a data frame with either factors (preferred), booleans, integers (treated as categorical) or reals (which undergo automatic categorisation; see below for details).
Single vector will be interpreted as a data.frame with one column.
|
zeroDiag |
Boolean flag, whether the diagonal should be filled with zeroes, or with degenerated scores for two identical copies of a feature. |
threads |
Number of threads to use; default value, 0, means all available to OpenMP. |
A numerical matrix with scores, with row and column names copied from X
.
The method requires input to be discrete to use empirical estimators of distribution, and, consequently, information gain or entropy.
To allow smoother user experience, praznik automatically coerces non-factor vectors in inputs, which requires additional time, memory and may yield confusing results – the best practice is to convert data to factors prior to feeding them in this function.
Real attributes are cut into about 10 equally-spaced bins, following the heuristic often used in literature.
Precise number of cuts depends on the number of objects; namely, it is , but never less than 2 and never more than 10.
Integers (which technically are also numeric) are treated as categorical variables (for compatibility with similar software), so in a very different way – one should be aware that an actually numeric attribute which happens to be an integer could be coerced into a
-level categorical, which would have a perfect mutual information score and would likely become a very disruptive false positive.
nmiMatrix(iris)
nmiMatrix(iris)
Calculates mutual information of each triple of features, that is
triScores(X, threads = 0)
triScores(X, threads = 0)
X |
Attribute table, given as a data frame with either factors (preferred), booleans, integers (treated as categorical) or reals (which undergo automatic categorisation; see below for details).
Single vector will be interpreted as a data.frame with one column.
|
threads |
Number of threads to use; default value, 0, means all available to OpenMP. |
A data frame with four columns; first three (Var1
, Var2
and Var3
) are names of features, fourth, MI
is the value of the mutual information.
The order of features does not matter, hence only
unique, sorted triples are evaluated.
The method requires input to be discrete to use empirical estimators of distribution, and, consequently, information gain or entropy.
To allow smoother user experience, praznik automatically coerces non-factor vectors in inputs, which requires additional time, memory and may yield confusing results – the best practice is to convert data to factors prior to feeding them in this function.
Real attributes are cut into about 10 equally-spaced bins, following the heuristic often used in literature.
Precise number of cuts depends on the number of objects; namely, it is , but never less than 2 and never more than 10.
Integers (which technically are also numeric) are treated as categorical variables (for compatibility with similar software), so in a very different way – one should be aware that an actually numeric attribute which happens to be an integer could be coerced into a
-level categorical, which would have a perfect mutual information score and would likely become a very disruptive false positive.
In a current version, the maximal number of features accepted is 2345, which gives a bit less than 2^32 triples. The equation used for calculation is
Henceforth, please mind that rounding errors may occur and influence reproducibility.
triScores(iris)
triScores(iris)