1.0.1 • Published 6 years ago

jaccard-array v1.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

Jaccard

Very simple package for measuring the similarity of two sets by their shared members. The module exports a single function that accepts two arrays of attributes and returns their Jaccard Index.

Installation

$ npm install jaccard-array

Usage

const jaccard = require('jaccard-array');


var setA, setB, similarity;

// find the similarity of two movies based on the people that liked them
setA = ['Sara', 'Tom', 'Steve', 'Peter', 'Allison', 'Anne'];
setB = ['Fred', 'Dan', 'Steve', 'Peter', 'Allison'];

similarity = jaccard(setA, setB);