CommencerCommencer gratuitement

Training

You're going to train your first model in this course, and for a good cause!

Remember that before training your Keras models you need to compile them. This can be done with the .compile() method. The .compile() method takes arguments such as the optimizer, used for weight updating, and the loss function, which is what we want to minimize. Training your model is as easy as calling the .fit() method, passing on the features, labels and a number of epochs to train for.

The regression model you built in the previous exercise is loaded for you to use, along with the time_steps and y_positions data. Train it and evaluate it on this very same data, let's see if your model can learn the meteor's trajectory.

Cet exercice fait partie du cours

Introduction to Deep Learning with Keras

Afficher le cours

Instructions

  • Compile your model making use of the 'adam' optimizer and 'mse' as your loss function.
  • Fit your model using the features and labels for 30 epochs.
  • Evaluate your model with the .evaluate() method, passing the features and labels used during training.

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

# Compile your model
model.____(____ = ____, ____ = ____)

print("Training started..., this can take a while:")

# Fit your model on your data for 30 epochs
model.____(____,____, epochs = ____)

# Evaluate your model 
print("Final loss value:",model.evaluate(____, ____))
Modifier et exécuter le code