PermMisClassRate {FeatureImpCluster} | R Documentation |
Permutation misclassification rate for single variable
Description
Answers the following question: Using the current partion as a baseline, what is the misclassification rate if a given feature is permuted?
Usage
PermMisClassRate(
clusterObj,
data,
varName,
basePred = NULL,
predFUN = NULL,
sub = 1,
biter = 5,
seed = 123
)
Arguments
clusterObj |
a "typical" cluster object. The only requirement is that there must be a prediction function which maps the data to an integer |
data |
data.table with the same features as the data set used for clustering (or the simply the same data) |
varName |
character; variable name |
basePred |
should be equal to results of predFUN(clusterObj,newdata=data); this option saves time when data is a very large data set |
predFUN |
predFUN(clusterObj,newdata=data) should provide the cluster assignment as a numeric vector; typically this is a wrapper around a build-in prediction function |
sub |
integer between 0 and 1(=default), indicates that only a subset of the data should be used if <1 |
biter |
the permutation is iterated biter(=5, default) times |
seed |
value for random seed |
Value
vector of length biter with the misclassification rate
Examples
set.seed(123)
dat <- create_random_data(n=1e3)$data # random data
library(flexclust)
res <- kcca(dat,k=4)
PermMisClassRate(res,dat,varName="x")