Skip to content

Instantly share code, notes, and snippets.

@plusplus
Last active December 18, 2015 13:29
Show Gist options
  • Save plusplus/5790169 to your computer and use it in GitHub Desktop.
Save plusplus/5790169 to your computer and use it in GitHub Desktop.
JaquardCoefficient
class JaquardCoefficient
def similarity( x, y )
raise ArgumentError, "Both sets are empty" if x.empty? && y.empty?
return 0.0 if x.empty? || y.empty?
(x & y).size.to_f / (x | y).size.to_f
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment