Week 2 Assignment 2 Last Coding Block Graph

A bit confused here: first we train the model for 5 epochs (initial epochs), then fine-tune it for another 5 epochs (fine-tune epochs) which should be a total of 10 epochs. However, in this coding block for fine-tuning the initial epoch is set to 5, so therefore we are training the 5th epoch again until the 10th epoch which is actually 6 times. The graph below says the fine-tuning begins at the 4th epoch (plt.plot([initial_epochs-1,initial_epochs-1]) , but shouldn’t be this at the 5th epoch (by deleting -1)?

history_fine = model2.fit(train_dataset,
                         epochs=total_epochs,
                         initial_epoch=history.epoch[-1],
                         validation_data=validation_dataset)

Remember that indexing in python is “0 based”. So the 5th element of an array is myArray[4]. And the last element of an array is myArray[-1].

1 Like