-1

I am building a basic neural network using Keras and Tensorflow using mnist dataset using the following code:

import os
import tensorflow as tf

from tensorflow import keras
from tensorflow.keras import layers
from tensorflow.keras.datasets import mnist

(x_train, y_train), (x_test, y_test) = mnist.load_data()

x_train = x_train.reshape(-1, 28*28).astype('float32') / 255.0 
x_test = x_test.reshape(-1, 28*28).astype('float32') / 255.0 
print(x_train.shape)
print(x_test.shape)

model = keras.Sequential(
            [
                keras.Input(shape=(28*28)),
                layers.Dense(512, activation="relu"),
                layers.Dense(256, activation="relu"),
                layers.Dense(10), 
            ]
        )

model.compile(
                loss = keras.losses.SparseCategoricalCrossentropy(from_logits=True),
                optimizer = keras.optimizers.Adam(learning_rate=0.001),
                metrics = ['accuracy'],
             )

model.fit(x_train, y_train, batch_size=32, epochs=5, verbose=2)

My output is:

enter image description here

As we can see in the image above, each epoch is only going through 1875 (=60000/32) data points. Shouldn't it go through all the 60000 instances per epoch as there are 60000 records in training dataset?

DumbCoder
  • 233
  • 2
  • 9

1 Answers1

1

It's 1875 batches not 1875 data points. In each epoch it goes though all the data points.

TheEngineerProgrammer
  • 1,282
  • 1
  • 4
  • 9