0.0.5 • Published 4 years ago

ml-roc v0.0.5

Weekly downloads
54
License
MIT
Repository
github
Last release
4 years ago

Receiver Operating Characteristic

NPM version build status Test coverage npm download

A receiver operating characteristic curve, or ROC curve, is a graphical plot that illustrates the diagnostic ability of a binary classifier system as its discrimination threshold is varied.

Installation

$ npm i ml-roc

Usage

import { roc, auc, getLabelsData } from 'ml-roc';

const target = ['class1', 'class1', 'class1', 'class2', 'class2', 'class2'];

const classes = getLabelsData(target);
// console.log(classes);
// [
//     { class: 'class1', value: 0, IDs: [0, 1, 2, 3] },
//     { class: 'class2', value: 1, IDs: [4, 5, 6, 7] },
// ]

const predictionResult = [0.95, 0.15, 0.13, 0.08, 0.93, 0.91, 0.99, 0.12];

const rocCurve = curve(target, predictionResult);

// console.log(rocCurve);

// [
//     {
//     falsePositiveRate: [1, 1, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0],
//     truePositiveRate: [1, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0.6, 0],
//     },
// ]

const areaUnderCurve = auc(rocCurve);
console.log(areaUnderCurve) // 0.5555555555555556

API Documentation

References

License

MIT

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.1

4 years ago