# Importing the required Keras modules containing model and layers
from keras.models import Sequential
from keras.layers import Dense, Conv2D, Dropout, Flatten, MaxPooling2D,Conv2DTranspose
from keras.utils.vis_utils import plot_model
# Creating a Sequential Model and adding the layers
model = Sequential()
#63 kernels - Conv of 3X3
model.add(Conv2D(63, kernel_size=(3,3), input_shape=input_shape))
#Then pooling of 2X2
model.add(MaxPooling2D(pool_size=(2, 2)))
# Flattening the 2D arrays for fully connected layers
model.add(Flatten())
model.add(Dense(1000, activation=tf.nn.relu))
model.add(Dropout(0.2)) #Combat Overfitting, drop random elements
#Softmax layer must have neurons = range of labels, 0-9 for this case
model.add(Dense(10,activation=tf.nn.softmax))
#Visualize Network Architecture
plot_model(model, to_file='model_plot.png', show_shapes=True, show_layer_names=True)
model.compile(optimizer='adam',
loss='sparse_categorical_crossentropy',
metrics=['accuracy'])
history = model.fit(x=x_train,y=y_train,batch_size=batch_size,
epochs=30,
verbose=verbosity,
validation_split=validation_split)
Here as u can see above , we have the loss function ='sparse_categorical_crossentropy', but model runs through 30 epoch , generating training and validation loss for each epoch. In this case we have a class of 10, stated in the last dense layer.
*****My question is how do we compute the total loss of to 30 epoch based on sparse_categorical_crossentropy on all 30 epochs and not individual losses for each epoch.