Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added customizable class names for pp_matrix #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion pretty_confusion_matrix/pretty_confusion_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ def pp_matrix(
figsize=[8, 8],
show_null_values=0,
pred_val_axis="y",
categories=[]
):
"""
print conf matrix with default layout (like matlab)
Expand All @@ -163,7 +164,8 @@ def pp_matrix(
lw linewidth
pred_val_axis where to show the prediction values (x or y axis)
'col' or 'x': show predicted values in columns (x axis) instead lines
'lin' or 'y': show predicted values in lines (y axis)
'lin' or 'y': show predicted values in lines (y axis
categories: parameter to specify string values of class names instead of just 0, 1, 2, etc.
"""
if pred_val_axis in ("col", "x"):
xlbl = "Predicted"
Expand All @@ -189,6 +191,8 @@ def pp_matrix(
cmap=cmap,
linecolor="w",
fmt=fmt,
xticklabels=categories,
yticklabels=categories
)

# set ticklabels rotation
Expand Down