ConfPlot: Plot Confusion Matrix in Python
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:
Getting started
Installation
pip install confplot
Usage
Plot confusion matrix from matrix
# 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
# 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"
)
Metadata
Release files for confplot 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| confplot-0.1.1.tar.gz | 6.3 kB | Without provenance | Details for confplot-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| confplot-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for confplot-0.1.1-py3-none-any.whl |
Total release size: 17.0 kB
Release files / confplot-0.1.1.tar.gz
| Download URL | confplot-0.1.1.tar.gz |
|---|---|
| Size | 6.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
82a303da39228f57111457fc7acf217998591c8246f1313a37d54627e161d20e
|
|
BLAKE2b-256 checksum How to use checksums |
e2a34aea8faf2617fc868649cd592e534e8e93ad4dbd09bf389f8b4bb9986b8d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3
|
Release files / confplot-0.1.1-py3-none-any.whl
| Download URL | confplot-0.1.1-py3-none-any.whl |
|---|---|
| Size | 10.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cf476f102eb8edd73470bedc469ed52a1449c94ffe4c084287b7e5a618857aa6
|
|
BLAKE2b-256 checksum How to use checksums |
8949d45ceb0aa2061b15d3b143022f0669a30d33ba6bdcb38638be95f6e83f2c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3
|
Security for confplot 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.