| consensus_evaluate {diceR} | R Documentation |
Evaluate, trim, and reweigh algorithms
Description
Evaluates algorithms on internal/external validation indices. Poor performing algorithms can be trimmed from the ensemble. The remaining algorithms can be given weights before use in consensus functions.
Usage
consensus_evaluate(
data,
...,
cons.cl = NULL,
ref.cl = NULL,
k.method = NULL,
plot = FALSE,
trim = FALSE,
reweigh = FALSE,
n = 5,
lower = 0,
upper = 1
)
Arguments
data |
data matrix with rows as samples and columns as variables |
... |
any number of objects outputted from |
cons.cl |
matrix of cluster assignments from consensus functions such as
|
ref.cl |
reference class |
k.method |
determines the method to choose k when no reference class is
given. When |
plot |
logical; if |
trim |
logical; if |
reweigh |
logical; if |
n |
an integer specifying the top |
lower |
the lower bound that determines what is ambiguous |
upper |
the upper bound that determines what is ambiguous |
Details
This function always returns internal indices. If ref.cl is not NULL,
external indices are additionally shown. Relevant graphical displays are also
outputted. Algorithms are ranked across internal indices using Rank
Aggregation. Only the top n algorithms are kept, the rest are trimmed.
Value
consensus_evaluate returns a list with the following elements
-
k: ifref.clis notNULL, this is the number of distinct classes in the reference; otherwise the chosenkis determined by the one giving the largest mean PAC across algorithms -
pac: a data frame showing the PAC for each combination of algorithm and cluster size -
ii: a list of data frames for all k showing internal evaluation indices -
ei: a data frame showing external evaluation indices fork -
trim.obj: A list with 4 elements-
alg.keep: algorithms kept -
alg.remove: algorithms removed -
rank.matrix: a matrix of ranked algorithms for every internal evaluation index -
top.list: final order of ranked algorithms -
E.new: A new version of aconsensus_clusterdata object
-
Examples
# Consensus clustering for multiple algorithms
set.seed(911)
x <- matrix(rnorm(500), ncol = 10)
CC <- consensus_cluster(x, nk = 3:4, reps = 10, algorithms = c("ap", "km"),
progress = FALSE)
# Evaluate algorithms on internal/external indices and trim algorithms:
# remove those ranking low on internal indices
set.seed(1)
ref.cl <- sample(1:4, 50, replace = TRUE)
z <- consensus_evaluate(x, CC, ref.cl = ref.cl, n = 1, trim = TRUE)
str(z, max.level = 2)