Last active
March 23, 2019 02:27
-
-
Save geotheory/51412cf22240c68afb70046643914075 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jaccard_similarity = function(x, y){ | |
x = unique(x) | |
y = unique(y) | |
if(length(x) + length(y) == 0) return(1) | |
xy = length(intersect(x, y)) | |
xy / (length(x) + length(y) - xy) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment