(y_true,y_pred,classes,normalize=False,cmap=plt.cm.Blues)
return ax
Function copied from the scikit-learn examples (https://scikit-learn.org/stable/)
    This function plots a confusion matrix.
    Normalization can be applied by setting `normalize=True`.
Function copied from the scikit-learn examples (https://scikit-learn.org/stable/)
    This function plots a confusion matrix.
    Normalization can be applied by setting `normalize=True`.
Function copied from the scikit - learn examples ( https : // scikit - learn . org / stable / ) This function plots a confusion matrix . Normalization can be applied by setting normalize = True .
def plot_confusion_matrix(y_true,y_pred,classes,normalize=False,cmap=plt.cm.Blues):
    """
    Function copied from the scikit-learn examples (https://scikit-learn.org/stable/)
    This function plots a confusion matrix.
    Normalization can be applied by setting `normalize=True`.
    
    """
    # compute confusion matrix
    cm = confusion_matrix(y_true, y_pred)
    if normalize:
        cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]
        print("Normalized confusion matrix")
    else:
        print('Confusion matrix, without normalization')
        
    # plot confusion matrix
    fig, ax = plt.subplots(figsize=(6,6), tight_layout=True)
    im = ax.imshow(cm, interpolation='nearest', cmap=cmap)
#    ax.figure.colorbar(im, ax=ax)
    ax.set(xticks=np.arange(cm.shape[1]),
           yticks=np.arange(cm.shape[0]), ylim=[3.5,-0.5],
           xticklabels=classes, yticklabels=classes,
           ylabel='True label',
           xlabel='Predicted label')

    # rotate the tick labels and set their alignment.
    plt.setp(ax.get_xticklabels(), rotation=45, ha="right",
             rotation_mode="anchor")

    # loop over data dimensions and create text annotations.
    fmt = '.2f' if normalize else 'd'
    thresh = cm.max() / 2.
    for i in range(cm.shape[0]):
        for j in range(cm.shape[1]):
            ax.text(j, i, format(cm[i, j], fmt),
                    ha="center", va="center",
                    color="white" if cm[i, j] > thresh else "black",
                    fontsize=12)
    fig.tight_layout()
    return ax
def plot_confusion_matrix ( y_true , y_pred , classes , normalize = False , cmap = plt . cm . Blues ) : # compute confusion matrix cm = confusion_matrix ( y_true , y_pred ) if normalize : cm = cm . astype ( 'float' ) / cm . sum ( axis = 1 ) [ : , np . newaxis ] print ( "Normalized confusion matrix" ) else : print ( 'Confusion matrix, without normalization' ) # plot confusion matrix fig , ax = plt . subplots ( figsize = ( 6 , 6 ) , tight_layout = True ) im = ax . imshow ( cm , interpolation = 'nearest' , cmap = cmap ) #    ax.figure.colorbar(im, ax=ax) ax . set ( xticks = np . arange ( cm . shape [ 1 ] ) , yticks = np . arange ( cm . shape [ 0 ] ) , ylim = [ 3.5 , - 0.5 ] , xticklabels = classes , yticklabels = classes , ylabel = 'True label' , xlabel = 'Predicted label' ) # rotate the tick labels and set their alignment. plt . setp ( ax . get_xticklabels ( ) , rotation = 45 , ha = "right" , rotation_mode = "anchor" ) # loop over data dimensions and create text annotations. fmt = '.2f' if normalize else 'd' thresh = cm . max ( ) / 2. for i in range ( cm . shape [ 0 ] ) : for j in range ( cm . shape [ 1 ] ) : ax . text ( j , i , format ( cm [ i , j ] , fmt ) , ha = "center" , va = "center" , color = "white" if cm [ i , j ] > thresh else "black" , fontsize = 12 ) fig . tight_layout ( ) return ax