Precision_Recall: Precision

Description Usage Arguments Value Examples

View source: R/validation_tools.R

Description

Computes the precision based on the clustering

Usage

1
Precision_Recall(hx, Truth)

Arguments

hx

a numeric vector of cluster selection

Truth

the ground truth for clusters

Value

TP

The number of true positive links

TN

The number of true negative links

FP

The number of false positive links

FN

The number of false negative links

Pr

The precision, defined by Pr = \frac{TP}{TP+FP}

R

The recall, defined by R = \frac{TP}{TP+FN}

F1

The F1 index, defined by F1 = \frac{2\times P \times R}{P + R}

RI

Rand Index, defined by RI = \frac{TP+TN}{TP+TN+FP+FN}

validat

Is positives + negatives equal to total number of links - returns absolute difference if false

list with relevant metrics to evaluate clustering

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
set.seed(123)
#1: Cluster data
FQC<-FlashQC(QuantumClone::Input_Example,conta = c(0,0),Nclus = 2:10)

#2: Compute NMI
Precision_Recall(hx = FQC$cluster,Truth = QuantumClone::Input_Example[[1]]$Chr)

### From Stanford NLP example:
cluster<-c(rep(1,6),rep(2,6),rep(3,5))
truth<-c(rep(1,5),2,
         1,rep(2,4),3,
         rep(1,2),rep(3,3))
Precision_Recall(cluster,truth)

DeveauP/QuantumClone documentation built on Oct. 29, 2021, 8:56 a.m.