Enrollments closing soon for Post Graduate Certificate Program in Applied Data Science & AI By IIT Roorkee | 3 Seats Left
Apply NowLogin using Social Account
     Continue with GoogleLogin using your credentials
Let us see how well our model has learnt from the train data, by testing it on the test data.
Use model.evaluate
on X_test, y_test
to see the test data prediction accuracy:
model.evaluate(X_test, y_test)
Let us predict and visualize the first 3 samples from the test data.
y_pred = np.argmax(model.predict(X_test[:3]), 1)
print(y_pred)
print([class_names[index] for index in y_pred])
Visualize the predictions for the first 3 samples from the test data:
plt.figure(figsize=(7, 3))
for index, image in enumerate(X_test[:3]):
plt.subplot(1, 3, index + 1)
plt.imshow(image, cmap="binary")
plt.axis('off')
plt.title(class_names[y_pred[index]], fontsize=12)
plt.subplots_adjust(wspace=0.2, hspace=0.5)
plt.show()
Want to create exercises like this yourself? Click here.
Note - Having trouble with the assessment engine? Follow the steps listed here
Loading comments...