CMSC_828C_Project1/KNN_PCA.py
def cf_matrix(model, X, Y):
    """
    This function calculates the confusion matrix given the data and the labels
    :param model: type of model e.g. knn
    :param X: training data
    :param Y: data labels
    :return: confusion matrix and predictions on test data
    """
    y_train_pred = cross_val_predict(model, X, Y, cv=3)
    conf_mx = confusion_matrix(Y, y_train_pred)
    plt.matshow(conf_mx, cmap=plt.cm.gray)
    plt.show()
    return conf_mx, y_train_pred

    This function calculates the confusion matrix given the data and the labels
    :param model: type of model e.g. knn
    :param X: training data
    :param Y: data labels
    :return: confusion matrix and predictions on test data
    
This function calculates the confusion matrix given the data and the labels
This function calculates the confusion matrix given the data and the labels
def cf_matrix(model, X, Y):
    y_train_pred = cross_val_predict(model, X, Y, cv=3)
    conf_mx = confusion_matrix(Y, y_train_pred)
    plt.matshow(conf_mx, cmap=plt.cm.gray)
    plt.show()
    return conf_mx, y_train_pred
def cf_matrix ( model , X , Y ) : y_train_pred = cross_val_predict ( model , X , Y , cv = 3 ) conf_mx = confusion_matrix ( Y , y_train_pred ) plt . matshow ( conf_mx , cmap = plt . cm . gray ) plt . show ( ) return conf_mx , y_train_pred
This function calculates the confusion matrix given the data and the labels
This function calculates the confusion matrix given the data and the labels
"""
    This function calculates the confusion matrix given the data and the labels
    :param model: type of model e.g. knn
    :param X: training data
    :param Y: data labels
    :return: confusion matrix and predictions on test data
    """
confusion matrix and predictions on test data
confusion matrix and predictions on test data
model
type of model e.g. knn
type of model e . g . knn
X
None
Y
None