Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A bunch of distance measures
tree: 658c6cc967

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
ext
lib
spec
.document
.gitignore
LICENSE
README.rdoc
Rakefile
VERSION
distance_measures.gemspec

README.rdoc

Distance Measures

A bunch of distance measures that extend Array.

Install

gem sources -a http://gemcutter.org
sudo gem install distance_measures

How to use

a = [1,1]
b = [2,2]

a.euclidean_distance(b)

a.cosine_similarity(b)

a.jaccard_index(b)

a.jaccard_distance(b)

a.binary_jaccard_index(b)

a.binary_jaccard_distance(b)

a.tanimoto_coefficient(b)

a.haversine_distance(b)

This may or may not be the complete list, best thing is to check the source code.

There are also a couple bonus methods:

a.dot_product(b)

a.sum_of_squares

a.intersection_with(b)

a.union_with(b)

# When your dealing with 1's and 0's
a.binary_intersection_with(b)

a.binary_union_with(b)

Copyright

Copyright © 2010 reddavis. See LICENSE for details.

Something went wrong with that request. Please try again.