When you compile a model, you choose an optimizer, a loss function, and metrics to watch. The loss shows how well the model is learning during training. The optimizer decides how the model changes to get better. The metrics help you understand the model's performance in ways that matter for your goal.
For example, if you want to classify images, accuracy might be a good metric. But if you want to detect rare events, precision or recall might be better. Choosing the right loss and metrics helps you know if your model is improving and if it will work well in real life.