Loss Function

A loss function (also called a cost or objective function) measures how far a model’s predictions are from the desired outcomes, producing a single number that training tries to make as small as possible. The “Machine Learning Basics” chapter of Goodfellow, Bengio, and Courville’s “Deep Learning” frames learning as minimizing a cost function that captures the model’s performance, typically the average error over the training examples.

Different tasks use different loss functions. Predicting a number often uses squared error, which penalizes large misses heavily, while classification often uses cross-entropy, which rewards confident correct answers and punishes confident wrong ones. The loss function turns a vague goal like “be accurate” into a precise mathematical target.

Choosing the loss function is a design decision that encodes what you care about. A loss that ignores rare but costly errors will produce a model that does the same.

Why business readers should care: The loss function quietly defines what an AI system optimizes for. If it does not reflect real business priorities, such as the high cost of a missed fraud case, the model will optimize the wrong thing even while its numbers look good.

Sources

Last verified June 6, 2026