Skip to content

๐Ÿš€This library aims to facilitate the calculations of several metrics using a multi-dimensional confusion matrix. ๐Ÿ“š Provides a set of features, not only to obtain metrics such as accuracy, precision and f1Score, but also matrix normalization, cloning, and the number of predictions.

License

Notifications You must be signed in to change notification settings

FullExpression/confusion-matrix-stats

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Confusion Matrix Statistics Calculations

production-build production-build production-build

production-build Coverage Branches Coverage Branches Coverage Branches Coverage Branches

As the name suggests, this library aims to facilitate the calculations of several metrics using a multi-dimensional confusion matrix.

Provides a set of feature, not only to obtain matrix such as accuracy, precision and f1Score, but also matrix normalization, cloning, numberOfPredictions, etc.

This library was inspired on scikit-learn confusion-matrix written for python. Our goal is to create the same concept for the javascript world.

๐Ÿ› ๏ธ How to install

Run the following command:

npm install confusion-matrix-stats

๐Ÿ‘ฉโ€๐Ÿ’ป How to use it

You just need to create a new Confusion Matrix instance:

const confusionMatrix = new ConfusionMatrix({
    labels: ["Happiness", "Sadness", "Disgust"], 
    matrix: [[50, 2, 3],
             [8, 50 ,5],
             [2, 5 ,50]]
});

And then, call the function to obtain the desired metric:

// Calculates the accuracy value for the all matrix.
const accuracy = confusionMatrix.accuracy();

For each metric calculation, is possible to define a different configurations in order to fine tune the calculation formula:

// Calculates the f1Score, only for "sadness" class, using the Macro average method.
const labelAccuracy = confusionMatrix.f1Score({ label: "Sadness", average: AverageMethod.Macro});

๐Ÿ‘ฉ๐Ÿปโ€๐Ÿซ Examples

You have in here examples for different languages/frameworks.

๐Ÿ“š Documentation

You can the library documentation here.

๐Ÿค“ Give us your feedback

Please, give us your feedback here! Also, participate in this project using ricardo1992rocha@gmail.com email contact.

Thank you!

About

๐Ÿš€This library aims to facilitate the calculations of several metrics using a multi-dimensional confusion matrix. ๐Ÿ“š Provides a set of features, not only to obtain metrics such as accuracy, precision and f1Score, but also matrix normalization, cloning, and the number of predictions.

Topics

Resources

License

Stars

Watchers

Forks

Packages