Skip to content

Commit

Permalink
rename nbPredicted to total
Browse files Browse the repository at this point in the history
BREAKING CHANGE:
nbPredicted accessor was renamed to total
  • Loading branch information
stropitek committed Jun 29, 2017
1 parent 6f50aa0 commit b46781a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/)
Expand Down
4 changes: 2 additions & 2 deletions src/__tests__/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});

Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down

0 comments on commit b46781a

Please sign in to comment.