The configuration step that makes fit() work
Before you can call model.fit(), you must compile() the model. This wires together the optimizer (how weights update), the loss (what we minimize), and metrics (what we monitor). Three choices that determine whether your training works at all.
Use string shortcuts ('adam', 'sparse_categorical_crossentropy') for fast experiments. Use instance objects when you need to tune hyperparameters — learning rate, optimizer beta values, loss class weights, etc.