confplot-0.1.1
توضیحات
Plot a pretty confusion matrix (like Matlab) in python using seaborn and matplotlib
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | confplot-0.1.1 |
| نام | confplot |
| نسخه کتابخانه | 0.1.1 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Fatih Cagatay Akyon |
| ایمیل نویسنده | - |
| آدرس صفحه اصلی | https://github.com/fcakyon/confplot |
| آدرس اینترنتی | https://pypi.org/project/confplot/ |
| مجوز | - |
# ConfPlot: Plot Confusion Matrix in Python
[](https://badge.fury.io/py/confplot)

Plot a pretty confusion matrix (like Matlab) in python using seaborn and matplotlib
This module lets you plot a pretty looking confusion matrix from a np matrix or from a prediction results and actual labels.
Sample plots:
<img src="screenshots/conf_matrix_plot1.png" width="450"> <img src="screenshots/conf_matrix_plot2.png" width="450">
## Getting started
### Installation
```console
pip install confplot
```
### Usage
#### Plot confusion matrix from matrix
```python
# import package
import confplot
# assume you have a confusion matrix array like this
array = np.array(
[[13, 0, 1, 0, 2, 0],
[ 0, 50, 2, 0, 10, 0],
[ 0, 13, 16, 0, 0, 3],
[ 0, 0, 0, 13, 1, 0],
[ 0, 40, 0, 1, 15, 0],
[ 0, 0, 0, 0, 0, 20]]
)
# convert it to a pandas dataframe
df_cm = DataFrame(array, index=range(1, 7), columns=range(1, 7))
# create and save confusion matrix plot as "cm_plot.png"
confplot.plot_confusion_matrix_from_matrix(df_cm, outfile="cm_plot.png")
```
#### Plot confusion matrix from data
```python
# import package
import confplot
# assume you have 1D y_true (actual values) and y_pred (predictions) arrays
y_true = ...
y_pred = ...
# arange targetclass names if you want
columns = ["ahududu", "ananas", "armut", "avokado", "ayva"]
# create and save confusion matrix plot as "cm_plot.png"
confplot.plot_confusion_matrix_from_data(
y_true,
y_pred,
columns,
outfile="cm_plot.png"
)
```
نیازمندی
| مقدار | نام |
|---|---|
| >=1.16.0 | numpy |
| >=3.0.0 | matplotlib |
| >=0.22.2 | scikit-learn |
| >=1.0.0 | pandas |
| >=0.10.1 | seaborn |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.6 | Python |
نحوه نصب
نصب پکیج whl confplot-0.1.1:
pip install confplot-0.1.1.whl
نصب پکیج tar.gz confplot-0.1.1:
pip install confplot-0.1.1.tar.gz