February 2018
Intermediate to advanced
262 pages
6h 59m
English
The training steps for the model are the same as the previous example. Let's just look at the code to call the fit method and the results it generated:
train_losses , train_accuracy = [],[]val_losses , val_accuracy = [],[]for epoch in range(1,5): epoch_loss, epoch_accuracy = fit(epoch,model,train_iter,phase='training') val_epoch_loss , val_epoch_accuracy = fit(epoch,model,test_iter,phase='validation') train_losses.append(epoch_loss) train_accuracy.append(epoch_accuracy) val_losses.append(val_epoch_loss) val_accuracy.append(val_epoch_accuracy)
We ran the model for four epochs, which gave approximately 83% accuracy. Here are the results of running the model:
training loss is 0.59 and training accuracy is 16724/25000 66.9 ...