Doubt in the code

Why did we use
.reshape(28,28)
in the line
img = X[3].reshape(28,28)

Hey @Sid10, the initial size of the dataset is (42000, 784). This means that there are 42000 images and every image has 784 pixels (1 row represents 1 image). Now to visualise(plot) this image we need to convert it into 2D dimensions and hence 784 can be broken into 2 dimensions as (28*28).
So img = X[3].reshape(28,28) means that you have selected 3rd image or 3rd row and reshaped it from 784 to (28 * 28) and then plotted it.

Hope this helps.
Happy Learning :slight_smile: