1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to Deep Learning with Keras

Exercise

Training with cross-validation

Time to train your model with the best parameters found: 0.001 for the learning rate, 50 epochs, a 128 batch_size and relu activations.

The create_model() function from the previous exercise is ready for you to use. X and y are loaded as features and labels.

Use the best values found for your model when creating your KerasClassifier object so that they are used when performing cross_validation.

End this chapter by training an awesome tuned model on the breast cancer dataset!

Instructions

100 XP
  • Import KerasClassifier from tensorflow.keras scikit_learn wrappers.
  • Create a KerasClassifier object providing the best parameters found.
  • Pass your model, features and labels to cross_val_score to perform cross-validation with 3 folds.