node package manager


metric (distance) and other related functions


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


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

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


>> 0.8 // 80% similar