precision-recall

1.0.2 • Public • Published

precision-recall

Given two arrays of strings (don't have to be unique), will calculate the precision, recall and f1 values. Returned as an JSON object. If one of the arrays is empty (or falsy), will return { precision: 0, recall: 0, f: 0 }.

  • Install using "npm install precision-recall" or "yarn add precision-recall"
import precisionRecall from 'precision-recall';
 
// what we expect to get
const relevant = ['relevant1', 'relevant2'];
// what we actually got
const retrieved = ['relevant1', 'irrelevant1', 'irrelevant2'];
 
// call the func
const sentences = precisionRecall(relevant, retrieved);
// results in { precision: 0.3333333333333333, recall: 0.5, f: 0.4 }
 

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.2
    2
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.2
    2
  • 1.0.1
    0
  • 1.0.0
    0

Package Sidebar

Install

npm i precision-recall

Weekly Downloads

2

Version

1.0.2

License

ISC

Unpacked Size

53.9 kB

Total Files

5

Last publish

Collaborators

  • toitsss