metric

0.0.1 • Public • Published

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

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i metric

      Weekly Downloads

      5

      Version

      0.0.1

      License

      none

      Last publish

      Collaborators

      • rook2pawn