Norms
Formal
(Norm)
A norm on a vector space is a function
which assigns each vector to its length , such that and the following hold:
- Absolutely Homogeneous:
- Triangle Inequality:
- Positive Definite: and
(Manhattan Norm)
The Manhattan Norm on id defined for as
where is the absolute value. Manhattan Norm is also called norm.
(Euclidean Norm)
The Euclidean Norm on id defined for as
and computes the Euclidean distance of from the origin. This is also called norm. This is the default.
Intuition
Imagine you have a data structure, like an array or a list, that represents something—say, a user’s engagement score across different features on a website. This is a vector. Now, you want to answer a simple but crucial question: how “big” is this vector? How significant is this user’s overall engagement? A norm is precisely that: a function that takes a vector and gives you a single number representing its length or magnitude.
It solves the problem of quantifying the abstract “length” of a vector in any number of dimensions. Once we can measure the length of vectors, we can start to measure the distance between them. This is the foundation for determining the similarity between data points, which is a cornerstone of many machine learning algorithms.
ML Applications
In the machine learning landscape, norms are not just an abstract concept; they are fundamental to how many algorithms work and are optimized. Here’s where you’ll see them in action:
- Regularization: In models like Linear Regression or Logistic Regression, we often add a penalty to the loss function to prevent overfitting. This penalty is typically the norm (Lasso regularization) or the norm (Ridge regularization) of the model’s weight vector. A large norm for the weight vector often indicates a more complex model that might be overfitting. By penalizing this norm, we encourage the model to find simpler solutions that generalize better.
- Loss Functions: Many loss functions are defined using norms. The Mean Squared Error (MSE), a common loss function for regression, is essentially the squared norm of the difference between the predicted and actual values. The Mean Absolute Error (MAE) is the norm of this difference.
- Distance and Similarity: Algorithms like k-Nearest Neighbors (k-NN) rely on measuring the distance between data points to classify a new point. This distance is calculated using a norm, most commonly the Euclidean norm ( distance).
In essence, norms provide the mathematical toolkit to measure size, distance, and error, which are critical for optimizing and evaluating machine learning models.
Connections
- Forward Links:Inner Products, Lengths and Distances
- Backward Links: Vectors