Module: Minwise
- Defined in:
- lib/minwise.rb,
lib/minwise/minhash.rb,
lib/minwise/version.rb,
ext/minwise/minwise.c
Overview
A Ruby library for generating minwise hashes.
Defined Under Namespace
Constant Summary collapse
- VERSION =
"0.1.0"
Class Method Summary collapse
-
.similarity(set_one, set_two) ⇒ Object
Returns the Jaccard similarity of 2 arrays, a number between 0.0 and 1.0.
Class Method Details
.similarity(set_one, set_two) ⇒ Object
Returns the Jaccard similarity of 2 arrays, a number between 0.0 and 1.0.
The arrays are treated as sets, i.e. duplicate elements in an array are only counted once.
16 17 18 |
# File 'lib/minwise.rb', line 16 def similarity(set_one, set_two) set_one.intersection(set_two).length / set_one.union(set_two).length.to_f end |