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"
; // what we expect to getconst relevant = 'relevant1' 'relevant2';// what we actually gotconst retrieved = 'relevant1' 'irrelevant1' 'irrelevant2'; // call the funcconst sentences = ;// results in { precision: 0.3333333333333333, recall: 0.5, f: 0.4 }