Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Data Science by (19k points)

I have just built my first model using Keras and this is the output. It looks like the standard output you get after building any Keras artificial neural network. Even after looking in the documentation, I do not fully understand what the epoch is and what the loss is which is printed in the output.

What is epoch and loss in Keras?

(I know it's probably an extremely basic question, but I couldn't seem to locate the answer online, and if the answer is really that hard to glean from the documentation I thought others would have the same question and thus decided to post it here.)

Epoch 1/20

1213/1213 [==============================] - 0s - loss: 0.1760     

Epoch 2/20

1213/1213 [==============================] - 0s - loss: 0.1840     

Epoch 3/20

1213/1213 [==============================] - 0s - loss: 0.1816     

Epoch 4/20

1213/1213 [==============================] - 0s - loss: 0.1915     

Epoch 5/20

1213/1213 [==============================] - 0s - loss: 0.1928     

1 Answer

0 votes
by (33.1k points)
edited by

Keras output mainly shows epoch and loss after each iteration. 

Epoch: In terms of artificial neural networks, an epoch refers to one cycle through the full training dataset. Usually, training a neural network takes more than a few epochs.

Loss: A scalar value that we attempt to minimize during our training of the model. The lower the loss, the closer our predictions are to the true labels.

You should include a list of metrics in your compile method, which could look like:

model.compile(optimizer='rmsprop', loss='categorical_crossentropy', metrics=['accuracy'])

You can run your model on validation during the fit method, such as:

model.fit(data, labels, validation_split=0.2)

If you wish to learn Python, then check out this Python Course by Intellipaat.

Hope this answer helps.

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...