https://github.com/ekeuus/precision-recall
JS precision, recall and F1 calculation library
https://github.com/ekeuus/precision-recall
f1 f1-score javascript precision recall recall-probabilities retrieval
Last synced: 5 months ago
JSON representation
JS precision, recall and F1 calculation library
- Host: GitHub
- URL: https://github.com/ekeuus/precision-recall
- Owner: ekeuus
- License: mit
- Created: 2018-04-30T19:17:56.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-05-01T16:02:08.000Z (about 8 years ago)
- Last Synced: 2025-09-26T22:59:49.285Z (9 months ago)
- Topics: f1, f1-score, javascript, precision, recall, recall-probabilities, retrieval
- Language: JavaScript
- Size: 31.3 KB
- Stars: 2
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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"
```javascript
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 }
```