Get unlimited public & private packages + team-based management with npm Teams.Learn more »

jaccard-array

1.0.1 • Public • Published

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);
 

Install

npm i jaccard-array

DownloadsWeekly Downloads

3

Version

1.0.1

License

MIT

Unpacked Size

3.33 kB

Total Files

4

Last publish

Collaborators

  • avatar