Complete the code to print the training loss after each epoch.
for epoch in range(5): loss = model.train_one_epoch(data) print('Epoch', epoch, 'Loss:', [1])
The variable loss holds the training loss for the current epoch, so printing it shows progress.
Complete the code to update the progress bar with the current accuracy.
for batch in data_loader: predictions = model.predict(batch) accuracy = compute_accuracy(predictions, batch.labels) progress_bar.update([1]=accuracy)
accuracy as the parameter name.score which is undefined.The progress bar's update method expects the current progress as the value argument.
Fix the error in the code to correctly log the validation accuracy after each epoch.
for epoch in range(10): val_acc = evaluate(model, val_data) logger.log('Validation Accuracy:', [1])
val_acc as a function.The variable val_acc stores the accuracy value. Calling it as a function causes an error.
Fill both blanks to create a dictionary that maps epoch numbers to their loss values.
loss_history = { [1]: [2] for [1] in range(1, 6) }The dictionary keys are epoch numbers stored in epoch, and values are the corresponding loss values.
Fill all three blanks to filter and store epochs where accuracy is above 0.8.
high_acc_epochs = { [1]: [2] for [1] in epochs if [3][[1]] > 0.8 }We use epoch as the key, accuracy as the value, and check if acc_dict[epoch] is greater than 0.8.