Compiling the model

Now that we have defined the model, the next step is to compile it. In this phase, we set up how the model should learn. We define three parameters when compiling the model:

  • The optimizer parameter: This defines the optimization algorithm we want to use; for example, the gradient descent, in this case.
  • The loss parameter: This is the objective function that we are trying to minimize; for example, the mean squared error or cross-entropy loss.
  • The metrics parameter: This is the metric through which we want to assess the model's performance; for example, accuracy. We can also specify more than one metric.

Run the following code to compile the model:

model.compile(loss='binary_crossentropy', optimizer='sgd', metrics=['accuracy'])
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset