Back

Explore Courses Blog Tutorials Interview Questions
0 votes
3 views
in Machine Learning by (47.6k points)
edited by

When I load the whole dataset in memory and train the network in Keras using the following code:

model.fit(X, y, nb_epoch=40, batch_size=32, validation_split=0.2, verbose=1)

This generates a progress bar per epoch with metrics like ETA, accuracy, loss, etc

When I train the network in batches, I'm using the following code

for e in range(40):

        for X, y in data.next_batch():

            model.fit(X, y, nb_epoch=1, batch_size=data.batch_size, verbose=1)

This will generate a progress bar for each batch instead of each epoch. Is it possible to generate a progress bar for each epoch during batch wise training?

1 Answer

0 votes
by (33.1k points)

You can simply use a progress bar for every epoch in neural network architecture simply by using ‘verbose = 1’ argument in .fit() function.

For example:

model.fit(X, y, nb_epoch=40, batch_size=32, validation_split=0.2, verbose=1)

It'll show your output as:

Epoch 1/100

0s - loss: 0.2506 - acc: 0.5750 - val_loss: 0.2501 - val_acc: 0.3750

Epoch 2/100

0s - loss: 0.2487 - acc: 0.6250 - val_loss: 0.2498 - val_acc: 0.6250

Epoch 3/100

0s - loss: 0.2495 - acc: 0.5750 - val_loss: 0.2496 - val_acc: 0.6250

.....

.....

The above method is the most common method to show a progress bar for the networks.

I hope it helps.

Browse Categories

...