Created
October 17, 2020 07:51
-
-
Save satishgunjal/aaea7df4ee0f7ca04c306f561be87184 to your computer and use it in GitHub Desktop.
plot_value_array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def plot_value_array(i, predictions_array, true_label): | |
""" | |
This method will plot the percentage confidence score of each class prediction. | |
Input: | |
i: Index of the prediction to test | |
predictions_array: Every prediction contain array of 10 number | |
true_label: Correct image labels. In case of test data they are test_labels | |
""" | |
true_label = true_label[i] | |
plt.grid(False) | |
plt.xticks(range(10)) | |
plt.yticks([]) | |
thisplot = plt.bar(range(10), predictions_array, color="#777777") | |
plt.ylim([0, 1]) | |
predicted_label = np.argmax(predictions_array) | |
thisplot[predicted_label].set_color('red') | |
thisplot[true_label].set_color('green') | |
i = 0 | |
plot_value_array(i, predictions[i], test_labels) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment