Learn R Programming

QuantumClone (version 1.0.0.6)

Precision_Recall: Precision

Description

Computes the precision based on the clustering

Usage

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

Examples

Run this code
# NOT RUN {
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)
# }

Run the code above in your browser using DataLab