<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>
## Table of contents
* [Overview](https://github.com/sepandhaghighi/pycm#overview)
* [Installation](https://github.com/sepandhaghighi/pycm#installation)
* [Usage](https://github.com/sepandhaghighi/pycm#usage)
* [Document](https://github.com/sepandhaghighi/pycm/tree/master/Document)
* [Try PyCM in Your Browser](https://github.com/sepandhaghighi/pycm#try-pycm-in-your-browser)
* [Issues & Bug Reports](https://github.com/sepandhaghighi/pycm#issues--bug-reports)
* [Todo](https://github.com/sepandhaghighi/pycm/blob/master/TODO.md)
* [Contribution](https://github.com/sepandhaghighi/pycm/blob/master/.github/CONTRIBUTING.md)
* [Acknowledgments](https://github.com/sepandhaghighi/pycm#acknowledgments)
* [Cite](https://github.com/sepandhaghighi/pycm#cite)
* [Authors](https://github.com/sepandhaghighi/pycm/blob/master/AUTHORS.md)
* [License](https://github.com/sepandhaghighi/pycm/blob/master/LICENSE)
* [Show Your Support](https://github.com/sepandhaghighi/pycm#show-your-support)
* [Changelog](https://github.com/sepandhaghighi/pycm/blob/master/CHANGELOG.md)
* [Code of Conduct](https://github.com/sepandhaghighi/pycm/blob/master/.github/CODE_OF_CONDUCT.md)
## 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">
<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/workflows/CI/badge.svg?branch=master"></td>
<td align="center"><img src="https://github.com/sepandhaghighi/pycm/workflows/CI/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)**
### Source code
- Download [Version 4.0](https://github.com/sepandhaghighi/pycm/archive/v4.0.zip) or [Latest Source ](https://github.com/sepandhaghighi/pycm/archive/dev.zip)
- Run `pip install -r requirements.txt` or `pip3 install -r requirements.txt` (Need root access)
- Run `python3 setup.py install` or `python setup.py install` (Need root access)
### PyPI
- Check [Python Packaging User Guide](https://packaging.python.org/installing/)
- Run `pip install pycm==4.0` or `pip3 install pycm==4.0` (Need root access)
### Conda
- Check [Conda Managing Package](https://conda.io/)
- Update Conda using `conda update conda` (Need root access)
- Run `conda install -c sepandhaghighi pycm` (Need root access)
### Easy install
- Run `easy_install --upgrade pycm` (Need root access)
### 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` or `pip3 install pycm` (Need root access)
- 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
没有合适的资源?快使用搜索试试~ 我知道了~
PyCM 是一个用 Python 编写的多类混淆矩阵库,支持输入数据向量和矩阵,是支持大多数类和统计参数的模型评估工具.zip
共133个文件
py:32个
csv:12个
html:11个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 49 浏览量
2024-05-03
12:16:32
上传
评论
收藏 945KB ZIP 举报
温馨提示
混淆矩阵 混淆矩阵也称误差矩阵,是表示精度评价的一种标准格式,用n行n列的矩阵形式来表示。具体评价指标有总体精度、制图精度、用户精度等,这些精度指标从不同的侧面反映了图像分类的精度。 [1]在人工智能中,混淆矩阵(confusion matrix)是可视化工具,特别用于监督学习,在无监督学习一般叫做匹配矩阵。在图像精度评价中,主要用于比较分类结果和实际测得值,可以把分类结果的精度显示在一个混淆矩阵里面。混淆矩阵是通过将每个实测像元的位置和分类与分类图像中的相应位置和分类相比较计算的。 混淆矩阵的每一列代表了预测类别,每一列的总数表示预测为该类别的数据的数目;每一行代表了数据的真实归属类别,每一行的数据总数表示该类别的数据实例的数目。每一列中的数值表示真实数据被预测为该类的数目:第一行第一列中的43表示有43个实际归属第一类的实例被预测为第一类,同理,第一行第二列的2表示有2个实际归属为第一类的实例被错误预测为第二类。
资源推荐
资源详情
资源评论
收起资源包目录
PyCM 是一个用 Python 编写的多类混淆矩阵库,支持输入数据向量和矩阵,是支持大多数类和统计参数的模型评估工具.zip (133个子文件)
doc_to_html.bat 1KB
doc_run.bat 643B
autopep8.bat 316B
paper.bib 6KB
CITATION.cff 2KB
cp.comp 240B
test.comp 135B
cp.comp 135B
.coveragerc 214B
test.csv 1KB
cm1.csv 1KB
cm1_header.csv 1KB
cm1_summary.csv 254B
cm1_filtered.csv 83B
cm1_filtered2.csv 83B
cm1_filtered3.csv 39B
cm1_filtered2_matrix.csv 35B
cm1_header_matrix.csv 32B
cm1_filtered3_matrix.csv 17B
cm1_filtered_matrix.csv 17B
cm1_matrix.csv 17B
Dockerfile 776B
1.flo 33KB
2.flo 25KB
3.flo 12KB
.gitattributes 135B
.gitignore 1KB
cm3.html 67KB
cm1_normalized.html 67KB
test.html 67KB
cm1.html 67KB
cm1_colored.html 67KB
cm2.html 67KB
cm1_colored2.html 67KB
cm1.html 67KB
cm1_summary.html 17KB
cm1_filtered.html 6KB
cm1_filtered2.html 5KB
MANIFEST.in 455B
pytest.ini 146B
Document.ipynb 503KB
Example8.ipynb 178KB
Example7.ipynb 89KB
Distance.ipynb 64KB
Example4.ipynb 46KB
Example5.ipynb 31KB
Example3.ipynb 31KB
Example2.ipynb 27KB
Example6.ipynb 21KB
Example1.ipynb 17KB
block_diagram.jpg 68KB
compare_block_diagram.jpg 51KB
recommendation_block_diagram.jpg 24KB
LICENSE 1KB
Example4.m 823B
Example1.m 760B
Example2.m 758B
Example3.m 540B
README.md 26KB
CHANGELOG.md 20KB
CODE_OF_CONDUCT.md 5KB
CONTRIBUTING.md 4KB
README.md 2KB
paper.md 2KB
TODO.md 2KB
AUTHORS.md 877B
README.md 259B
ISSUE_TEMPLATE.md 183B
PULL_REQUEST_TEMPLATE.md 112B
cm_stat.obj 7KB
cm1_stat.obj 7KB
cm.obj 543B
cm_no_vectors.obj 351B
test.obj 284B
cm1_no_vectors.obj 284B
cm1.obj 284B
10.21105.joss.00729.pdf 123KB
logo.png 114KB
plot3.png 12KB
PSF.png 10KB
plot2.png 8KB
plot1.png 7KB
overall_test.py 114KB
warning_test.py 53KB
output_test.py 51KB
pycm_obj.py 38KB
pycm_param.py 33KB
pycm_overall_func.py 31KB
pycm_distance.py 30KB
verified_test.py 24KB
pycm_util.py 22KB
pycm_class_func.py 21KB
pycm_output.py 18KB
function_test.py 16KB
error_test.py 15KB
pycm_curve.py 13KB
pycm_compare.py 11KB
plot_test.py 8KB
pycm_handler.py 8KB
pycm_interpret.py 7KB
共 133 条
- 1
- 2
资源评论
野生的狒狒
- 粉丝: 2515
- 资源: 2146
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 而且往往吾问无为谓吾问无为谓吾问无为谓呜呜呜呜呜呜呜呜呜
- 无人机自主解锁、起飞、offboard、点控的ros功能包
- base.apk
- PMV20XN-VB一款N-Channel沟道SOT23的MOSFET晶体管参数介绍与应用说明
- 基于Vue的medical-vue医疗挂号系统设计源码
- Python解析网页.xmind
- PMV185XN-VB一款N-Channel沟道SOT23的MOSFET晶体管参数介绍与应用说明
- PMV170UN-VB一款N-Channel沟道SOT23的MOSFET晶体管参数介绍与应用说明
- 基于Java的长理教务管理系统设计源码
- PMV16UN-VB一款N-Channel沟道SOT23的MOSFET晶体管参数介绍与应用说明
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功