Critical Points and Extrema
When optimizing a machine learning model, our goal is often to find the parameter values that minimize a loss function. These optimal points are typically found at the "bottom" of valleys or the "top" of hills on the loss surface. In calculus, these turning points are known as extrema, and the specific locations where they might occur are called critical points. Understanding how to identify and classify critical points is fundamental to solving optimization problems, from simple curve fitting to complex neural network training.
Defining Critical Points
A critical point of a function is any point in the domain of where the first derivative is either zero or undefined. These points are significant because they are the only candidates for local maxima or local minima. Intuitively, if a function is smoothly changing direction from increasing to decreasing (or vice-versa), its tangent line must be horizontal, meaning its derivative is zero. If the function has a sharp corner or a discontinuity, the derivative might not exist at that point, also indicating a potential turning point.
For a function , a point is a critical point if:
- (the tangent line is horizontal)
- is undefined (e.g., a sharp corner, cusp, or vertical tangent)
Finding Critical Points: Derivative Equals Zero
The most common way to find critical points is to compute the first derivative of the function and set it equal to zero. Solving the resulting equation for will yield the -coordinates of these critical points. This approach works well for polynomial functions and other differentiable functions where the derivative is always defined. These points correspond to where the function's slope momentarily flattens out.
Finding Critical Points: Derivative Undefined
Some functions have critical points where their derivative does not exist. This often occurs at sharp corners (like in the absolute value function), cusps, or points where the tangent line is vertical. These are points where the function's smoothness breaks down, but they still represent potential locations for local extrema. When analyzing a function, always consider its domain and points where its derivative might become undefined, such as denominators becoming zero or arguments of square roots becoming negative.
Classifying Extrema: The First Derivative Test
Once critical points are identified, the First Derivative Test helps classify them as local maxima, local minima, or neither. This test involves examining the sign of the first derivative on either side of a critical point. If the derivative changes from positive to negative, it indicates a local maximum. A change from negative to positive signifies a local minimum. If the derivative's sign does not change, the critical point is typically a saddle point (or an inflection point in 1D), where the function flattens but continues in the same direction.
The Second Derivative Test
An alternative method for classifying critical points is the Second Derivative Test. This test uses the concavity of the function at a critical point to determine if it's a local maximum or minimum. If , the function is concave up, indicating a local minimum. If , the function is concave down, indicating a local maximum. However, if , the test is inconclusive, and you must revert to the First Derivative Test.
Given a critical point where :
- If , then is a local minimum.
- If , then is a local maximum.
- If , the test is inconclusive.
Absolute Extrema on a Closed Interval
For a continuous function on a closed interval , the Extreme Value Theorem guarantees that both an absolute maximum and an absolute minimum exist. These absolute extrema must occur either at a critical point within the interval or at one of the endpoints or . To find them, you evaluate the function at all critical points in the interval and at the endpoints, then compare these values to find the largest and smallest.
Critical Points in Machine Learning Optimization
In machine learning, we often train models by minimizing a loss function , where represents the model's parameters. The goal is to find the values that yield the smallest possible loss. This is an optimization problem, and the techniques for finding critical points are directly applicable. We seek parameters where the gradient of the loss function, , is zero. These critical points can be local minima (our desired outcome), local maxima, or saddle points. Gradient descent algorithms iteratively move towards these critical points, ideally converging to a local minimum.
Critical points are locations where a function's first derivative is zero or undefined, making them candidates for local extrema.
To find critical points, calculate the first derivative and solve for where or is undefined.
The First Derivative Test classifies critical points by observing the sign change of around the point: positive to negative for a local maximum, negative to positive for a local minimum, and no change for a saddle point.
The Second Derivative Test offers an alternative classification: indicates a local minimum, indicates a local maximum. If , the test is inconclusive.
For a continuous function on a closed interval, absolute extrema occur at either critical points within the interval or at the interval's endpoints.
In machine learning, critical points of loss functions correspond to potential optimal parameter settings, with local minima being the desired outcome for model training.