Binary classification ratios gathered in one package.
Project description
Binary classification ratios
The package helps computing the quality metrics (ratios) arising in the binary classification. The binary classification is given by the confusion matrix. The confusion matrix is given by number of true positives (TP), true negatives (TN), false positives (FP) and false negatives (FN) generated by an algorithm or procedure.
The ratios are easier to interpret than the confusion matrix.
For example, the Accuracy is given by the ratio of all accurate responses to the
total number of responses
$$ \mathrm{Accuracy} = \frac{\mathrm{TP} + \mathrm{TN}}{\mathrm{TP} + \mathrm{TN} + \mathrm{FP} + \mathrm{FN}}. $$
Another popular ratio is Recall
$$ \mathrm{Recall} = \frac{\mathrm{TP}}{\mathrm{TP} + \mathrm{FN}}. $$
Usage
There is a command-line utility binary-classification-ratios. The utility takes the
optional arguments -tp, -tn, -fp, and -fn,
computes the popular binary-classification ratios such as Accuracy, Recall, Precision and
F1-score and prints them to terminal.
binary-classification-ratios -tp 10 -tn 20 -fp 30 -fn 40
Confusion matrix TP 10 TN 20 FP 30 FN 40
accuracy 0.30000
precision 0.250
recall 0.200
f1-score 0.222
The package is designed to be useful in other Python projects where the elements of the confusion matrix are known
from binary_classification_ratios import BinaryClassificationRatios
ratios = BinaryClassificationRatios(tp=10, tn=20, fp=30, fn=40)
print(ratios.get_summary())
ratios.assert_min(0.9, 0.8, 0.7)
Install
pip install binary-classification-ratios
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file binary_classification_ratios-0.2.1.tar.gz.
File metadata
- Download URL: binary_classification_ratios-0.2.1.tar.gz
- Upload date:
- Size: 51.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2bd2fdedae68beb1bd7618717d15f707424cb4e408fc023d42eb4df7884e4605
|
|
| MD5 |
7611eb8ff89c84509e4b75998c1efb28
|
|
| BLAKE2b-256 |
427782822ac3646894dc1c5a35fcc7162f0e430ef61ac42e243f516ea86781d1
|
File details
Details for the file binary_classification_ratios-0.2.1-py3-none-any.whl.
File metadata
- Download URL: binary_classification_ratios-0.2.1-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7fecf234fb236cbae2fa296a83676949fde48c7ce6719d55bf39a483d97f85f9
|
|
| MD5 |
d653546c43bf0066fb095b954ac78654
|
|
| BLAKE2b-256 |
bc615668c969f31e73458306f6a7eaf7d9da6759d43472b67735b95fd597619a
|