Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    stream-jaccardpublic

    stream-jaccard

    calculate jaccard index for two sorted streams of data

    Installing

    npm install stream-jaccard

    Example

    var es = require('event-stream');
    var jaccard = require('stream-jaccard');
     
    // generate two streams 
    function toObject(key){ return { key: key }; }
    var a = es.readArray([1,2,3,4,5,6,7,8,9,10].map(toObject));
    var b = es.readArray([1,2,3,4,5,6].map(toObject));
     
    // calculcate jaccard index and distance for the streams 
    jaccard(a, b, function(err, index, distance){
      console.log(index); // => 0.6 
      console.log(distance); // => 0.4 
    });

    API

    jaccard([key, ]a, b, fn)

    Calculates Jaccard index for sorted streams a and b, using optional property key (defaults to 'key').

    License

    MIT

    Keywords

    none

    install

    npm i stream-jaccard

    Downloadslast 7 days

    3

    version

    0.0.1

    license

    none

    last publish

    collaborators

    • avatar