Calculadora de Matriz de Confusão

Acurácia = (TP+TN)/total.
Created by
Renato Passos, Eng. de Software
Reviewed by
Renato Passos, Eng. de Software

Last updated: Apr 18, 2026

Acurácia
0,8500
F1
0,8421

Formula

acc = (TP+TN)/N   ;   F1 = 2PR/(P+R)

About this calculator

The Confusion Matrix Calculator is an online tool that computes performance metrics for classification models. By entering the values of true positives (TP), true negatives (TN), false positives (FP), and false negatives (FN), it automatically calculates accuracy, precision, recall, F1-score, and other relevant measures. Users simply input the four confusion matrix values and get instant numeric results, facilitating the evaluation of machine learning models.

It works based on classic binary classification formulas. Accuracy is calculated as (TP + TN) divided by the total number of samples (N = TP + TN + FP + FN). Precision (P) is TP divided by (TP + FP), and recall (R) is TP divided by (TP + FN). The F1-score is the harmonic mean of precision and recall: F1 = 2 * (P * R) / (P + R). The tool may also compute specificity and error rate, depending on the implementation.

This calculator is useful for data professionals, students, and researchers who need to quickly evaluate a classifier's performance. It can be applied in data science projects, competitions like Kaggle, or analyses of medical diagnosis models, fraud detection, and recommendation systems. By providing clear metrics, it aids in decision-making for model tuning.

Important considerations: The confusion matrix must be filled correctly, especially in imbalanced class problems. Metrics like accuracy can be misleading if one class is much more frequent. In such cases, F1-score and recall are more informative. Additionally, the tool assumes binary classification; for multiclass problems, you need to compute one matrix per class or use macro/micro averaging approaches.

Frequently asked questions

What is a confusion matrix?

It is a table that shows the performance of a classifier, comparing predictions with actual values. Rows represent actual classes and columns predicted classes.

How to calculate the F1-score manually?

First compute precision (TP/(TP+FP)) and recall (TP/(TP+FN)). Then use the formula F1 = 2 * (precision * recall) / (precision + recall).

Does the calculator work for multiclass problems?

Not directly, as it only handles two classes. For multiclass, compute one binary matrix per class (one-vs-rest) and then use the metrics.

Which metric is most important for imbalanced data?

In imbalanced data, accuracy can be misleading. Prefer F1-score, recall, or precision, depending on the cost of errors.

Can I use this calculator for regression?

No, confusion matrices are specific to classification. For regression, use metrics like mean squared error (MSE) or R².

Other Estatistica Descritiva calculators