Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
metric (distance) functions in assorted flavors
JavaScript
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
test
README.md
index.js

README.md

metric

Metric is a set of metric (distance) functions, along with assorted related functions such as similarity and preference functions, with a variety of interfaces.

Metric Functions

.rd1 (x,y)

.rd2 (x,y)

Non Metric, Related functions

.similar (other,self)

other and self are floating point, returns 0 to 1, 1 being the most similar

.similarKey (other, self, key)

other and self are objects, executes similarityFn on the key

example:

john = { score: 24, name: "John Doe" };
bill = { score: 20, name: "Bill Smith" };

var sim = require('metric').similarityFnKey;

console.log(sim(john,bill,'score'));

>> 0.8 // 80% similar
Something went wrong with that request. Please try again.