external_validity | R Documentation |
External validity indices compare a predicted clustering result with a reference class or gold standard.
ev_nmi(pred.lab, ref.lab, method = "emp")
ev_confmat(pred.lab, ref.lab)
pred.lab |
predicted labels generated by classifier |
ref.lab |
reference labels for the observations |
method |
method of computing the entropy. Can be any one of "emp", "mm", "shrink", or "sg". |
ev_nmi
calculates the normalized mutual information
ev_confmat
calculates a variety of statistics associated with
confusion matrices. Accuracy, Cohen's kappa, and Matthews correlation
coefficient have direct multiclass definitions, whereas all other
metrics use macro-averaging.
ev_nmi
returns the normalized mutual information.
ev_confmat
returns a tibble of the following summary statistics using yardstick::summary.conf_mat()
:
accuracy
: Accuracy
kap
: Cohen's kappa
sens
: Sensitivity
spec
: Specificity
ppv
: Positive predictive value
npv
: Negative predictive value
mcc
: Matthews correlation coefficient
j_index
: Youden's J statistic
bal_accuracy
: Balanced accuracy
detection_prevalence
: Detection prevalence
precision
: alias for ppv
recall
: alias for sens
f_meas
: F Measure
ev_nmi
is adapted from infotheo::mutinformation()
Johnson Liu, Derek Chiu
Strehl A, Ghosh J. Cluster ensembles: a knowledge reuse framework for combining multiple partitions. J. Mach. Learn. Res. 2002;3:583-617.
set.seed(1)
E <- matrix(rep(sample(1:4, 1000, replace = TRUE)), nrow = 100, byrow =
FALSE)
x <- sample(1:4, 100, replace = TRUE)
y <- sample(1:4, 100, replace = TRUE)
ev_nmi(x, y)
ev_confmat(x, y)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.