Session Ready
Exercise

Challenge the champion

Having pushed your random forest to production, you suddenly worry that a naive Bayes classifier might be better. You want to run a champion-challenger test, by comparing a naive Bayes, acting as the challenger, to exactly the model which is currently in production, which you will load from file to make sure there is no confusion. You will use the F1 score for assessment. You have the data X_train, X_test, y_train and y_test available as before and GaussianNB(), f1_score() and pickle().

Instructions
100 XP
  • Load the existing model from memory using pickle.
  • Fit a Gaussian Naive Bayes classifier to the training data.
  • Print the F1 score of the champion and then the challenger on the test data.
  • Overwrite the current model to disk with the one that performed best.