Package Exports
- ml-confusion-matrix
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ml-confusion-matrix) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
confusion-matrix
Confusion matrix for supervised classification.
Installation
$ npm install --save ml-confusion-matrix
Usage
import ConfusionMatrix from 'ml-confusion-matrix';
const CM1 = new ConfusionMatrix([[13, 2], [10, 5]], ['cat', 'dog']);
// Construct the confusion matrix from the true and the predicted labels
const trueLabels = [0, 1, 0, 1, 1, 0];
const predictedLabels = [1, 1, 1, 1, 0, 0];
const CM2 = new ConfusionMatrix.fromLabels(trueLabels, predictedLabels);
// Compute some derivatives of the confusion matrix
// See API documentation for the complete list
console.log(CM1.accuracy); // 0.6 # (13 + 5) / 30
console.log(CM2.accuracy); // 0.5
console.log(CM2.total); // 6