The loss function measures the guess against the correct answer.

The loss function measures the guess against the answer. (Action, Object)

Example

Example using mean_squared_error for the loss and stochastic gradient descent (sgd) for the optimizer.

# add loss and optimizer to model
model.compile(optimizer='sgd', loss='mean_squared_error')