<div align="center">
<img src="https://github.com/sepandhaghighi/pycm/raw/master/Otherfiles/logo.png" width="550">
<h1>PyCM: Python Confusion Matrix</h1>
<br/>
<a href="https://www.python.org/"><img src="https://img.shields.io/badge/built%20with-Python3-green.svg" alt="built with Python3"></a>
<a href="/Document"><img src="https://img.shields.io/badge/doc-latest-orange.svg"></a>
<a href="https://codecov.io/gh/sepandhaghighi/pycm"><img src="https://codecov.io/gh/sepandhaghighi/pycm/branch/master/graph/badge.svg"></a>
<a href="https://badge.fury.io/py/pycm"><img src="https://badge.fury.io/py/pycm.svg" alt="PyPI version" height="18"></a>
<a href="https://anaconda.org/sepandhaghighi/pycm"><img src="https://anaconda.org/sepandhaghighi/pycm/badges/version.svg"></a>
<a href="https://colab.research.google.com/github/sepandhaghighi/pycm/blob/master"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Document"></a>
<a href="https://discord.com/invite/zqpU2b3J3f"><img src="https://img.shields.io/discord/901883546162065408.svg" alt="Discord Channel"></a>
</div>
## Overview
<p align="justify">
PyCM is a multi-class confusion matrix library written in Python that supports both input data vectors and direct matrix, and a proper tool for post-classification model evaluation that supports most classes and overall statistics parameters.
PyCM is the swiss-army knife of confusion matrices, targeted mainly at data scientists that need a broad array of metrics for predictive models and accurate evaluation of a large variety of classifiers.
</p>
<div align="center">
<img src="https://github.com/sepandhaghighi/pycm/raw/master/Otherfiles/block_diagram.jpg" width="700">
<p>Fig1. ConfusionMatrix Block Diagram</p>
</div>
<table>
<tr>
<td align="center">Open Hub</td>
<td align="center"><a href="https://www.openhub.net/p/pycm"><img src="https://www.openhub.net/p/pycm/widgets/project_thin_badge.gif"></a></td>
</tr>
<tr>
<td align="center">PyPI Counter</td>
<td align="center"><a href="http://pepy.tech/project/pycm"><img src="http://pepy.tech/badge/pycm"></a></td>
</tr>
<tr>
<td align="center">Github Stars</td>
<td align="center"><a href="https://github.com/sepandhaghighi/pycm"><img src="https://img.shields.io/github/stars/sepandhaghighi/pycm.svg?style=social&label=Stars"></a></td>
</tr>
</table>
<table>
<tr>
<td align="center">Branch</td>
<td align="center">master</td>
<td align="center">dev</td>
</tr>
<tr>
<td align="center">CI</td>
<td align="center"><img src="https://github.com/sepandhaghighi/pycm/actions/workflows/test.yml/badge.svg?branch=master"></td>
<td align="center"><img src="https://github.com/sepandhaghighi/pycm/actions/workflows/test.yml/badge.svg?branch=dev"></td>
</tr>
</table>
<table>
<tr>
<td align="center">Code Quality</td>
<td align="center"><a class="badge-align" href="https://www.codacy.com/app/sepand-haghighi/pycm?utm_source=github.com&utm_medium=referral&utm_content=sepandhaghighi/pycm&utm_campaign=Badge_Grade"><img src="https://api.codacy.com/project/badge/Grade/5d9463998a0040d09afc2b80c389365c"/></a></td>
<td align="center"><a href="https://www.codefactor.io/repository/github/sepandhaghighi/pycm/overview/dev"><img src="https://www.codefactor.io/repository/github/sepandhaghighi/pycm/badge/dev" alt="CodeFactor" /></a></td>
<td align="center"><a href="https://codebeat.co/projects/github-com-sepandhaghighi-pycm-dev"><img alt="codebeat badge" src="https://codebeat.co/badges/f6642af1-c343-48c2-bd3e-eee802facf39" /></a></td>
</tr>
</table>
## Installation
⚠️ PyCM 3.9 is the last version to support **Python 3.5**
⚠️ PyCM 2.4 is the last version to support **Python 2.7** & **Python 3.4**
⚠️ Plotting capability requires **Matplotlib (>= 3.0.0)** or **Seaborn (>= 0.9.1)**
### PyPI
- Check [Python Packaging User Guide](https://packaging.python.org/installing/)
- Run `pip install pycm==4.1`
### Source code
- Download [Version 4.1](https://github.com/sepandhaghighi/pycm/archive/v4.1.zip) or [Latest Source](https://github.com/sepandhaghighi/pycm/archive/dev.zip)
- Run `pip install .`
### Conda
- Check [Conda Managing Package](https://conda.io/)
- Update Conda using `conda update conda`
- Run `conda install -c sepandhaghighi pycm`
### MATLAB
- Download and install [MATLAB](https://www.mathworks.com/products/matlab.html) (>=8.5, 64/32 bit)
- Download and install [Python3.x](https://www.python.org/downloads/) (>=3.6, 64/32 bit)
- [x] Select `Add to PATH` option
- [x] Select `Install pip` option
- Run `pip install pycm`
- Configure Python interpreter
```matlab
>> pyversion PYTHON_EXECUTABLE_FULL_PATH
```
- Visit [MATLAB Examples](https://github.com/sepandhaghighi/pycm/tree/master/MATLAB)
## Usage
### From vector
```pycon
>>> from pycm import *
>>> y_actu = [2, 0, 2, 2, 0, 1, 1, 2, 2, 0, 1, 2]
>>> y_pred = [0, 0, 2, 1, 0, 2, 1, 0, 2, 0, 2, 2]
>>> cm = ConfusionMatrix(actual_vector=y_actu, predict_vector=y_pred)
>>> cm.classes
[0, 1, 2]
>>> cm.table
{0: {0: 3, 1: 0, 2: 0}, 1: {0: 0, 1: 1, 2: 2}, 2: {0: 2, 1: 1, 2: 3}}
>>> cm.print_matrix()
Predict 0 1 2
Actual
0 3 0 0
1 0 1 2
2 2 1 3
>>> cm.print_normalized_matrix()
Predict 0 1 2
Actual
0 1.0 0.0 0.0
1 0.0 0.33333 0.66667
2 0.33333 0.16667 0.5
>>> cm.stat(summary=True)
Overall Statistics :
ACC Macro 0.72222
F1 Macro 0.56515
FPR Macro 0.22222
Kappa 0.35484
Overall ACC 0.58333
PPV Macro 0.56667
SOA1(Landis & Koch) Fair
TPR Macro 0.61111
Zero-one Loss 5
Class Statistics :
Classes 0 1 2
ACC(Accuracy) 0.83333 0.75 0.58333
AUC(Area under the ROC curve) 0.88889 0.61111 0.58333
AUCI(AUC value interpretation) Very Good Fair Poor
F1(F1 score - harmonic mean of precision and sensitivity) 0.75 0.4 0.54545
FN(False negative/miss/type 2 error) 0 2 3
FP(False positive/type 1 error/false alarm) 2 1 2
FPR(Fall-out or false positive rate) 0.22222 0.11111 0.33333
N(Condition negative) 9 9 6
P(Condition positive or support) 3 3 6
POP(Population) 12 12 12
PPV(Precision or positive predictive value) 0.6 0.5 0.6
TN(True negative/correct rejection) 7 8 4
TON(Test outcome negative) 7 10 7
TOP(Test outcome positive) 5 2 5
TP(True positive/hit) 3 1 3
TPR(Sensitivity, recall, hit rate, or true positive rate) 1.0 0.33333 0.5
```
### Direct CM
```pycon
>>> from pycm import *
>>> cm2 = ConfusionMatrix(matrix={"Class1": {"Class1": 1, "Class2": 2}, "Class2": {"Class1": 0, "Class2": 5}})
>>> cm2
pycm.ConfusionMatrix(classes: ['Class1', 'Class2'])
>>> cm2.classes
['Class1', 'Class2']
>>> cm2.print_matrix()
Predict Class1 Class2
Actual
Class1 1 2
Class2 0 5
>>> cm2.print_normalized_matrix()
Predict Class1 Class2
Actual
Class1 0.33333 0.66667
Class2 0.0 1.0
>>> cm2.stat(summary=True)
Overall Statistics :
ACC Macro 0.75
F1 Macro 0.66667
FPR Macro 0.33333
Kappa 0.38462
Overall ACC 0.75
PPV Macro 0.85714
SOA1(Landis & Koch) Fair
TPR Macro 0.66667
Zero-one Loss 2
Class Statistics :
Classes Class1 Class2
ACC(Accuracy) 0.75 0.75
AUC(Area under the ROC curve) 0.66667 0.66667
AUCI(AUC value interpretation) Fair Fair
F1(F1 score - harmonic mean of precision and sensitivity) 0.5 0.83333
FN(False negative/miss/type 2 error) 2 0
FP(False positive/type 1 error/false alarm) 0 2
FPR(Fall-out or false positive rate) 0.0 0.66667
N(Condition negative) 5 3
P(Condition positive or support) 3 5
POP(Population) 8 8
PPV(Precision or positive predictive value) 1.0 0.71429
TN(True negative/correct rejection) 5 1
TON(Test outcome negative) 7 1
TOP(Test outcome positive) 1 7
TP(True positive/hit) 1 5
TPR(Sensitivity, recall, hit rate, or true positive rate) 0.33333 1.0
```
* `matrix()` and `normalized_matrix()` renamed to `print_matrix()` and `print_normalized_matrix()` in `version 1.5`
### Activation threshold
`threshold` is added in `version 0.9` for real value prediction.
For more information visit [Example3](http://www.pycm.io/doc/Example3.html "Example3")
### Load from file
`file` is added in `version 0.9.5` in order to load saved confusion matrix with `.obj` format generated by `save_obj` method.
For more information visit [Example4](http://www.pycm.io/doc/Example4.html "Example4")
### Sample weights
`sample_weight` is added in `version 1.2`
For more information visit [Example5](http://www.pycm.io/doc/Example5.html "Example5")
### Transpose
`transpose` is added in `version 1.2` in order to transpose input matrix (only in `Direct CM` mode)
### Relabel
`relabel` method is added in `version 1.5` in order to change ConfusionMatrix classnames.
```pycon
>>> cm.relabel(mapping={0: "L1", 1: "L2", 2: "L3"})
>>> cm
pycm.ConfusionMatrix(classes: ['L1', 'L2', 'L3'])
```
### Position
`position` method is added in `version 2.8` in order to find the indexes of observations in `predict_vector` which made TP, TN, FP, FN.
```pycon
>>> cm.position()
{0: {'FN': [], 'FP': [0, 7], 'TP': [1, 4, 9], 'TN': [2, 3, 5, 6, 8, 10, 11]}, 1: {'FN': [5, 10], 'FP': [3], 'TP': [6], 'TN': [0, 1, 2, 4, 7, 8, 9, 11]}, 2: {'FN': [0, 3, 7], 'FP': [5, 10], 'TP': [2, 8, 11], 'TN': [1, 4, 6, 9]}}
```
### To array
`to_array` method is added in `version 2.9` in order to returns the confusion matrix in the form of a NumPy array. This can be helpful to apply different operations over the confusion matrix for different purposes such as aggregation, normalization, and combination.
```pycon
>>> cm.to_array()
array([[3, 0, 0],
[0, 1, 2],
[2, 1, 3]])
>>> cm.to_array(normalized=True)
array([[1. , 0. , 0. ],
[0. , 0.33333, 0.66667],
[0.33333, 0.16667, 0.5 ]])
>>> cm.to_array(normalized=True, one_vs_all=True, class_name="L1")
array([[1. , 0. ],
[0.22222, 0.77778]])
```
### Combine
`combine` method is added in `version 3.0` in order to merge two confusion matrices. This option will be useful in mini-batch learning.
```pycon
>>> cm_combined = cm2.combine(cm3)
>>> cm_combined.print_matrix()
Predict Class1 Class2
Actual
Class1 2 4
Class2 0 10
```
### Plot
`plot` method is added in `version 3.0` in order to plot a confusion matrix using Matplotlib or Seaborn.
```pycon
>>> cm.plot()
```
<img src="https://github.com/sepandhaghighi/pycm/raw/master/Otherfiles/plot1.png">
```pycon
>>> from matplotlib import pyplot as plt
>>> cm.plot(cmap=plt.cm.Greens, number_label=True, plot_lib="matplotlib")
```
<img src="https://github.com/sepandhaghighi/pycm/raw/master/Otherfiles/plot2.png">
```pycon
>>> cm.plot(cmap=plt.cm.Reds, normalized=True, number_label=True, plot_lib="seaborn")
```
<img src="https://github.com/sepandhaghighi/pycm/raw/master/Otherfiles/plot3.png">
### ROC curve
`ROCCurve`, added in `version 3.7`, is devised to compute the Receiver Operating Characteristic (ROC) or simply ROC curve. In ROC curves, the Y axis represents the True Positive Rate, and the X axis represents the False Positive Rate. Thus, the ideal point is located at the top left of the curve, and a larger area under the curve represents better performance. ROC curve is a graphical representation of binary classifiers' performance. In PyCM, `ROCCurve` binarizes the output based on the "One vs. Rest" strategy to provide an extension of ROC for multi-class classifiers. Getting the actual labels vector, the target probability estimates of the positive classes, and the list of ordered labels of classes, this method is able to compute and plot TPR-FPR pairs for different discrimination thresholds and compute the area under the ROC curve.
```pycon
>>> crv = ROCCurve(actual_vector=np.array([1, 1, 2, 2]), probs=np.array([[0.1, 0.9], [0.4, 0.6], [0.35, 0.65], [0.8, 0.2]]), classes=[2, 1])
>>> crv.thresholds
[0.1, 0.2, 0.35, 0.4, 0.6, 0.65, 0.8, 0.9]
>>> auc_trp = crv.area()
>>> auc_trp[1]
0.75
>>> auc_trp[2]
0.75
```
### Precision-Recall curve
`PRCurve`, added in `version 3.7`, is devised to compute the Precision-Recall curve in which the Y axis represents the Precision, and the X axis represents the Recall of a classifier. Thus, the ideal point is located at the top right of the curve, and a larger area under the curve represents better performance. Precision-Recall curve is a graphical representation of binary classifiers' performance. In PyCM, `PRCurve` binarizes the output based on the "One vs. Rest" strategy to provide an extension of this curve for multi-class classifiers. Getting the actual labels vector, the target probability estimates of the positive classes, and the list of ordered labels of classes, this method is able to compute and plot Precision-Recall pairs for different discrimination thresholds and compute the area under the curve.
```pycon
>>> crv = PRCurve(actual_vector=np.array([1, 1, 2, 2]), probs=np.array([[0.1, 0.9], [0.4, 0.6], [0.35, 0.65], [0.8, 0.2]]), classes=[2, 1])
>>> crv.thresholds
[0.1, 0.2, 0.35, 0.4, 0.6, 0.65, 0.8, 0.9]
>>> auc_trp = crv.area()
>>> auc_trp[1]
0.29166666666666663
>>> auc_trp[2]
0.29166666666666663
```
### Parameter recommender
This option has been added in `version 1.9` to recommend the most related parameters considering the characteristics of the input dataset.
The suggested parameters are selected according to some characteristics of the input such as being balance/imbalance and binary/multi-class.
All suggestions can be categorized into three main groups: imbalanced dataset, binary classification for a balanced dataset, and multi-class classification for a balanced dataset.
The recommendation lists have been gathered according to the respective paper of each parameter and the capabilities which had been claimed by the paper.
```pycon
>>> cm.imbalance
False
>>> cm.binary
False
>>> cm.recommended_list
['MCC', 'TPR Micro', 'ACC', 'PPV Macro', 'BCD', 'Overall MCC', 'Hamming Loss', 'TPR Macro', 'Zero-one Loss', 'ERR', 'PPV Micro', 'Overall ACC']
```
`is_imbalanced` parameter has been added in `version 3.3`, so the user can indicate whether the concerned dataset is imbalanced or not. As long as the user does not provide any information in this regard, the automatic detection algorithm will be used.
```pycon
>>> cm = ConfusionMatrix(y_actu, y_pred, is_imbalanced=True)
>>> cm.imbalance
True
>>> cm = ConfusionMatrix(y_actu, y_pred, is_imbalanced=False)
>>> cm.imbalance
False
```
### Compare
In `version 2.0`, a method for comparing several confusion matrices is introduced. This option is a combination of several overall and class-based benchmarks. Each of the benchmarks evaluates the performance of the classification algorithm from good to poor and give them a numeric score. The score of good and poor performances are 1 and 0, respectively.
After that, two scores are calculated for each confusion matrices, overall and class-based. The overall score is the average of the score of seven overall benchmarks which are Landis & Koch, Cramer, Matthews, Goodman-Kruskal's Lambda A, Goodman-Kruskal's Lambda B, Krippendorff's Alpha, and Pearson's C. In the same manner, the class-based score is the average of the score of six class-based benchmarks which are Positive Likelihood Ratio Interpretation, Negative Likelihood Ratio Interpretation, Discriminant Power Interpretation, AUC value Interpretation, Matthews Correlation Coefficient Interpretation and Yule's Q Interpretation. It should be noticed that if one of the benchmarks returns none for one of the classes, that benchmarks will be eliminated in total averaging. If the user sets weights for the classes, the averaging over the value of class-based benchmark scores will transform to a weighted average.
If the user sets the value of `by_class` boolean input `True`, the best confusion matrix is the one with the maximum class-based score. Otherwise, if a confusion matrix obtains the maximum of both overall and class-based scores, that will be reported as the best confusion matrix, but in any other case, the compared object doesn’t select the best confusion matrix.
```pycon
>>> cm2 = ConfusionMatrix(matrix={0: {0: 2, 1: 50, 2: 6}, 1: {0: 5, 1: 50, 2: 3}, 2: {0: 1, 1: 7, 2: 50}})
>>> cm3 = ConfusionMatrix(matrix={0: {0: 50, 1: 2, 2: 6}, 1: {0: 50, 1: 5, 2: 3}, 2: {0: 1, 1: 55, 2: 2}})
>>> cp = Compare({"cm2": cm2, "cm3": cm3})
>>> print(cp)
Best : cm2
Rank Name Class-Score Overall-Score
1 cm2 0.50278 0.58095
2 cm3 0.33611 0.52857
>>> cp.best
pycm.ConfusionMatrix(classes: [0, 1, 2])
>>> cp.sorted
['cm2', 'cm3']
>>> cp.best_name
'cm2'
```
### Multilabel confusion matrix
From `version 4.0`, `MultiLabelCM` has been added to calculate class-wise or sample-wise multilabel confusion matrices. In class-wise mode, confusion matrices are calculated for each class, and in sample-wise mode, they are generated per sample. All generated confusion matrices are binarized with a one-vs-rest transformation.
```pycon
>>> mlcm = MultiLabelCM(actual_vector=[{"cat", "bird"}, {"dog"}], predict_vector=[{"cat"}, {"dog", "bird"}], classes=["cat", "dog", "bird"])
>>> mlcm.actual_vector_multihot
[[1, 0, 1], [0, 1, 0]]
>>> mlcm.predict_vector_multihot
[[1, 0, 0], [0, 1, 1]]
>>> mlcm.get_cm_by_class("cat").print_matrix()
Predict 0 1
Actual
0 1 0
1 0 1
>>> mlcm.get_cm_by_sample(0).print_matrix()
Predict 0 1
Actual
0 1 0
1 1 1
```
### Online help
`online_help` function is added in `version 1.1` in order to open each statistics definition in web browser
```pycon
>>> from pycm import online_help
>>> online_help("J")
>>> online_help("SOA1(Landis & Koch)")
>>> online_help(2)
```
* List of items are available by calling `online_help()` (without argument)
* If PyCM website is not available, set `alt_link = True` (new in `version 2.4`)
### Screen record
<div align="center">
<a href="https://asciinema.org/a/171863" target="_blank"><img src="https://asciinema.org/a/171863.png"/></a>
</div>
## Try PyCM in your browser!
PyCM can be used online in interactive Jupyter Notebooks via the Binder or Colab services! Try it out now! :
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/sepandhaghighi/pycm/master)
[![Google Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/sepandhaghighi/pycm/blob/master)
* Check `Examples` in `Document` folder
## Issues & bug reports
1. Fill an issue and describe it. We'll check it ASAP!
- Please complete the issue template
2. Discord : [https://discord.com/invite/zqpU2b3J3f](https://discord.com/invite/zqpU2b3J3f)
3. Website : [https://www.pycm.io](https://www.pycm.io)
4. Mailing List : [https://mail.python.org/mailman3/lists/pycm.python.org/](https://mail.python.org/mailman3/lists/pycm.python.org/)
5. Email : [info@pycm.io](mailto:info@pycm.io "info@pycm.io")
## Acknowledgments
[NLnet foundation](https://nlnet.nl) has supported the PyCM project from version **3.6** to **4.0** through the [NGI Assure](https://nlnet.nl/assure) Fund. This fund is set up by [NLnet foundation](https://nlnet.nl) with funding from the European Commission's [Next Generation Internet program](https://ngi.eu), administered by DG Communications Networks, Content, and Technology under grant agreement [**No 957073**](https://nlnet.nl/project/PyCM/).
<a href="https://nlnet.nl"><img src="https://github.com/sepandhaghighi/pycm/raw/master/Otherfiles/NlNet.svg" height="50px" alt="NLnet foundation"></a> <a href="https://nlnet.nl/assure"><img src="https://github.com/sepandhaghighi/pycm/raw/master/Otherfiles/NGIAssure.svg" height="50px" alt="NGI Assure"></a>
[Python Software Foundation (PSF)](https://www.python.org/psf/) grants PyCM library partially for version **3.7**. [PSF](https://www.python.org/psf/) is the organization behind Python. Their mission is to promote, protect, and advance the Python programming language and to support and facilitate the growth of a diverse and international community of Python programmers.
<a href="https://www.python.org/psf/"><img src="https://github.com/sepandhaghighi/pycm/raw/master/Otherfiles/PSF.png" height="55px" alt="Python Software Foundation"></a>
Some parts of the infrastructure for this project are supported by:
<p>
<a href="https://www.digitalocean.com/">
<img src="https://opensource.nyc3.cdn.digitaloceanspaces.com/attribution/assets/SVG/DO_Logo_horizontal_blue.svg" width="201px" alt="DigitalOcean">
</a>
</p>
## Cite
If you use PyCM in your research, we would appreciate citations to the following paper :
<pre>
Haghighi, S., Jasemi, M., Hessabi, S. and Zolanvari, A. (2018). PyCM: Multiclass confusion matrix library in Python. Journal of Open Source Software, 3(25), p.729.
</pre>
<pre>
@article{Haghighi2018,
doi = {10.21105/joss.00729},
url = {https://doi.org/10.21105/joss.00729},
year = {2018},
month = {may},
publisher = {The Open Journal},
volume = {3},
number = {25},
pages = {729},
author = {Sepand Haghighi and Masoomeh Jasemi and Shaahin Hessabi and Alireza Zolanvari},
title = {{PyCM}: Multiclass confusion matrix library in Python},
journal = {Journal of Open Source Software}
}
</pre>
Download [PyCM.bib](http://www.pycm.io/PYCM.bib)
<table>
<tr>
<td align="center">JOSS</td>
<td align="center"><a href="https://doi.org/10.21105/joss.00729"><img src="http://joss.theoj.org/papers/10.21105/joss.00729/status.svg"></a></td>
</tr>
<tr>
<td align="center">Zenodo</td>
<td align="center"><a href="https://doi.org/10.5281/zenodo.1157173"><img src="https://zenodo.org/badge/DOI/10.5281/zenodo.1157173.svg" alt="DOI"></a></td>
</tr>
</table>
## Show your support
### Star this repo
Give a ⭐️ if this project helped you!
### Donate to our project
If you do like our project and we hope that you do, can you please support us? Our project is not and is never going to be working for profit. We need the money just so we can continue doing what we do ;-) .
<a href="http://www.pycm.io/donate.html" target="_blank"><img src="http://www.pycm.io/images/Donate-Button.png" height="90px" width="270px" alt="PyCM Donation"></a>
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
## [Unreleased]
## [4.1] - 2024-10-17
### Added
- 5 new distance/similarity
1. KoppenI
2. KoppenII
3. KuderRichardson
4. KuhnsI
5. KuhnsII
- `feature_request.yml` template
- `config.yml` for issue template
- `SECURITY.md`
### Changed
- Bug report template modified
- `thresholds_calc` function updated
- `__midpoint_numeric_integral__` function updated
- `__trapezoidal_numeric_integral__` function updated
- Diagrams updated
- Document modified
- Document build system updated
- `AUTHORS.md` updated
- `README.md` modified
- Test system modified
- `Python 3.12` added to `test.yml`
- `Python 3.13` added to `test.yml`
- Warning and error messages updated
- `pycm_util.py` renamed to `utils.py`
- `pycm_test.py` renamed to `basic_test.py`
- `pycm_profile.py` renamed to `profile.py`
- `pycm_param.py` renamed to `params.py`
- `pycm_overall_func.py` renamed to `overall_funcs.py`
- `pycm_output.py` renamed to `output.py`
- `pycm_obj.py` renamed to `cm.py`
- `pycm_multilabel_cm.py` renamed to `multilabel_cm.py`
- `pycm_interpret.py` renamed to `interpret.py`
- `pycm_handler.py` renamed to `handlers.py`
- `pycm_error.py` renamed to `errors.py`
- `pycm_distance.py` renamed to `distance.py`
- `pycm_curve.py` renamed to `curve.py`
- `pycm_compare.py` renamed to `compare.py`
- `pycm_class_func.py` renamed to `class_funcs.py`
- `pycm_ci.py` renamed to `ci.py`
## [4.0] - 2023-06-07
### Added
- `pycmMultiLabelError` class
- `MultiLabelCM` class
- `get_cm_by_class` method
- `get_cm_by_sample` method
- `__mlcm_vector_handler__` function
- `__mlcm_assign_classes__` function
- `__mlcm_vectors_filter__` function
- `__set_to_multihot__` function
- `deprecated` function
### Changed
- Document modified
- `README.md` modified
- Example-4 modified
- Test system modified
- Python 3.5 support dropped
## [3.9] - 2023-05-01
### Added
- `OVERALL_PARAMS` dictionary
- `__imbalancement_handler__` function
- `vector_serializer` function
- NPV micro/macro
- `log_loss` method
- 23 new distance/similarity
1. Dennis
2. Digby
3. Dispersion
4. Doolittle
5. Eyraud
6. Fager & McGowan
7. Faith
8. Fleiss-Levin-Paik
9. Forbes I
10. Forbes II
11. Fossum
12. Gilbert & Wells
13. Goodall
14. Goodman & Kruskal's Lambda
15. Goodman & Kruskal Lambda-r
16. Guttman's Lambda A
17. Guttman's Lambda B
18. Hamann
19. Harris & Lahey
20. Hawkins & Dotson
21. Kendall's Tau
22. Kent & Foster I
23. Kent & Foster II
### Changed
- `metrics_off` parameter added to ConfusionMatrix `__init__` method
- `CLASS_PARAMS` changed to a dictionary
- Code style modified
- `sort` parameter added to `relabel` method
- Document modified
- `CONTRIBUTING.md` updated
- `codecov` removed from `dev-requirements.txt`
- Test system modified
## [3.8] - 2023-02-01
### Added
- `distance` method
- `__contains__` method
- `__getitem__` method
- Goodman-Kruskal's Lambda A benchmark
- Goodman-Kruskal's Lambda B benchmark
- Krippendorff's Alpha benchmark
- Pearson's C benchmark
- 30 new distance/similarity
1. AMPLE
2. Anderberg's D
3. Andres & Marzo's Delta
4. Baroni-Urbani & Buser I
5. Baroni-Urbani & Buser II
6. Batagelj & Bren
7. Baulieu I
8. Baulieu II
9. Baulieu III
10. Baulieu IV
11. Baulieu V
12. Baulieu VI
13. Baulieu VII
14. Baulieu VIII
15. Baulieu IX
16. Baulieu X
17. Baulieu XI
18. Baulieu XII
19. Baulieu XIII
20. Baulieu XIV
21. Baulieu XV
22. Benini I
23. Benini II
24. Canberra
25. Clement
26. Consonni & Todeschini I
27. Consonni & Todeschini II
28. Consonni & Todeschini III
29. Consonni & Todeschini IV
30. Consonni & Todeschini V
### Changed
- `relabel` method sort bug fixed
- `README.md` modified
- `Compare` overall benchmarks default weights updated
- Document modified
- Test system modified
## [3.7] - 2022-12-15
### Added
- `Curve` class
- `ROCCurve` class
- `PRCurve` class
- `pycmCurveError` class
### Changed
- `CONTRIBUTING.md` updated
- `matrix_params_calc` function optimized
- `README.md` modified
- Document modified
- Test system modified
- `Python 3.11` added to `test.yml`
## [3.6] - 2022-08-17
### Added
- Hamming distance
- Braun-Blanquet similarity
### Changed
- `classes` parameter added to `matrix_params_from_table` function
- Matrices with `numpy.integer` elements are now accepted
- Arrays added to `matrix` parameter accepting formats
- Website changed to [http://www.pycm.io](http://www.pycm.io)
- Document modified
- `README.md` modified
## [3.5] - 2022-04-27
### Added
- Anaconda workflow
- Custom iterating setting
- Custom casting setting
### Changed
- `plot` method updated
- `class_statistics` function modified
- `overall_statistics` function modified
- `BCD_calc` function modified
- `CONTRIBUTING.md` updated
- `CODE_OF_CONDUCT.md` updated
- Document modified
## [3.4] - 2022-01-26
### Added
- Colab badge
- Discord badge
- `brier_score` method
### Changed
- `J (Jaccard index)` section in `Document.ipynb` updated
- `save_obj` method updated
- `Python 3.10` added to `test.yml`
- Example-3 updated
- Docstrings of the functions updated
- `CONTRIBUTING.md` updated
## [3.3] - 2021-10-27
### Added
- `__compare_weight_handler__` function
### Changed
- `is_imbalanced` parameter added to ConfusionMatrix `__init__` method
- `class_benchmark_weight` and `overall_benchmark_weight` parameters added to Compare `__init__` method
- `statistic_recommend` function modified
- Compare `weight` parameter renamed to `class_weight`
- Document modified
- License updated
- `AUTHORS.md` updated
- `README.md` modified
- Block diagrams updated
## [3.2] - 2021-08-11
### Added
- `classes_filter` function
### Changed
- `classes` parameter added to `matrix_params_calc` function
- `classes` parameter added to `__obj_vector_handler__` function
- `classes` parameter added to ConfusionMatrix `__init__` method
- `name` parameter removed from `html_init` function
- `shortener` parameter added to `html_table` function
- `shortener` parameter added to `save_html` method
- Document modified
- HTML report modified
## [3.1] - 2021-03-11
### Added
- `requirements-splitter.py`
- `sensitivity_index` method
### Changed
- Test system modified
- `overall_statistics` function modified
- HTML report modified
- Document modified
- References format updated
- `CONTRIBUTING.md` updated
## [3.0] - 2020-10-26
### Added
- `plot_test.py`
- `axes_gen` function
- `add_number_label` function
- `plot` method
- `combine` method
- `matrix_combine` function
### Changed
- Document modified
- `README.md` modified
- Example-2 deprecated
- Example-7 deprecated
- Error messages modified
## [2.9] - 2020-09-23
### Added
- `notebook_check.py`
- `to_array` method
- `__copy__` method
- `copy` method
### Changed
- `average` method refactored
## [2.8] - 2020-07-09
### Added
- `label_map` attribute
- `positions` attribute
- `position` method
- Krippendorff's Alpha
- Aickin's Alpha
- `weighted_alpha` method
### Changed
- Single class bug fixed
- `CLASS_NUMBER_ERROR` error type changed to `pycmMatrixError`
- `relabel` method bug fixed
- Document modified
- `README.md` modified
## [2.7] - 2020-05-11
### Added
- `average` method
- `weighted_average` method
- `weighted_kappa` method
- `pycmAverageError` class
- Bangdiwala's B
- MATLAB examples
- Github action
### Changed
- Document modified
- `README.md` modified
- `relabel` method bug fixed
- `sparse_table_print` function bug fixed
- `matrix_check` function bug fixed
- Minor bug in `Compare` class fixed
- Class names mismatch bug fixed
## [2.6] - 2020-03-25
### Added
- `custom_rounder` function
- `complement` function
- `sparse_matrix` attribute
- `sparse_normalized_matrix` attribute
- Net benefit (NB)
- Yule's Q interpretation (QI)
- Adjusted Rand index (ARI)
- TNR micro/macro
- FPR micro/macro
- FNR micro/macro
### Changed
- `sparse` parameter added to `print_matrix`,`print_normalized_matrix` and `save_stat` methods
- `header` parameter added to `save_csv` method
- Handler functions moved to `pycm_handler.py`
- Error objects moved to `pycm_error.py`
- Verified tests references updated
- Verified tests moved to `verified_test.py`
- Test system modified
- `CONTRIBUTING.md` updated
- Namespace optimized
- `README.md` modified
- Document modified
- `print_normalized_matrix` method modified
- `normalized_table_calc` function modified
- `setup.py` modified
- summary mode updated
- Dockerfile updated
- `Python 3.8` added to `.travis.yaml` and `appveyor.yml`
### Removed
- `PC_PI_calc` function
## [2.5] - 2019-10-16
### Added
- `__version__` variable
- Individual classification success index (ICSI)
- Classification success index (CSI)
- Example-8 (Confidence interval)
- `install.sh`
- `autopep8.sh`
- Dockerfile
- `CI` method (supported statistics : `ACC`,`AUC`,`Overall ACC`,`Kappa`,`TPR`,`TNR`,`PPV`,`NPV`,`PLR`,`NLR`,`PRE`)
### Changed
- `test.sh` moved to `.travis` folder
- Python 3.4 support dropped
- Python 2.7 support dropped
- `AUTHORS.md` updated
- `save_stat`,`save_csv` and `save_html` methods Non-ASCII character bug fixed
- Mixed type input vectors bug fixed
- `CONTRIBUTING.md` updated
- Example-3 updated
- `README.md` modified
- Document modified
- `CI` attribute renamed to `CI95`
- `kappa_se_calc` function renamed to `kappa_SE_calc`
- `se_calc` function modified and renamed to `SE_calc`
- CI/SE functions moved to `pycm_ci.py`
- Minor bug in `save_html` method fixed
## [2.4] - 2019-07-31
### Added
- Tversky index (TI)
- Area under the PR curve (AUPR)
- `FUNDING.yml`
### Changed
- `AUC_calc` function modified
- Document modified
- `summary` parameter added to `save_html`,`save_stat`,`save_csv` and `stat` methods
- `sample_weight` bug in `numpy` array format fixed
- Inputs manipulation bug fixed
- Test system modified
- Warning system modified
- `alt_link` parameter added to `save_html` method and `online_help` function
- `Compare` class tests moved to `compare_test.py`
- Warning tests moved to `warning_test.py`
## [2.3] - 2019-06-27
### Added
- Adjusted F-score (AGF)
- Overlap coefficient (OC)
- Otsuka-Ochiai coefficient (OOC)
### Changed
- `save_stat` and `save_vector` parameters added to `save_obj` method
- Document modified
- `README.md` modified
- Parameters recommendation for imbalance dataset modified
- Minor bug in `Compare` class fixed
- `pycm_help` function modified
- Benchmarks color modified
## [2.2] - 2019-05-30
### Added
- Negative likelihood ratio interpretation (NLRI)
- Cramer's benchmark (SOA5)
- Matthews correlation coefficient interpretation (MCCI)
- Matthews's benchmark (SOA6)
- F1 macro
- F1 micro
- Accuracy macro
### Changed
- `Compare` class score calculation modified
- Parameters recommendation for multi-class dataset modified
- Parameters recommendation for imbalance dataset modified
- `README.md` modified
- Document modified
- Logo updated
## [2.1] - 2019-05-06
### Added
- Adjusted geometric mean (AGM)
- Yule's Q (Q)
- `Compare` class and parameters recommendation system block diagrams
### Changed
- Document links bug fixed
- Document modified
## [2.0] - 2019-04-15
### Added
- G-Mean (GM)
- Index of balanced accuracy (IBA)
- Optimized precision (OP)
- Pearson's C (C)
- `Compare` class
- Parameters recommendation warning
- `ConfusionMatrix` equal method
### Changed
- Document modified
- `stat_print` function bug fixed
- `table_print` function bug fixed
- `Beta` parameter renamed to `beta` (`F_calc` function & `F_beta` method)
- Parameters recommendation for imbalance dataset modified
- `normalize` parameter added to `save_html` method
- `pycm_func.py` splitted into `pycm_class_func.py` and `pycm_overall_func.py`
- `vector_filter`,`vector_check`,`class_check` and `matrix_check` functions moved to `pycm_util.py`
- `RACC_calc` and `RACCU_calc` functions exception handler modified
- Docstrings modified
## [1.9] - 2019-02-25
### Added
- Automatic/Manual (AM)
- Bray-Curtis dissimilarity (BCD)
- `CODE_OF_CONDUCT.md`
- `ISSUE_TEMPLATE.md`
- `PULL_REQUEST_TEMPLATE.md`
- `CONTRIBUTING.md`
- X11 color names support for `save_html` method
- Parameters recommendation system
- Warning message for high dimension matrix print
- Interactive notebooks section (binder)
### Changed
- `save_matrix` and `normalize` parameters added to `save_csv` method
- `README.md` modified
- Document modified
- `ConfusionMatrix.__init__` optimized
- Document and examples output files moved to different folders
- Test system modified
- `relabel` method bug fixed
## [1.8] - 2019-01-05
### Added
- Lift score (LS)
- `version_check.py`
### Changed
- `color` parameter added to `save_html` method
- Error messages modified
- Document modified
- Website changed to [http://www.pycm.ir](http://www.pycm.ir)
- Interpretation functions moved to `pycm_interpret.py`
- Utility functions moved to `pycm_util.py`
- Unnecessary `else` and `elif` removed
- `==` changed to `is`
## [1.7] - 2018-12-18
### Added
- Gini index (GI)
- Example-7
- `pycm_profile.py`
### Changed
- `class_name` parameter added to `stat`,`save_stat`,`save_csv` and `save_html` methods
- `overall_param` and `class_param` parameters empty list bug fixed
- `matrix_params_calc`, `matrix_params_from_table` and `vector_filter` functions optimized
- `overall_MCC_calc`, `CEN_misclassification_calc` and `convex_combination` functions optimized
- Document modified
## [1.6] - 2018-12-06
### Added
- AUC value interpretation (AUCI)
- Example-6
- Anaconda cloud package
### Changed
- `overall_param` and `class_param` parameters added to `stat`,`save_stat` and `save_html` methods
- `class_param` parameter added to `save_csv` method
- `_` removed from overall statistics names
- `README.md` modified
- Document modified
## [1.5] - 2018-11-26
### Added
- Relative classifier information (RCI)
- Discriminator power (DP)
- Youden's index (Y)
- Discriminant power interpretation (DPI)
- Positive likelihood ratio interpretation (PLRI)
- `__len__` method
- `relabel` method
- `__class_stat_init__` function
- `__overall_stat_init__` function
- `matrix` attribute as dict
- `normalized_matrix` attribute as dict
- `normalized_table` attribute as dict
### Changed
- `README.md` modified
- Document modified
- `LR+` renamed to `PLR`
- `LR-` renamed to `NLR`
- `normalized_matrix` method renamed to `print_normalized_matrix`
- `matrix` method renamed to `print_matrix`
- `entropy_calc` fixed
- `cross_entropy_calc` fixed
- `conditional_entropy_calc` fixed
- `print_table` bug for large numbers fixed
- JSON key bug in `save_obj` fixed
- `transpose` bug in `save_obj` fixed
- `Python 3.7` added to `.travis.yaml` and `appveyor.yml`
## [1.4] - 2018-11-12
### Added
- Area under curve (AUC)
- AUNU
- AUNP
- Class balance accuracy (CBA)
- Global performance index (RR)
- Overall MCC
- Distance index (dInd)
- Similarity index (sInd)
- `one_vs_all`
- `dev-requirements.txt`
### Changed
- `README.md` modified
- Document modified
- `save_stat` modified
- `requirements.txt` modified
## [1.3] - 2018-10-10
### Added
- Confusion entropy (CEN)
- Overall confusion entropy (Overall CEN)
- Modified confusion entropy (MCEN)
- Overall modified confusion entropy (Overall MCEN)
- Information score (IS)
### Changed
- `README.md` modified
## [1.2] - 2018-10-01
### Added
- No information rate (NIR)
- P-Value
- `sample_weight`
- `transpose`
### Changed
- `README.md` modified
- Key error in some parameters fixed
- `OSX` env added to `.travis.yml`
## [1.1] - 2018-09-08
### Added
- Zero-one loss
- Support
- `online_help` function
### Changed
- `README.md` modified
- `html_table` function modified
- `table_print` function modified
- `normalized_table_print` function modified
## [1.0] - 2018-08-30
### Added
- Hamming loss
### Changed
- `README.md` modified
## [0.9.5] - 2018-07-08
### Added
- Obj load
- Obj save
- Example-4
### Changed
- `README.md` modified
- Block diagram updated
## [0.9] - 2018-06-28
### Added
- Activation threshold
- Example-3
- Jaccard index
- Overall Jaccard index
### Changed
- `README.md` modified
- `setup.py` modified
## [0.8.6] - 2018-05-31
### Added
- Example section in document
- Python 2.7 CI
- JOSS paper pdf
### Changed
- Cite section
- ConfusionMatrix docstring
- round function changed to numpy.around
- `README.md` modified
## [0.8.5] - 2018-05-21
### Added
- Example-1 (Comparison of three different classifiers)
- Example-2 (How to plot via matplotlib)
- JOSS paper
- ConfusionMatrix docstring
### Changed
- Table size in HTML report
- Test system
- `README.md` modified
## [0.8.1] - 2018-03-22
### Added
- Goodman and Kruskal's lambda B
- Goodman and Kruskal's lambda A
- Cross entropy
- Conditional entropy
- Joint entropy
- Reference entropy
- Response entropy
- Kullback-Liebler divergence
- Direct ConfusionMatrix
- Kappa unbiased
- Kappa no prevalence
- Random accuracy unbiased
- `pycmVectorError` class
- `pycmMatrixError` class
- Mutual information
- Support `numpy` arrays
### Changed
- Notebook file updated
### Removed
- `pycmError` class
## [0.7] - 2018-02-26
### Added
- Cramer's V
- 95% confidence interval
- Chi-Squared
- Phi-Squared
- Chi-Squared DF
- Standard error
- Kappa standard error
- Kappa 95% confidence interval
- Cicchetti benchmark
### Changed
- Overall statistics color in HTML report
- Parameters description link in HTML report
## [0.6] - 2018-02-21
### Added
- CSV report
- Changelog
- Output files
- `digit` parameter to `ConfusionMatrix` object
### Changed
- Confusion matrix color in HTML report
- Parameters description link in HTML report
- Capitalize descriptions
## [0.5] - 2018-02-17
### Added
- Scott's pi
- Gwet's AC1
- Bennett S score
- HTML report
## [0.4] - 2018-02-05
### Added
- TPR micro/macro
- PPV micro/macro
- Overall RACC
- Error rate (ERR)
- FBeta score
- F0.5
- F2
- Fleiss benchmark
- Altman benchmark
- Output file(.pycm)
### Changed
- Class with zero item
- Normalized matrix
### Removed
- Kappa and SOA for each class
## [0.3] - 2018-01-27
### Added
- Kappa
- Random accuracy
- Landis and Koch benchmark
- `overall_stat`
## [0.2] - 2018-01-24
### Added
- Population
- Condition positive
- Condition negative
- Test outcome positive
- Test outcome negative
- Prevalence
- G-measure
- Matrix method
- Normalized matrix method
- Params method
### Changed
- `statistic_result` to `class_stat`
- `params` to `stat`
## [0.1] - 2018-01-22
### Added
- ACC
- BM
- DOR
- F1-Score
- FDR
- FNR
- FOR
- FPR
- LR+
- LR-
- MCC
- MK
- NPV
- PPV
- TNR
- TPR
- documents and `README.md`
[Unreleased]: https://github.com/sepandhaghighi/pycm/compare/v4.1...dev
[4.1]: https://github.com/sepandhaghighi/pycm/compare/v4.0...v4.1
[4.0]: https://github.com/sepandhaghighi/pycm/compare/v3.9...v4.0
[3.9]: https://github.com/sepandhaghighi/pycm/compare/v3.8...v3.9
[3.8]: https://github.com/sepandhaghighi/pycm/compare/v3.7...v3.8
[3.7]: https://github.com/sepandhaghighi/pycm/compare/v3.6...v3.7
[3.6]: https://github.com/sepandhaghighi/pycm/compare/v3.5...v3.6
[3.5]: https://github.com/sepandhaghighi/pycm/compare/v3.4...v3.5
[3.4]: https://github.com/sepandhaghighi/pycm/compare/v3.3...v3.4
[3.3]: https://github.com/sepandhaghighi/pycm/compare/v3.2...v3.3
[3.2]: https://github.com/sepandhaghighi/pycm/compare/v3.1...v3.2
[3.1]: https://github.com/sepandhaghighi/pycm/compare/v3.0...v3.1
[3.0]: https://github.com/sepandhaghighi/pycm/compare/v2.9...v3.0
[2.9]: https://github.com/sepandhaghighi/pycm/compare/v2.8...v2.9
[2.8]: https://github.com/sepandhaghighi/pycm/compare/v2.7...v2.8
[2.7]: https://github.com/sepandhaghighi/pycm/compare/v2.6...v2.7
[2.6]: https://github.com/sepandhaghighi/pycm/compare/v2.5...v2.6
[2.5]: https://github.com/sepandhaghighi/pycm/compare/v2.4...v2.5
[2.4]: https://github.com/sepandhaghighi/pycm/compare/v2.3...v2.4
[2.3]: https://github.com/sepandhaghighi/pycm/compare/v2.2...v2.3
[2.2]: https://github.com/sepandhaghighi/pycm/compare/v2.1...v2.2
[2.1]: https://github.com/sepandhaghighi/pycm/compare/v2.0...v2.1
[2.0]: https://github.com/sepandhaghighi/pycm/compare/v1.9...v2.0
[1.9]: https://github.com/sepandhaghighi/pycm/compare/v1.8...v1.9
[1.8]: https://github.com/sepandhaghighi/pycm/compare/v1.7...v1.8
[1.7]: https://github.com/sepandhaghighi/pycm/compare/v1.6...v1.7
[1.6]: https://github.com/sepandhaghighi/pycm/compare/v1.5...v1.6
[1.5]: https://github.com/sepandhaghighi/pycm/compare/v1.4...v1.5
[1.4]: https://github.com/sepandhaghighi/pycm/compare/v1.3...v1.4
[1.3]: https://github.com/sepandhaghighi/pycm/compare/v1.2...v1.3
[1.2]: https://github.com/sepandhaghighi/pycm/compare/v1.1...v1.2
[1.1]: https://github.com/sepandhaghighi/pycm/compare/v1.0...v1.1
[1.0]: https://github.com/sepandhaghighi/pycm/compare/v0.9.5...v1.0
[0.9.5]: https://github.com/sepandhaghighi/pycm/compare/v0.9...v0.9.5
[0.9]: https://github.com/sepandhaghighi/pycm/compare/v0.8.6...v0.9
[0.8.6]: https://github.com/sepandhaghighi/pycm/compare/v0.8.5...v0.8.6
[0.8.5]: https://github.com/sepandhaghighi/pycm/compare/v0.8.1...v0.8.5
[0.8.1]: https://github.com/sepandhaghighi/pycm/compare/v0.7...v0.8.1
[0.7]: https://github.com/sepandhaghighi/pycm/compare/v0.6...v0.7
[0.6]: https://github.com/sepandhaghighi/pycm/compare/v0.5...v0.6
[0.5]: https://github.com/sepandhaghighi/pycm/compare/v0.4...v0.5
[0.4]: https://github.com/sepandhaghighi/pycm/compare/v0.3...v0.4
[0.3]: https://github.com/sepandhaghighi/pycm/compare/v0.2...v0.3
[0.2]: https://github.com/sepandhaghighi/pycm/compare/v0.1...v0.2
[0.1]: https://github.com/sepandhaghighi/pycm/compare/1e238cd...v0.1
Raw data
{
"_id": null,
"home_page": "https://github.com/sepandhaghighi/pycm",
"name": "pycm",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "confusion-matrix python3 python machine_learning ML",
"author": "PyCM Development Team",
"author_email": "info@pycm.io",
"download_url": "https://files.pythonhosted.org/packages/ce/9e/8b8760d62b506e60eb6e3cd46c6394902aa6b42d9367bb3c259227a9629b/pycm-4.1.tar.gz",
"platform": null,
"description": "\n<div align=\"center\">\n<img src=\"https://github.com/sepandhaghighi/pycm/raw/master/Otherfiles/logo.png\" width=\"550\">\n<h1>PyCM: Python Confusion Matrix</h1>\n<br/>\n<a href=\"https://www.python.org/\"><img src=\"https://img.shields.io/badge/built%20with-Python3-green.svg\" alt=\"built with Python3\"></a>\n<a href=\"/Document\"><img src=\"https://img.shields.io/badge/doc-latest-orange.svg\"></a>\n<a href=\"https://codecov.io/gh/sepandhaghighi/pycm\"><img src=\"https://codecov.io/gh/sepandhaghighi/pycm/branch/master/graph/badge.svg\"></a>\n<a href=\"https://badge.fury.io/py/pycm\"><img src=\"https://badge.fury.io/py/pycm.svg\" alt=\"PyPI version\" height=\"18\"></a>\n<a href=\"https://anaconda.org/sepandhaghighi/pycm\"><img src=\"https://anaconda.org/sepandhaghighi/pycm/badges/version.svg\"></a>\n<a href=\"https://colab.research.google.com/github/sepandhaghighi/pycm/blob/master\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Document\"></a>\n<a href=\"https://discord.com/invite/zqpU2b3J3f\"><img src=\"https://img.shields.io/discord/901883546162065408.svg\" alt=\"Discord Channel\"></a>\n</div>\n\n## Overview\n\n<p align=\"justify\">\t\nPyCM is a multi-class confusion matrix library written in Python that supports both input data vectors and direct matrix, and a proper tool for post-classification model evaluation that supports most classes and overall statistics parameters.\nPyCM is the swiss-army knife of confusion matrices, targeted mainly at data scientists that need a broad array of metrics for predictive models and accurate evaluation of a large variety of classifiers.\n\n</p>\n\n<div align=\"center\">\n<img src=\"https://github.com/sepandhaghighi/pycm/raw/master/Otherfiles/block_diagram.jpg\" width=\"700\">\n<p>Fig1. ConfusionMatrix Block Diagram</p>\n</div>\n\n<table>\n\t<tr>\n\t\t<td align=\"center\">Open Hub</td>\n\t\t<td align=\"center\"><a href=\"https://www.openhub.net/p/pycm\"><img src=\"https://www.openhub.net/p/pycm/widgets/project_thin_badge.gif\"></a></td>\n\t</tr>\n\t<tr>\n\t\t<td align=\"center\">PyPI Counter</td>\n\t\t<td align=\"center\"><a href=\"http://pepy.tech/project/pycm\"><img src=\"http://pepy.tech/badge/pycm\"></a></td>\n\t</tr>\n\t<tr>\n\t\t<td align=\"center\">Github Stars</td>\n\t\t<td align=\"center\"><a href=\"https://github.com/sepandhaghighi/pycm\"><img src=\"https://img.shields.io/github/stars/sepandhaghighi/pycm.svg?style=social&label=Stars\"></a></td>\n\t</tr>\n</table>\n\n\n\n<table>\n\t<tr> \n\t\t<td align=\"center\">Branch</td>\n\t\t<td align=\"center\">master</td>\n\t\t<td align=\"center\">dev</td>\n\t</tr>\n <tr>\n\t\t<td align=\"center\">CI</td>\n\t\t<td align=\"center\"><img src=\"https://github.com/sepandhaghighi/pycm/actions/workflows/test.yml/badge.svg?branch=master\"></td>\n\t\t<td align=\"center\"><img src=\"https://github.com/sepandhaghighi/pycm/actions/workflows/test.yml/badge.svg?branch=dev\"></td>\n\t</tr>\n</table>\n\n\n<table>\n\t<tr> \n\t\t<td align=\"center\">Code Quality</td>\n\t\t<td align=\"center\"><a class=\"badge-align\" href=\"https://www.codacy.com/app/sepand-haghighi/pycm?utm_source=github.com&utm_medium=referral&utm_content=sepandhaghighi/pycm&utm_campaign=Badge_Grade\"><img src=\"https://api.codacy.com/project/badge/Grade/5d9463998a0040d09afc2b80c389365c\"/></a></td>\n\t\t<td align=\"center\"><a href=\"https://www.codefactor.io/repository/github/sepandhaghighi/pycm/overview/dev\"><img src=\"https://www.codefactor.io/repository/github/sepandhaghighi/pycm/badge/dev\" alt=\"CodeFactor\" /></a></td>\n\t\t<td align=\"center\"><a href=\"https://codebeat.co/projects/github-com-sepandhaghighi-pycm-dev\"><img alt=\"codebeat badge\" src=\"https://codebeat.co/badges/f6642af1-c343-48c2-bd3e-eee802facf39\" /></a></td>\n\t</tr>\n</table>\n\n## Installation\n\n\u26a0\ufe0f PyCM 3.9 is the last version to support **Python 3.5**\n\n\u26a0\ufe0f PyCM 2.4 is the last version to support **Python 2.7** & **Python 3.4**\n\n\u26a0\ufe0f Plotting capability requires **Matplotlib (>= 3.0.0)** or **Seaborn (>= 0.9.1)**\n\n### PyPI\n\n- Check [Python Packaging User Guide](https://packaging.python.org/installing/)\n- Run `pip install pycm==4.1`\n\n### Source code\n- Download [Version 4.1](https://github.com/sepandhaghighi/pycm/archive/v4.1.zip) or [Latest Source](https://github.com/sepandhaghighi/pycm/archive/dev.zip)\n- Run `pip install .`\n\n### Conda\n\n- Check [Conda Managing Package](https://conda.io/)\n- Update Conda using `conda update conda`\n- Run `conda install -c sepandhaghighi pycm`\n\n### MATLAB\n\n- Download and install [MATLAB](https://www.mathworks.com/products/matlab.html) (>=8.5, 64/32 bit)\n- Download and install [Python3.x](https://www.python.org/downloads/) (>=3.6, 64/32 bit)\n\t- [x] Select `Add to PATH` option\n\t- [x] Select `Install pip` option\n- Run `pip install pycm`\n- Configure Python interpreter\n\n```matlab\n>> pyversion PYTHON_EXECUTABLE_FULL_PATH\n```\n\n- Visit [MATLAB Examples](https://github.com/sepandhaghighi/pycm/tree/master/MATLAB)\n\n## Usage\n\n### From vector\n\n```pycon\n>>> from pycm import *\n>>> y_actu = [2, 0, 2, 2, 0, 1, 1, 2, 2, 0, 1, 2]\n>>> y_pred = [0, 0, 2, 1, 0, 2, 1, 0, 2, 0, 2, 2]\n>>> cm = ConfusionMatrix(actual_vector=y_actu, predict_vector=y_pred)\n>>> cm.classes\n[0, 1, 2]\n>>> cm.table\n{0: {0: 3, 1: 0, 2: 0}, 1: {0: 0, 1: 1, 2: 2}, 2: {0: 2, 1: 1, 2: 3}}\n>>> cm.print_matrix()\nPredict 0 1 2 \nActual\n0 3 0 0 \n\n1 0 1 2 \n\n2 2 1 3 \n\n>>> cm.print_normalized_matrix()\nPredict 0 1 2 \nActual\n0 1.0 0.0 0.0 \n\n1 0.0 0.33333 0.66667 \n\n2 0.33333 0.16667 0.5 \n\n>>> cm.stat(summary=True)\nOverall Statistics : \n\nACC Macro 0.72222\nF1 Macro 0.56515\nFPR Macro 0.22222\nKappa 0.35484\nOverall ACC 0.58333\nPPV Macro 0.56667\nSOA1(Landis & Koch) Fair\nTPR Macro 0.61111\nZero-one Loss 5\n\nClass Statistics :\n\nClasses 0 1 2 \nACC(Accuracy) 0.83333 0.75 0.58333 \nAUC(Area under the ROC curve) 0.88889 0.61111 0.58333 \nAUCI(AUC value interpretation) Very Good Fair Poor \nF1(F1 score - harmonic mean of precision and sensitivity) 0.75 0.4 0.54545 \nFN(False negative/miss/type 2 error) 0 2 3 \nFP(False positive/type 1 error/false alarm) 2 1 2 \nFPR(Fall-out or false positive rate) 0.22222 0.11111 0.33333 \nN(Condition negative) 9 9 6 \nP(Condition positive or support) 3 3 6 \nPOP(Population) 12 12 12 \nPPV(Precision or positive predictive value) 0.6 0.5 0.6 \nTN(True negative/correct rejection) 7 8 4 \nTON(Test outcome negative) 7 10 7 \nTOP(Test outcome positive) 5 2 5 \nTP(True positive/hit) 3 1 3 \nTPR(Sensitivity, recall, hit rate, or true positive rate) 1.0 0.33333 0.5 \n\n```\n\n### Direct CM\n\n```pycon\n>>> from pycm import *\n>>> cm2 = ConfusionMatrix(matrix={\"Class1\": {\"Class1\": 1, \"Class2\": 2}, \"Class2\": {\"Class1\": 0, \"Class2\": 5}})\n>>> cm2\npycm.ConfusionMatrix(classes: ['Class1', 'Class2'])\n>>> cm2.classes\n['Class1', 'Class2']\n>>> cm2.print_matrix()\nPredict Class1 Class2 \nActual\nClass1 1 2 \n\nClass2 0 5 \n\n>>> cm2.print_normalized_matrix()\nPredict Class1 Class2 \nActual\nClass1 0.33333 0.66667 \n\nClass2 0.0 1.0 \n\n>>> cm2.stat(summary=True)\nOverall Statistics : \n\nACC Macro 0.75\nF1 Macro 0.66667\nFPR Macro 0.33333\nKappa 0.38462\nOverall ACC 0.75\nPPV Macro 0.85714\nSOA1(Landis & Koch) Fair\nTPR Macro 0.66667\nZero-one Loss 2\n\nClass Statistics :\n\nClasses Class1 Class2 \nACC(Accuracy) 0.75 0.75 \nAUC(Area under the ROC curve) 0.66667 0.66667 \nAUCI(AUC value interpretation) Fair Fair \nF1(F1 score - harmonic mean of precision and sensitivity) 0.5 0.83333 \nFN(False negative/miss/type 2 error) 2 0 \nFP(False positive/type 1 error/false alarm) 0 2 \nFPR(Fall-out or false positive rate) 0.0 0.66667 \nN(Condition negative) 5 3 \nP(Condition positive or support) 3 5 \nPOP(Population) 8 8 \nPPV(Precision or positive predictive value) 1.0 0.71429 \nTN(True negative/correct rejection) 5 1 \nTON(Test outcome negative) 7 1 \nTOP(Test outcome positive) 1 7 \nTP(True positive/hit) 1 5 \nTPR(Sensitivity, recall, hit rate, or true positive rate) 0.33333 1.0\n \n```\n\n* `matrix()` and `normalized_matrix()` renamed to `print_matrix()` and `print_normalized_matrix()` in `version 1.5`\n\n### Activation threshold\n\n`threshold` is added in `version 0.9` for real value prediction.\nFor more information visit [Example3](http://www.pycm.io/doc/Example3.html \"Example3\")\n\n### Load from file\n\n`file` is added in `version 0.9.5` in order to load saved confusion matrix with `.obj` format generated by `save_obj` method.\n\nFor more information visit [Example4](http://www.pycm.io/doc/Example4.html \"Example4\")\n\n### Sample weights\n\n`sample_weight` is added in `version 1.2`\n\nFor more information visit [Example5](http://www.pycm.io/doc/Example5.html \"Example5\")\n\n### Transpose\n\n`transpose` is added in `version 1.2` in order to transpose input matrix (only in `Direct CM` mode)\n\n### Relabel\n\n`relabel` method is added in `version 1.5` in order to change ConfusionMatrix classnames.\n\n```pycon\n>>> cm.relabel(mapping={0: \"L1\", 1: \"L2\", 2: \"L3\"})\n>>> cm\npycm.ConfusionMatrix(classes: ['L1', 'L2', 'L3'])\n```\n\n### Position\n\n`position` method is added in `version 2.8` in order to find the indexes of observations in `predict_vector` which made TP, TN, FP, FN.\n\n```pycon\n>>> cm.position()\n{0: {'FN': [], 'FP': [0, 7], 'TP': [1, 4, 9], 'TN': [2, 3, 5, 6, 8, 10, 11]}, 1: {'FN': [5, 10], 'FP': [3], 'TP': [6], 'TN': [0, 1, 2, 4, 7, 8, 9, 11]}, 2: {'FN': [0, 3, 7], 'FP': [5, 10], 'TP': [2, 8, 11], 'TN': [1, 4, 6, 9]}}\n```\n\n### To array\n\n`to_array` method is added in `version 2.9` in order to returns the confusion matrix in the form of a NumPy array. This can be helpful to apply different operations over the confusion matrix for different purposes such as aggregation, normalization, and combination.\n\n```pycon\n>>> cm.to_array()\narray([[3, 0, 0],\n [0, 1, 2],\n [2, 1, 3]])\n>>> cm.to_array(normalized=True)\narray([[1. , 0. , 0. ],\n [0. , 0.33333, 0.66667],\n [0.33333, 0.16667, 0.5 ]])\n>>> cm.to_array(normalized=True, one_vs_all=True, class_name=\"L1\")\narray([[1. , 0. ],\n [0.22222, 0.77778]])\n```\n\n### Combine\n\n`combine` method is added in `version 3.0` in order to merge two confusion matrices. This option will be useful in mini-batch learning.\n\n```pycon\n>>> cm_combined = cm2.combine(cm3)\n>>> cm_combined.print_matrix()\nPredict Class1 Class2 \nActual\nClass1 2 4 \n\nClass2 0 10 \n\n```\n\n### Plot\n\n`plot` method is added in `version 3.0` in order to plot a confusion matrix using Matplotlib or Seaborn.\n\n```pycon\n>>> cm.plot()\n```\n\n<img src=\"https://github.com/sepandhaghighi/pycm/raw/master/Otherfiles/plot1.png\">\n\n```pycon\n>>> from matplotlib import pyplot as plt\n>>> cm.plot(cmap=plt.cm.Greens, number_label=True, plot_lib=\"matplotlib\")\n```\n\n<img src=\"https://github.com/sepandhaghighi/pycm/raw/master/Otherfiles/plot2.png\">\t\t\n\n```pycon\n>>> cm.plot(cmap=plt.cm.Reds, normalized=True, number_label=True, plot_lib=\"seaborn\")\n```\n\n<img src=\"https://github.com/sepandhaghighi/pycm/raw/master/Otherfiles/plot3.png\">\n\n### ROC curve\n\n`ROCCurve`, added in `version 3.7`, is devised to compute the Receiver Operating Characteristic (ROC) or simply ROC curve. In ROC curves, the Y axis represents the True Positive Rate, and the X axis represents the False Positive Rate. Thus, the ideal point is located at the top left of the curve, and a larger area under the curve represents better performance. ROC curve is a graphical representation of binary classifiers' performance. In PyCM, `ROCCurve` binarizes the output based on the \"One vs. Rest\" strategy to provide an extension of ROC for multi-class classifiers. Getting the actual labels vector, the target probability estimates of the positive classes, and the list of ordered labels of classes, this method is able to compute and plot TPR-FPR pairs for different discrimination thresholds and compute the area under the ROC curve.\n\n```pycon\n>>> crv = ROCCurve(actual_vector=np.array([1, 1, 2, 2]), probs=np.array([[0.1, 0.9], [0.4, 0.6], [0.35, 0.65], [0.8, 0.2]]), classes=[2, 1])\n>>> crv.thresholds\n[0.1, 0.2, 0.35, 0.4, 0.6, 0.65, 0.8, 0.9]\n>>> auc_trp = crv.area()\n>>> auc_trp[1]\n0.75\n>>> auc_trp[2]\n0.75\n```\n\n### Precision-Recall curve\n\n`PRCurve`, added in `version 3.7`, is devised to compute the Precision-Recall curve in which the Y axis represents the Precision, and the X axis represents the Recall of a classifier. Thus, the ideal point is located at the top right of the curve, and a larger area under the curve represents better performance. Precision-Recall curve is a graphical representation of binary classifiers' performance. In PyCM, `PRCurve` binarizes the output based on the \"One vs. Rest\" strategy to provide an extension of this curve for multi-class classifiers. Getting the actual labels vector, the target probability estimates of the positive classes, and the list of ordered labels of classes, this method is able to compute and plot Precision-Recall pairs for different discrimination thresholds and compute the area under the curve.\n\n```pycon\n>>> crv = PRCurve(actual_vector=np.array([1, 1, 2, 2]), probs=np.array([[0.1, 0.9], [0.4, 0.6], [0.35, 0.65], [0.8, 0.2]]), classes=[2, 1])\n>>> crv.thresholds\n[0.1, 0.2, 0.35, 0.4, 0.6, 0.65, 0.8, 0.9]\n>>> auc_trp = crv.area()\n>>> auc_trp[1]\n0.29166666666666663\n>>> auc_trp[2]\n0.29166666666666663\n```\n\n### Parameter recommender\n\nThis option has been added in `version 1.9` to recommend the most related parameters considering the characteristics of the input dataset.\nThe suggested parameters are selected according to some characteristics of the input such as being balance/imbalance and binary/multi-class.\nAll suggestions can be categorized into three main groups: imbalanced dataset, binary classification for a balanced dataset, and multi-class classification for a balanced dataset.\nThe recommendation lists have been gathered according to the respective paper of each parameter and the capabilities which had been claimed by the paper.\n\n```pycon\n>>> cm.imbalance\nFalse\n>>> cm.binary\nFalse\n>>> cm.recommended_list\n['MCC', 'TPR Micro', 'ACC', 'PPV Macro', 'BCD', 'Overall MCC', 'Hamming Loss', 'TPR Macro', 'Zero-one Loss', 'ERR', 'PPV Micro', 'Overall ACC']\n\n```\n\n`is_imbalanced` parameter has been added in `version 3.3`, so the user can indicate whether the concerned dataset is imbalanced or not. As long as the user does not provide any information in this regard, the automatic detection algorithm will be used.\n\n```pycon\n>>> cm = ConfusionMatrix(y_actu, y_pred, is_imbalanced=True)\n>>> cm.imbalance\nTrue\n>>> cm = ConfusionMatrix(y_actu, y_pred, is_imbalanced=False)\n>>> cm.imbalance\nFalse\n```\n\n### Compare\n\nIn `version 2.0`, a method for comparing several confusion matrices is introduced. This option is a combination of several overall and class-based benchmarks. Each of the benchmarks evaluates the performance of the classification algorithm from good to poor and give them a numeric score. The score of good and poor performances are 1 and 0, respectively.\n\nAfter that, two scores are calculated for each confusion matrices, overall and class-based. The overall score is the average of the score of seven overall benchmarks which are Landis & Koch, Cramer, Matthews, Goodman-Kruskal's Lambda A, Goodman-Kruskal's Lambda B, Krippendorff's Alpha, and Pearson's C. In the same manner, the class-based score is the average of the score of six class-based benchmarks which are Positive Likelihood Ratio Interpretation, Negative Likelihood Ratio Interpretation, Discriminant Power Interpretation, AUC value Interpretation, Matthews Correlation Coefficient Interpretation and Yule's Q Interpretation. It should be noticed that if one of the benchmarks returns none for one of the classes, that benchmarks will be eliminated in total averaging. If the user sets weights for the classes, the averaging over the value of class-based benchmark scores will transform to a weighted average.\n\nIf the user sets the value of `by_class` boolean input `True`, the best confusion matrix is the one with the maximum class-based score. Otherwise, if a confusion matrix obtains the maximum of both overall and class-based scores, that will be reported as the best confusion matrix, but in any other case, the compared object doesn\u2019t select the best confusion matrix.\n\n```pycon\n>>> cm2 = ConfusionMatrix(matrix={0: {0: 2, 1: 50, 2: 6}, 1: {0: 5, 1: 50, 2: 3}, 2: {0: 1, 1: 7, 2: 50}})\n>>> cm3 = ConfusionMatrix(matrix={0: {0: 50, 1: 2, 2: 6}, 1: {0: 50, 1: 5, 2: 3}, 2: {0: 1, 1: 55, 2: 2}})\n>>> cp = Compare({\"cm2\": cm2, \"cm3\": cm3})\n>>> print(cp)\nBest : cm2\n\nRank Name Class-Score Overall-Score\n1 cm2 0.50278 0.58095\n2 cm3 0.33611 0.52857\n\n>>> cp.best\npycm.ConfusionMatrix(classes: [0, 1, 2])\n>>> cp.sorted\n['cm2', 'cm3']\n>>> cp.best_name\n'cm2'\n```\n\n### Multilabel confusion matrix\n\nFrom `version 4.0`, `MultiLabelCM` has been added to calculate class-wise or sample-wise multilabel confusion matrices. In class-wise mode, confusion matrices are calculated for each class, and in sample-wise mode, they are generated per sample. All generated confusion matrices are binarized with a one-vs-rest transformation.\n\n```pycon\n>>> mlcm = MultiLabelCM(actual_vector=[{\"cat\", \"bird\"}, {\"dog\"}], predict_vector=[{\"cat\"}, {\"dog\", \"bird\"}], classes=[\"cat\", \"dog\", \"bird\"])\n>>> mlcm.actual_vector_multihot\n[[1, 0, 1], [0, 1, 0]]\n>>> mlcm.predict_vector_multihot\n[[1, 0, 0], [0, 1, 1]]\n>>> mlcm.get_cm_by_class(\"cat\").print_matrix()\nPredict 0 1 \nActual\n0 1 0 \n\n1 0 1 \n\n>>> mlcm.get_cm_by_sample(0).print_matrix()\nPredict 0 1 \nActual\n0 1 0 \n\n1 1 1 \n\n```\n\n### Online help\n\n`online_help` function is added in `version 1.1` in order to open each statistics definition in web browser\n\n```pycon\n>>> from pycm import online_help\n>>> online_help(\"J\")\n>>> online_help(\"SOA1(Landis & Koch)\")\n>>> online_help(2)\n```\n\n* List of items are available by calling `online_help()` (without argument)\n* If PyCM website is not available, set `alt_link = True` (new in `version 2.4`)\n\n### Screen record\n\n<div align=\"center\">\n<a href=\"https://asciinema.org/a/171863\" target=\"_blank\"><img src=\"https://asciinema.org/a/171863.png\"/></a>\n</div>\n\n## Try PyCM in your browser!\n\nPyCM can be used online in interactive Jupyter Notebooks via the Binder or Colab services! Try it out now! :\n\n[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/sepandhaghighi/pycm/master)\n\n[![Google Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/sepandhaghighi/pycm/blob/master)\n\n* Check `Examples` in `Document` folder\n\n## Issues & bug reports\n\n1. Fill an issue and describe it. We'll check it ASAP!\n - Please complete the issue template\n2. Discord : [https://discord.com/invite/zqpU2b3J3f](https://discord.com/invite/zqpU2b3J3f)\n3. Website : [https://www.pycm.io](https://www.pycm.io)\n4. Mailing List : [https://mail.python.org/mailman3/lists/pycm.python.org/](https://mail.python.org/mailman3/lists/pycm.python.org/)\n5. Email : [info@pycm.io](mailto:info@pycm.io \"info@pycm.io\")\n\n## Acknowledgments\n\n[NLnet foundation](https://nlnet.nl) has supported the PyCM project from version **3.6** to **4.0** through the [NGI Assure](https://nlnet.nl/assure) Fund. This fund is set up by [NLnet foundation](https://nlnet.nl) with funding from the European Commission's [Next Generation Internet program](https://ngi.eu), administered by DG Communications Networks, Content, and Technology under grant agreement [**No 957073**](https://nlnet.nl/project/PyCM/).\n\n<a href=\"https://nlnet.nl\"><img src=\"https://github.com/sepandhaghighi/pycm/raw/master/Otherfiles/NlNet.svg\" height=\"50px\" alt=\"NLnet foundation\"></a> <a href=\"https://nlnet.nl/assure\"><img src=\"https://github.com/sepandhaghighi/pycm/raw/master/Otherfiles/NGIAssure.svg\" height=\"50px\" alt=\"NGI Assure\"></a>\n\n[Python Software Foundation (PSF)](https://www.python.org/psf/) grants PyCM library partially for version **3.7**. [PSF](https://www.python.org/psf/) is the organization behind Python. Their mission is to promote, protect, and advance the Python programming language and to support and facilitate the growth of a diverse and international community of Python programmers.\n\n<a href=\"https://www.python.org/psf/\"><img src=\"https://github.com/sepandhaghighi/pycm/raw/master/Otherfiles/PSF.png\" height=\"55px\" alt=\"Python Software Foundation\"></a>\n\nSome parts of the infrastructure for this project are supported by:\n<p>\n <a href=\"https://www.digitalocean.com/\">\n <img src=\"https://opensource.nyc3.cdn.digitaloceanspaces.com/attribution/assets/SVG/DO_Logo_horizontal_blue.svg\" width=\"201px\" alt=\"DigitalOcean\">\n </a>\n</p>\n\n## Cite\n\nIf you use PyCM in your research, we would appreciate citations to the following paper :\n\n<pre>\nHaghighi, S., Jasemi, M., Hessabi, S. and Zolanvari, A. (2018). PyCM: Multiclass confusion matrix library in Python. Journal of Open Source Software, 3(25), p.729.\n</pre>\n<pre>\n\n@article{Haghighi2018,\n doi = {10.21105/joss.00729},\n url = {https://doi.org/10.21105/joss.00729},\n year = {2018},\n month = {may},\n publisher = {The Open Journal},\n volume = {3},\n number = {25},\n pages = {729},\n author = {Sepand Haghighi and Masoomeh Jasemi and Shaahin Hessabi and Alireza Zolanvari},\n title = {{PyCM}: Multiclass confusion matrix library in Python},\n journal = {Journal of Open Source Software}\n}\n\n</pre>\n\nDownload [PyCM.bib](http://www.pycm.io/PYCM.bib)\n\n<table>\n\t<tr> \n\t\t<td align=\"center\">JOSS</td>\n\t\t<td align=\"center\"><a href=\"https://doi.org/10.21105/joss.00729\"><img src=\"http://joss.theoj.org/papers/10.21105/joss.00729/status.svg\"></a></td>\n\t</tr>\n\t<tr>\n\t\t<td align=\"center\">Zenodo</td>\n\t\t<td align=\"center\"><a href=\"https://doi.org/10.5281/zenodo.1157173\"><img src=\"https://zenodo.org/badge/DOI/10.5281/zenodo.1157173.svg\" alt=\"DOI\"></a></td>\n\t</tr>\n</table>\n\n## Show your support\n\n### Star this repo\n\nGive a \u2b50\ufe0f if this project helped you!\n\n### Donate to our project\n\nIf you do like our project and we hope that you do, can you please support us? Our project is not and is never going to be working for profit. We need the money just so we can continue doing what we do ;-) .\n\n<a href=\"http://www.pycm.io/donate.html\" target=\"_blank\"><img src=\"http://www.pycm.io/images/Donate-Button.png\" height=\"90px\" width=\"270px\" alt=\"PyCM Donation\"></a>\n\n# Changelog\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)\nand this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).\n\n## [Unreleased]\n## [4.1] - 2024-10-17\n### Added\n- 5 new distance/similarity\n\t1. KoppenI\n\t2. KoppenII\n\t3. KuderRichardson\n\t4. KuhnsI\n\t5. KuhnsII\n- `feature_request.yml` template\n- `config.yml` for issue template\n- `SECURITY.md`\n### Changed\n- Bug report template modified\n- `thresholds_calc` function updated\n- `__midpoint_numeric_integral__` function updated\n- `__trapezoidal_numeric_integral__` function updated\n- Diagrams updated\n- Document modified\n- Document build system updated\n- `AUTHORS.md` updated\n- `README.md` modified\n- Test system modified\n- `Python 3.12` added to `test.yml`\n- `Python 3.13` added to `test.yml`\n- Warning and error messages updated\n- `pycm_util.py` renamed to `utils.py`\n- `pycm_test.py` renamed to `basic_test.py`\n- `pycm_profile.py` renamed to `profile.py`\n- `pycm_param.py` renamed to `params.py`\n- `pycm_overall_func.py` renamed to `overall_funcs.py`\n- `pycm_output.py` renamed to `output.py`\n- `pycm_obj.py` renamed to `cm.py`\n- `pycm_multilabel_cm.py` renamed to `multilabel_cm.py`\n- `pycm_interpret.py` renamed to `interpret.py`\n- `pycm_handler.py` renamed to `handlers.py`\n- `pycm_error.py` renamed to `errors.py`\n- `pycm_distance.py` renamed to `distance.py`\n- `pycm_curve.py` renamed to `curve.py`\n- `pycm_compare.py` renamed to `compare.py`\n- `pycm_class_func.py` renamed to `class_funcs.py`\n- `pycm_ci.py` renamed to `ci.py`\n## [4.0] - 2023-06-07\n### Added\n- `pycmMultiLabelError` class\n- `MultiLabelCM` class\n- `get_cm_by_class` method\n- `get_cm_by_sample` method\n- `__mlcm_vector_handler__` function\n- `__mlcm_assign_classes__` function\n- `__mlcm_vectors_filter__` function\n- `__set_to_multihot__` function\n- `deprecated` function\n### Changed\n- Document modified\n- `README.md` modified\n- Example-4 modified\n- Test system modified\n- Python 3.5 support dropped\n## [3.9] - 2023-05-01\n### Added\n- `OVERALL_PARAMS` dictionary\n- `__imbalancement_handler__` function\n- `vector_serializer` function\n- NPV micro/macro\n- `log_loss` method\n- 23 new distance/similarity\n\t1. Dennis \n\t2. Digby\n\t3. Dispersion\n\t4. Doolittle\n\t5. Eyraud\n\t6. Fager & McGowan\n\t7. Faith\n\t8. Fleiss-Levin-Paik\n\t9. Forbes I\n\t10. Forbes II\n\t11. Fossum\n\t12. Gilbert & Wells\n\t13. Goodall\n\t14. Goodman & Kruskal's Lambda\n\t15. Goodman & Kruskal Lambda-r\n\t16. Guttman's Lambda A\n\t17. Guttman's Lambda B\n\t18. Hamann\n\t19. Harris & Lahey\n\t20. Hawkins & Dotson\n\t21. Kendall's Tau\n\t22. Kent & Foster I\n\t23. Kent & Foster II\n### Changed\n- `metrics_off` parameter added to ConfusionMatrix `__init__` method\n- `CLASS_PARAMS` changed to a dictionary\n- Code style modified\n- `sort` parameter added to `relabel` method\n- Document modified\n- `CONTRIBUTING.md` updated\n- `codecov` removed from `dev-requirements.txt`\n- Test system modified\n## [3.8] - 2023-02-01\n### Added\n- `distance` method\n- `__contains__` method\n- `__getitem__` method\n- Goodman-Kruskal's Lambda A benchmark\n- Goodman-Kruskal's Lambda B benchmark\n- Krippendorff's Alpha benchmark\n- Pearson's C benchmark\n- 30 new distance/similarity\n\t1. AMPLE\n\t2. Anderberg's D\n\t3. Andres & Marzo's Delta\n\t4. Baroni-Urbani & Buser I\n\t5. Baroni-Urbani & Buser II\n\t6. Batagelj & Bren\n\t7. Baulieu I\n\t8. Baulieu II\n\t9. Baulieu III\n\t10. Baulieu IV\n\t11. Baulieu V\n\t12. Baulieu VI\n\t13. Baulieu VII\n\t14. Baulieu VIII\n\t15. Baulieu IX\n\t16. Baulieu X\n\t17. Baulieu XI\n\t18. Baulieu XII\n\t19. Baulieu XIII\n\t20. Baulieu XIV\n\t21. Baulieu XV\n\t22. Benini I\n\t23. Benini II\n\t24. Canberra\n\t25. Clement\n\t26. Consonni & Todeschini I\n\t27. Consonni & Todeschini II\n\t28. Consonni & Todeschini III\n\t29. Consonni & Todeschini IV\n\t30. Consonni & Todeschini V\n### Changed\n- `relabel` method sort bug fixed\n- `README.md` modified\n- `Compare` overall benchmarks default weights updated\n- Document modified\n- Test system modified\n## [3.7] - 2022-12-15\n### Added\n- `Curve` class\n- `ROCCurve` class\n- `PRCurve` class\n- `pycmCurveError` class\n### Changed\n- `CONTRIBUTING.md` updated\n- `matrix_params_calc` function optimized\n- `README.md` modified\n- Document modified\n- Test system modified\n- `Python 3.11` added to `test.yml`\n## [3.6] - 2022-08-17\n### Added\n- Hamming distance\n- Braun-Blanquet similarity\n### Changed\n- `classes` parameter added to `matrix_params_from_table` function\n- Matrices with `numpy.integer` elements are now accepted\n- Arrays added to `matrix` parameter accepting formats\n- Website changed to [http://www.pycm.io](http://www.pycm.io)\n- Document modified\n- `README.md` modified\n## [3.5] - 2022-04-27\n### Added\n- Anaconda workflow\n- Custom iterating setting\n- Custom casting setting\n### Changed\n- `plot` method updated\n- `class_statistics` function modified\n- `overall_statistics` function modified \n- `BCD_calc` function modified\n- `CONTRIBUTING.md` updated\n- `CODE_OF_CONDUCT.md` updated\n- Document modified\n## [3.4] - 2022-01-26\n### Added\n- Colab badge\n- Discord badge\n- `brier_score` method\n### Changed\n- `J (Jaccard index)` section in `Document.ipynb` updated\n- `save_obj` method updated\n- `Python 3.10` added to `test.yml`\n- Example-3 updated\n- Docstrings of the functions updated\n- `CONTRIBUTING.md` updated\n## [3.3] - 2021-10-27\n### Added\n- `__compare_weight_handler__` function\n### Changed\n- `is_imbalanced` parameter added to ConfusionMatrix `__init__` method\n- `class_benchmark_weight` and `overall_benchmark_weight` parameters added to Compare `__init__` method\n- `statistic_recommend` function modified\n- Compare `weight` parameter renamed to `class_weight`\n- Document modified\n- License updated\n- `AUTHORS.md` updated\n- `README.md` modified\n- Block diagrams updated\n## [3.2] - 2021-08-11\n### Added\n- `classes_filter` function\n### Changed\n- `classes` parameter added to `matrix_params_calc` function\n- `classes` parameter added to `__obj_vector_handler__` function\n- `classes` parameter added to ConfusionMatrix `__init__` method\n- `name` parameter removed from `html_init` function\n- `shortener` parameter added to `html_table` function\n- `shortener` parameter added to `save_html` method\n- Document modified\n- HTML report modified\n## [3.1] - 2021-03-11\n### Added\n- `requirements-splitter.py`\n- `sensitivity_index` method\n### Changed\n- Test system modified\n- `overall_statistics` function modified\n- HTML report modified\n- Document modified\n- References format updated\n- `CONTRIBUTING.md` updated\n## [3.0] - 2020-10-26\n### Added\n- `plot_test.py`\n- `axes_gen` function\n- `add_number_label` function\n- `plot` method\n- `combine` method\n- `matrix_combine` function\n### Changed\n- Document modified\n- `README.md` modified\n- Example-2 deprecated\n- Example-7 deprecated\n- Error messages modified\n## [2.9] - 2020-09-23\n### Added\n- `notebook_check.py`\n- `to_array` method\n- `__copy__` method\n- `copy` method\n### Changed\n- `average` method refactored\n## [2.8] - 2020-07-09\n### Added\n- `label_map` attribute\n- `positions` attribute\n- `position` method\n- Krippendorff's Alpha\n- Aickin's Alpha\n- `weighted_alpha` method\n### Changed\n- Single class bug fixed\n- `CLASS_NUMBER_ERROR` error type changed to `pycmMatrixError`\n- `relabel` method bug fixed\n- Document modified\n- `README.md` modified\n## [2.7] - 2020-05-11\n### Added\n- `average` method\n- `weighted_average` method\n- `weighted_kappa` method\n- `pycmAverageError` class\n- Bangdiwala's B\n- MATLAB examples\n- Github action\n### Changed\n- Document modified\n- `README.md` modified\n- `relabel` method bug fixed\n- `sparse_table_print` function bug fixed\n- `matrix_check` function bug fixed\n- Minor bug in `Compare` class fixed\n- Class names mismatch bug fixed\n## [2.6] - 2020-03-25\n### Added\n- `custom_rounder` function\n- `complement` function\n- `sparse_matrix` attribute\n- `sparse_normalized_matrix` attribute \n- Net benefit (NB)\n- Yule's Q interpretation (QI)\n- Adjusted Rand index (ARI)\n- TNR micro/macro\n- FPR micro/macro\n- FNR micro/macro\n### Changed\n- `sparse` parameter added to `print_matrix`,`print_normalized_matrix` and `save_stat` methods\n- `header` parameter added to `save_csv` method\n- Handler functions moved to `pycm_handler.py`\n- Error objects moved to `pycm_error.py`\n- Verified tests references updated\n- Verified tests moved to `verified_test.py`\n- Test system modified \n- `CONTRIBUTING.md` updated\n- Namespace optimized\n- `README.md` modified\n- Document modified\n- `print_normalized_matrix` method modified\n- `normalized_table_calc` function modified\n- `setup.py` modified\n- summary mode updated\n- Dockerfile updated\n- `Python 3.8` added to `.travis.yaml` and `appveyor.yml`\n### Removed\n- `PC_PI_calc` function\n## [2.5] - 2019-10-16\n### Added\n- `__version__` variable\n- Individual classification success index (ICSI)\n- Classification success index (CSI)\n- Example-8 (Confidence interval)\n- `install.sh`\n- `autopep8.sh`\n- Dockerfile\n- `CI` method (supported statistics : `ACC`,`AUC`,`Overall ACC`,`Kappa`,`TPR`,`TNR`,`PPV`,`NPV`,`PLR`,`NLR`,`PRE`)\n### Changed\n- `test.sh` moved to `.travis` folder\n- Python 3.4 support dropped\n- Python 2.7 support dropped\n- `AUTHORS.md` updated\n- `save_stat`,`save_csv` and `save_html` methods Non-ASCII character bug fixed\n- Mixed type input vectors bug fixed\n- `CONTRIBUTING.md` updated\n- Example-3 updated\n- `README.md` modified\n- Document modified\n- `CI` attribute renamed to `CI95`\n- `kappa_se_calc` function renamed to `kappa_SE_calc`\n- `se_calc` function modified and renamed to `SE_calc`\n- CI/SE functions moved to `pycm_ci.py`\n- Minor bug in `save_html` method fixed\n## [2.4] - 2019-07-31\n### Added\n- Tversky index (TI)\n- Area under the PR curve (AUPR)\n- `FUNDING.yml`\n### Changed\n- `AUC_calc` function modified\n- Document modified\n- `summary` parameter added to `save_html`,`save_stat`,`save_csv` and `stat` methods\n- `sample_weight` bug in `numpy` array format fixed\n- Inputs manipulation bug fixed\n- Test system modified \n- Warning system modified\n- `alt_link` parameter added to `save_html` method and `online_help` function\n- `Compare` class tests moved to `compare_test.py`\n- Warning tests moved to `warning_test.py`\n## [2.3] - 2019-06-27\n### Added\n- Adjusted F-score (AGF)\n- Overlap coefficient (OC)\n- Otsuka-Ochiai coefficient (OOC)\n### Changed\n- `save_stat` and `save_vector` parameters added to `save_obj` method\n- Document modified\n- `README.md` modified \n- Parameters recommendation for imbalance dataset modified\n- Minor bug in `Compare` class fixed\n- `pycm_help` function modified\n- Benchmarks color modified\n## [2.2] - 2019-05-30\n### Added\n- Negative likelihood ratio interpretation (NLRI)\n- Cramer's benchmark (SOA5)\n- Matthews correlation coefficient interpretation (MCCI)\n- Matthews's benchmark (SOA6)\n- F1 macro\n- F1 micro\n- Accuracy macro\n### Changed\n- `Compare` class score calculation modified\n- Parameters recommendation for multi-class dataset modified\n- Parameters recommendation for imbalance dataset modified\n- `README.md` modified \n- Document modified\n- Logo updated\n## [2.1] - 2019-05-06\n### Added\n- Adjusted geometric mean (AGM)\n- Yule's Q (Q)\n- `Compare` class and parameters recommendation system block diagrams\n### Changed\n- Document links bug fixed\n- Document modified\n## [2.0] - 2019-04-15\n### Added\n- G-Mean (GM)\n- Index of balanced accuracy (IBA)\n- Optimized precision (OP)\n- Pearson's C (C)\n- `Compare` class\n- Parameters recommendation warning\n- `ConfusionMatrix` equal method\n\n### Changed\n- Document modified\n- `stat_print` function bug fixed\n- `table_print` function bug fixed\n- `Beta` parameter renamed to `beta` (`F_calc` function & `F_beta` method) \n- Parameters recommendation for imbalance dataset modified\n- `normalize` parameter added to `save_html` method\n- `pycm_func.py` splitted into `pycm_class_func.py` and `pycm_overall_func.py`\n- `vector_filter`,`vector_check`,`class_check` and `matrix_check` functions moved to `pycm_util.py`\n- `RACC_calc` and `RACCU_calc` functions exception handler modified\n- Docstrings modified\n\n## [1.9] - 2019-02-25\n### Added\n- Automatic/Manual (AM)\n- Bray-Curtis dissimilarity (BCD)\n- `CODE_OF_CONDUCT.md`\n- `ISSUE_TEMPLATE.md`\n- `PULL_REQUEST_TEMPLATE.md`\n- `CONTRIBUTING.md`\n- X11 color names support for `save_html` method\n- Parameters recommendation system\n- Warning message for high dimension matrix print\n- Interactive notebooks section (binder)\n\n### Changed\n- `save_matrix` and `normalize` parameters added to `save_csv` method\n- `README.md` modified \n- Document modified\n- `ConfusionMatrix.__init__` optimized\n- Document and examples output files moved to different folders\n- Test system modified \n- `relabel` method bug fixed\n\n## [1.8] - 2019-01-05\n### Added\n- Lift score (LS)\n- `version_check.py`\n\n### Changed\n- `color` parameter added to `save_html` method\n- Error messages modified\n- Document modified\n- Website changed to [http://www.pycm.ir](http://www.pycm.ir)\n- Interpretation functions moved to `pycm_interpret.py`\n- Utility functions moved to `pycm_util.py`\n- Unnecessary `else` and `elif` removed\n- `==` changed to `is`\n\n## [1.7] - 2018-12-18\n### Added\n- Gini index (GI)\n- Example-7\n- `pycm_profile.py`\n\n### Changed\n- `class_name` parameter added to `stat`,`save_stat`,`save_csv` and `save_html` methods\n- `overall_param` and `class_param` parameters empty list bug fixed \n- `matrix_params_calc`, `matrix_params_from_table` and `vector_filter` functions optimized\n- `overall_MCC_calc`, `CEN_misclassification_calc` and `convex_combination` functions optimized\n- Document modified\n\n## [1.6] - 2018-12-06\n### Added\n- AUC value interpretation (AUCI)\n- Example-6\n- Anaconda cloud package\n\n### Changed\n- `overall_param` and `class_param` parameters added to `stat`,`save_stat` and `save_html` methods\n- `class_param` parameter added to `save_csv` method\n- `_` removed from overall statistics names\n- `README.md` modified \n- Document modified\n\n## [1.5] - 2018-11-26\n### Added\n- Relative classifier information (RCI)\n- Discriminator power (DP)\n- Youden's index (Y)\n- Discriminant power interpretation (DPI)\n- Positive likelihood ratio interpretation (PLRI)\n- `__len__` method\n- `relabel` method\n- `__class_stat_init__` function\n- `__overall_stat_init__` function\n- `matrix` attribute as dict\n- `normalized_matrix` attribute as dict\n- `normalized_table` attribute as dict\n\n### Changed\n- `README.md` modified\n- Document modified\n- `LR+` renamed to `PLR`\n- `LR-` renamed to `NLR`\n- `normalized_matrix` method renamed to `print_normalized_matrix`\n- `matrix` method renamed to `print_matrix`\n- `entropy_calc` fixed\n- `cross_entropy_calc` fixed\n- `conditional_entropy_calc` fixed\n- `print_table` bug for large numbers fixed\n- JSON key bug in `save_obj` fixed\n- `transpose` bug in `save_obj` fixed\n- `Python 3.7` added to `.travis.yaml` and `appveyor.yml`\n\n## [1.4] - 2018-11-12\n### Added\n- Area under curve (AUC)\n- AUNU\n- AUNP\n- Class balance accuracy (CBA)\n- Global performance index (RR)\n- Overall MCC\n- Distance index (dInd)\n- Similarity index (sInd)\n- `one_vs_all`\n- `dev-requirements.txt`\n\n### Changed\n- `README.md` modified\n- Document modified\n- `save_stat` modified\n- `requirements.txt` modified\n\n## [1.3] - 2018-10-10\n### Added\n- Confusion entropy (CEN)\n- Overall confusion entropy (Overall CEN)\n- Modified confusion entropy (MCEN)\n- Overall modified confusion entropy (Overall MCEN)\n- Information score (IS)\n\n### Changed\n- `README.md` modified\n\n## [1.2] - 2018-10-01\n### Added\n- No information rate (NIR)\n- P-Value\n- `sample_weight`\n- `transpose`\n\n### Changed\n- `README.md` modified\n- Key error in some parameters fixed\n- `OSX` env added to `.travis.yml`\n\n## [1.1] - 2018-09-08\n### Added\n- Zero-one loss\n- Support\n- `online_help` function\n\n### Changed\n- `README.md` modified\n- `html_table` function modified\n- `table_print` function modified\n- `normalized_table_print` function modified\n\n## [1.0] - 2018-08-30\n### Added\n- Hamming loss\n\n### Changed\n- `README.md` modified\n\n## [0.9.5] - 2018-07-08\n### Added\n- Obj load\n- Obj save\n- Example-4\n\n### Changed\n- `README.md` modified\n- Block diagram updated\n\n## [0.9] - 2018-06-28\n### Added\n- Activation threshold\n- Example-3\n- Jaccard index\n- Overall Jaccard index\n\n### Changed\n- `README.md` modified\n- `setup.py` modified\n\n## [0.8.6] - 2018-05-31\n### Added\n- Example section in document\n- Python 2.7 CI\n- JOSS paper pdf\n\n### Changed\n- Cite section\n- ConfusionMatrix docstring\n- round function changed to numpy.around\n- `README.md` modified\n\n## [0.8.5] - 2018-05-21\n### Added\n- Example-1 (Comparison of three different classifiers)\n- Example-2 (How to plot via matplotlib)\n- JOSS paper\n- ConfusionMatrix docstring\n\n### Changed\n- Table size in HTML report\n- Test system\n- `README.md` modified\n\n## [0.8.1] - 2018-03-22\n### Added\n- Goodman and Kruskal's lambda B\n- Goodman and Kruskal's lambda A \n- Cross entropy\n- Conditional entropy\n- Joint entropy\n- Reference entropy \n- Response entropy\n- Kullback-Liebler divergence\n- Direct ConfusionMatrix\n- Kappa unbiased\n- Kappa no prevalence\n- Random accuracy unbiased\n- `pycmVectorError` class\n- `pycmMatrixError` class\n- Mutual information\n- Support `numpy` arrays\n\n### Changed\n- Notebook file updated\n\n\n### Removed\n- `pycmError` class\n\n## [0.7] - 2018-02-26\n### Added\n- Cramer's V\n- 95% confidence interval \n- Chi-Squared\n- Phi-Squared\n- Chi-Squared DF\n- Standard error\n- Kappa standard error\n- Kappa 95% confidence interval\n- Cicchetti benchmark\n\n\n### Changed\n- Overall statistics color in HTML report\n- Parameters description link in HTML report\n\n\n## [0.6] - 2018-02-21\n### Added\n- CSV report\n- Changelog\n- Output files\n- `digit` parameter to `ConfusionMatrix` object\n\n### Changed\n- Confusion matrix color in HTML report\n- Parameters description link in HTML report\n- Capitalize descriptions\n\n## [0.5] - 2018-02-17\n### Added\n- Scott's pi\n- Gwet's AC1\n- Bennett S score\n- HTML report \n\n## [0.4] - 2018-02-05\n### Added\n- TPR micro/macro\n- PPV micro/macro\n- Overall RACC\n- Error rate (ERR)\n- FBeta score\n- F0.5\n- F2\n- Fleiss benchmark\n- Altman benchmark\n- Output file(.pycm)\n\n\n### Changed\n- Class with zero item\n- Normalized matrix\n\n### Removed\n- Kappa and SOA for each class\n\n\n## [0.3] - 2018-01-27\n### Added\n- Kappa\n- Random accuracy\n- Landis and Koch benchmark\n- `overall_stat`\n\n\n## [0.2] - 2018-01-24\n### Added\n- Population\n- Condition positive\n- Condition negative\n- Test outcome positive\n- Test outcome negative\n- Prevalence\n- G-measure\n- Matrix method\n- Normalized matrix method\n- Params method\n\n\n### Changed\n - `statistic_result` to `class_stat`\n - `params` to `stat`\n\n## [0.1] - 2018-01-22\n### Added\n- ACC\n- BM\n- DOR\n- F1-Score\n- FDR\n- FNR\n- FOR\n- FPR\n- LR+\n- LR-\n- MCC\n- MK\n- NPV\n- PPV\n- TNR\n- TPR\n- documents and `README.md`\n\n[Unreleased]: https://github.com/sepandhaghighi/pycm/compare/v4.1...dev\n[4.1]: https://github.com/sepandhaghighi/pycm/compare/v4.0...v4.1\n[4.0]: https://github.com/sepandhaghighi/pycm/compare/v3.9...v4.0\n[3.9]: https://github.com/sepandhaghighi/pycm/compare/v3.8...v3.9\n[3.8]: https://github.com/sepandhaghighi/pycm/compare/v3.7...v3.8\n[3.7]: https://github.com/sepandhaghighi/pycm/compare/v3.6...v3.7\n[3.6]: https://github.com/sepandhaghighi/pycm/compare/v3.5...v3.6\n[3.5]: https://github.com/sepandhaghighi/pycm/compare/v3.4...v3.5\n[3.4]: https://github.com/sepandhaghighi/pycm/compare/v3.3...v3.4\n[3.3]: https://github.com/sepandhaghighi/pycm/compare/v3.2...v3.3\n[3.2]: https://github.com/sepandhaghighi/pycm/compare/v3.1...v3.2\n[3.1]: https://github.com/sepandhaghighi/pycm/compare/v3.0...v3.1\n[3.0]: https://github.com/sepandhaghighi/pycm/compare/v2.9...v3.0\n[2.9]: https://github.com/sepandhaghighi/pycm/compare/v2.8...v2.9\n[2.8]: https://github.com/sepandhaghighi/pycm/compare/v2.7...v2.8\n[2.7]: https://github.com/sepandhaghighi/pycm/compare/v2.6...v2.7\n[2.6]: https://github.com/sepandhaghighi/pycm/compare/v2.5...v2.6\n[2.5]: https://github.com/sepandhaghighi/pycm/compare/v2.4...v2.5\n[2.4]: https://github.com/sepandhaghighi/pycm/compare/v2.3...v2.4\n[2.3]: https://github.com/sepandhaghighi/pycm/compare/v2.2...v2.3\n[2.2]: https://github.com/sepandhaghighi/pycm/compare/v2.1...v2.2\n[2.1]: https://github.com/sepandhaghighi/pycm/compare/v2.0...v2.1\n[2.0]: https://github.com/sepandhaghighi/pycm/compare/v1.9...v2.0\n[1.9]: https://github.com/sepandhaghighi/pycm/compare/v1.8...v1.9\n[1.8]: https://github.com/sepandhaghighi/pycm/compare/v1.7...v1.8\n[1.7]: https://github.com/sepandhaghighi/pycm/compare/v1.6...v1.7\n[1.6]: https://github.com/sepandhaghighi/pycm/compare/v1.5...v1.6\n[1.5]: https://github.com/sepandhaghighi/pycm/compare/v1.4...v1.5\n[1.4]: https://github.com/sepandhaghighi/pycm/compare/v1.3...v1.4\n[1.3]: https://github.com/sepandhaghighi/pycm/compare/v1.2...v1.3\n[1.2]: https://github.com/sepandhaghighi/pycm/compare/v1.1...v1.2\n[1.1]: https://github.com/sepandhaghighi/pycm/compare/v1.0...v1.1\n[1.0]: https://github.com/sepandhaghighi/pycm/compare/v0.9.5...v1.0\n[0.9.5]: https://github.com/sepandhaghighi/pycm/compare/v0.9...v0.9.5\n[0.9]: https://github.com/sepandhaghighi/pycm/compare/v0.8.6...v0.9\n[0.8.6]: https://github.com/sepandhaghighi/pycm/compare/v0.8.5...v0.8.6\n[0.8.5]: https://github.com/sepandhaghighi/pycm/compare/v0.8.1...v0.8.5\n[0.8.1]: https://github.com/sepandhaghighi/pycm/compare/v0.7...v0.8.1\n[0.7]: https://github.com/sepandhaghighi/pycm/compare/v0.6...v0.7\n[0.6]: https://github.com/sepandhaghighi/pycm/compare/v0.5...v0.6\n[0.5]: https://github.com/sepandhaghighi/pycm/compare/v0.4...v0.5\n[0.4]: https://github.com/sepandhaghighi/pycm/compare/v0.3...v0.4\n[0.3]: https://github.com/sepandhaghighi/pycm/compare/v0.2...v0.3\n[0.2]: https://github.com/sepandhaghighi/pycm/compare/v0.1...v0.2\n[0.1]: https://github.com/sepandhaghighi/pycm/compare/1e238cd...v0.1\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Multi-class confusion matrix library in Python",
"version": "4.1",
"project_urls": {
"Discord": "https://discord.com/invite/zqpU2b3J3f",
"Download": "https://github.com/sepandhaghighi/pycm/tarball/v4.1",
"Homepage": "https://github.com/sepandhaghighi/pycm",
"Source": "https://github.com/sepandhaghighi/pycm",
"Webpage": "https://www.pycm.io"
},
"split_keywords": [
"confusion-matrix",
"python3",
"python",
"machine_learning",
"ml"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c8cc68c99150aba114fbfedb37adf036b70b1c97f51985ba41bd219cfcb8139a",
"md5": "ba1074c4509b1a391930b1d6fd1a1471",
"sha256": "85563f6c3e5d90bb2a71cc346ea4a68c00c9d1cfaf28a2a1a938e38e7060c0f5"
},
"downloads": -1,
"filename": "pycm-4.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ba1074c4509b1a391930b1d6fd1a1471",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 70279,
"upload_time": "2024-10-17T14:28:28",
"upload_time_iso_8601": "2024-10-17T14:28:28.692206Z",
"url": "https://files.pythonhosted.org/packages/c8/cc/68c99150aba114fbfedb37adf036b70b1c97f51985ba41bd219cfcb8139a/pycm-4.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ce9e8b8760d62b506e60eb6e3cd46c6394902aa6b42d9367bb3c259227a9629b",
"md5": "a6507c7c697932df3a224e3f7191285d",
"sha256": "f803f8cede448c9746bc1b92f333ab5b35e088429bb90c2da7b4263bd274367e"
},
"downloads": -1,
"filename": "pycm-4.1.tar.gz",
"has_sig": false,
"md5_digest": "a6507c7c697932df3a224e3f7191285d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 917386,
"upload_time": "2024-10-17T14:28:26",
"upload_time_iso_8601": "2024-10-17T14:28:26.058006Z",
"url": "https://files.pythonhosted.org/packages/ce/9e/8b8760d62b506e60eb6e3cd46c6394902aa6b42d9367bb3c259227a9629b/pycm-4.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-17 14:28:26",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "sepandhaghighi",
"github_project": "pycm",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"requirements": [
{
"name": "art",
"specs": [
[
">=",
"1.8"
]
]
},
{
"name": "numpy",
"specs": [
[
">=",
"1.9.0"
]
]
}
],
"lcname": "pycm"
}