C2W2 Assignment on history

My model that I made, I got 38/50 point on history and got message “Failed test case: the mean squared error between you training and validation accuracy curves is higher than the desired threshold.
Expected:
a MSE of at most 20%,
but got:
82.113%.”

Can you tell me why? And how to solve this problem?

Thank you.

The metric the used for judging model generalization is mean squared error in this case:

def mean_squared_error(y_true, y_pred):
    return np.mean((y_true - y_pred) ** 2)

We want this expression to evaluate to <= 20

acc = history.history["accuracy"]
val_acc = history.history["val_accuracy"]
mean_squared_error(np.array(acc) * 100, np.array(val_acc) * 100)

This means that the training and validation accuracy curves should not be too far off. Remember that you only need to have 80% accuracy for both train and validation sets. Don’t shoot for very high accuracy scores. Focus on generalizing the model by modifying hyper parameters such as:

  1. Augmentations
  2. Model architecture
  3. Optimizer setup