Understanding Common Loss Functions Across Machine Learning Models
This article explains the purpose of loss functions in machine learning and reviews the specific loss functions used by popular algorithms such as linear regression (MSE), logistic regression (cross‑entropy), decision trees, random forests, SVM (hinge loss), neural networks, and AdaBoost (exponential loss).
In machine learning, the core objective of algorithms is to minimize or optimize a function known as the loss (or cost) function, which measures the discrepancy between predictions and actual values.
Linear Regression: Mean Squared Error (MSE)
Linear regression seeks the best‑fit line for the data, using the mean squared error (MSE) as its loss function.
Here, y is the actual value, ŷ is the predicted value, and n is the number of observations.
Logistic Regression: Cross‑Entropy Loss
Logistic regression addresses binary classification problems and employs cross‑entropy (log loss) as its loss function.
In this case, y denotes the true label (0 or 1) and p is the predicted probability of the positive class.
Decision Trees and Random Forests
Classifiers use Gini impurity or information gain.
Regressors use mean squared error (MSE).
Support Vector Machine (SVM): Hinge Loss
SVMs use hinge loss as their loss function.
Here, y is the true label (±1) and f(x) is the predicted value.
Neural Networks
Neural networks can tackle various problem types, thus they can use multiple loss functions.
Regression: mean squared error (MSE).
Classification: cross‑entropy loss.
AdaBoost: Exponential Loss
AdaBoost is an ensemble learning algorithm that combines weak classifiers into a strong one; at each iteration it assigns higher weights to mis‑classified instances and minimizes a weighted exponential loss.
In this context, y is the true label and p is the predicted value.
Model Perspective
Insights, knowledge, and enjoyment from a mathematical modeling researcher and educator. Hosted by Haihua Wang, a modeling instructor and author of "Clever Use of Chat for Mathematical Modeling", "Modeling: The Mathematics of Thinking", "Mathematical Modeling Practice: A Hands‑On Guide to Competitions", and co‑author of "Mathematical Modeling: Teaching Design and Cases".
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.