Login using Social Account
     Continue with GoogleLogin using your credentials
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.
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()
Taking you to the next exercise in seconds...
Want to create exercises like this yourself? Click here.
Note - Having trouble with the assessment engine? Follow the steps listed here
Loading comments...