Flash Sale: Flat 70% + Addl. 25% Off on all Courses | Use Coupon DS25 in Checkout | Offer Expires In

  Enroll Now

Visualize the Confusion Matrix

Let us visualize the confusion matrices for the predictions made on the test set and over-sampled train set.

Note:

plot_confusion_matrix(estimator, X, y) plots Confusion Matrix. Here estimator is the fitted classifier, X is the input values and y is the target values.

INSTRUCTIONS
  • Import plot_confusion_matrix from sklearn.metrics

    from << your code comes here >> import << your code comes here >>
    
  • Write the class names.

    class_names = ['Not Fraud', 'Fraud']
    
  • Call the plot_confusion_matrix function and pass k, X_test, y_test as arguments.

    << your code comes here >>(k, X_test, y_test,  values_format = '.5g', display_labels=class_names)
    plt.title("Test data Confusion Matrix")
    plt.show()
    
  • Call the plot_confusion_matrix function and pass k, X_train_res, y_train_res as arguments.

    << your code comes here >>(k, X_train_res, y_train_res,  values_format = '.5g', display_labels=class_names) 
    plt.title("Oversampled Train data Confusion Matrix")
    plt.show()
    

No hints are availble for this assesment

Answer is not availble for this assesment


Note - Having trouble with the assessment engine? Follow the steps listed here

Loading comments...