From b46781a9dc57581f6615e9e523ffc8b2dd29a42b Mon Sep 17 00:00:00 2001 From: Daniel Kostro Date: Thu, 29 Jun 2017 14:09:39 +0200 Subject: [PATCH] rename nbPredicted to total BREAKING CHANGE: nbPredicted accessor was renamed to total --- README.md | 2 +- src/__tests__/test.js | 4 ++-- src/index.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 94e1a71..d6c640e 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ const CM2 = new ConfusionMatrix.fromLabels(trueLabels, predictedLabels); // 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.count); // 6 +console.log(CM2.total); // 6 ``` ## [API Documentation](https://mljs.github.io/confusion-matrix/) diff --git a/src/__tests__/test.js b/src/__tests__/test.js index 93e7580..6f5e562 100644 --- a/src/__tests__/test.js +++ b/src/__tests__/test.js @@ -21,14 +21,14 @@ describe('Confusion Matrix', function () { it('diagonal', function () { const CM = new ConfusionMatrix(diagonal.matrix, diagonal.labels); expect(CM.accuracy).toBe(1); - expect(CM.nbPredicted).toBe(6); + expect(CM.total).toBe(6); expect(CM.getCount(1, 0)).toBe(0); }); it('full', function () { const CM = new ConfusionMatrix(full.matrix, full.labels); expect(CM.accuracy).toBe(10 / 15); - expect(CM.nbPredicted).toBe(15); + expect(CM.total).toBe(15); expect(CM.getCount(1, 0)).toBe(1); }); diff --git a/src/index.js b/src/index.js index 0e3071a..9a9098f 100644 --- a/src/index.js +++ b/src/index.js @@ -83,7 +83,7 @@ class ConfusionMatrix { * Compute the number of predicted observations * @return {number} - The number of predicted observations */ - get nbPredicted() { + get total() { var predicted = 0; for (var i = 0; i < this.matrix.length; i++) { for (var j = 0; j < this.matrix.length; j++) {