/confusion_matrix

Contains cf_matrix.py file with a function to make a pretty visualization of a confusion matrix.

Primary LanguageJupyter Notebook

cf_matrix.py

This file contains a function called make_confusion_matrix which can be used to create a useful visualzation of a Confusion Matrix passed in as a two dimensional numpy array.

Docstring

This function will make a pretty plot of an sklearn Confusion Matrix cm using a Seaborn heatmap visualization.

Arguments
---------
cf:            confusion matrix to be passed in

group_names:   List of strings that represent the labels row by row to be shown in each square.

categories:    List of strings containing the categories to be displayed on the x,y axis. Default is 'auto'

count:         If True, show the raw number in the confusion matrix. Default is True.

normalize:     If True, show the proportions for each category. Default is True.

cbar:          If True, show the color bar. The cbar values are based off the values in the confusion matrix.
               Default is True.

xyticks:       If True, show x and y ticks. Default is True.

xyplotlabels:  If True, show 'True Label' and 'Predicted Label' on the figure. Default is True.

sum_stats:     If True, display summary statistics below the figure. Default is True.

figsize:       Tuple representing the figure size. Default will be the matplotlib rcParams value.

cmap:          Colormap of the values displayed from matplotlib.pyplot.cm. Default is 'Blues'
               See http://matplotlib.org/examples/color/colormaps_reference.html

confusion_matrix