Evaluating models
Two models have been trained and are available: large_model, which has many parameters; and small_model, which has fewer parameters. Both models have been trained using train_features and train_labels, which are available to you. A separate test set, which consists of test_features and test_labels, is also available.
Your goal is to evaluate relative model performance and also determine whether either model exhibits signs of overfitting. You will do this by evaluating large_model and small_model on both the train and test sets. For each model, you can do this by applying the .evaluate(x, y) method to compute the loss for features x and labels y. You will then compare the four losses generated.
This exercise is part of the course
Introduction to TensorFlow in Python
Exercise instructions
- Evaluate the small model using the train data.
- Evaluate the small model using the test data.
- Evaluate the large model using the train data.
- Evaluate the large model using the test data.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Evaluate the small model using the train data
small_train = small_model.evaluate(____, ____)
# Evaluate the small model using the test data
small_test = ____
# Evaluate the large model using the train data
large_train = large_model.evaluate(____, ____)
# Evaluate the large model using the test data
large_test = ____
# Print losses
print('\n Small - Train: {}, Test: {}'.format(small_train, small_test))
print('Large - Train: {}, Test: {}'.format(large_train, large_test))