For the sake of exemplification, let us consider the the time series convolutional neural network (CNN) classifier from the sktime (this question can be applied for any ML model you want to):

from sktime.classification.deep_learning.cnn import CNNClassifier

cnn = CNNClassifier(n_epochs=Ne, batch_size=batch_size) # it runs for Ne epochs
cnn.fit(X_trn, y_trn)

where X_trn and y_trn is the training dataset and its label (i.e., a supervised learning). If the training dataset contains 60 instances and batch_size=4, then the parameter vector of the CNN is iterated 60/4=15 times per epoch. In other words, for each mini-batch of 4 instances, the weights of the CNN is adjusted. Therefore, the accuracy of the CNN model is computer 15 times.

However, cnn.summary()["accuracy"] is a list of Ne accuracies (this length is independent from batch_size), that is, only one accuracy per epoch. How those accuracies obtained in each mini-batch iteration are grouped in order to obtain the overall accuracy per epoch?


1 Answer 1


I unearthed in the source code that this object uses tensorflow.keras.callbacks.History(). As far as I understand, it records history at the end of an epoch by evaluation of the data after all batches are iterated.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.