I was working with Tensorflow’s MNIST Image Classification project link: (Basic classification: Classify images of clothing | TensorFlow Core), and during verify predictions phase, this code stated that plot_value_array was not defined even though I followed everything according to the tutorial that can be accessed, tried to work with the problem but I had no success finding a solution
#Verify predictions
i = 0
plt.figure(figsize=(6,3))
plt.subplot(1,2,1)
plot_image(i, predictions[i], test_labels, test_images)
plt.subplot(1,2,2)
plot_value_array(i, predictions[i], test_labels)
plt.show()
If you use Colab the most likely issue would be that you need to re-run the cell that defines the function
Hi @Ata_Tekeli, I have executed the code in the colab but i did not face error. Could you please share the error you are facing. Thank You.
It says plot_value_array is not defined
Hi @Ata_Tekeli, There is a function defined for plot_value_array
def plot_value_array(i, predictions_array, true_label):
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('blue')
You have to execute this function before your code. Thank You.