Similarity Measure
The Jaccard index/coefficient, aka Intersection over Union is used in computer vision as one of the similarity measures for object detection on images.
Formula
The Jaccard similarity coefficient,aka Intersection over Union (IOU) score:
Binary classification Formula
The same score above can be described as binary classification as well to get an ML algorithm to use it:
And can also be noted in writing as:
true positive / (true positive + false positive + false negative)
- M11 is always the intersection- aka true positive
- M01 is the false positive
- M10 is the false negative
- M00 is not used in the formula as it is the complement
Code Example in R
Calc_Jaccard_Index <- function(vector1, vector2){ Jaccard_Index<(sum(which(vector1==1)%in%which(vector2==1)) / (sum(which(vector1==0)%in%which(vector2==1)) + sum(which(vector1==1)%in%which(vector2==0)) + sum(which(vector1==1)%in%which(vector2==1)))) return(Jaccard_Index) }
Comments are closed, but trackbacks and pingbacks are open.