Interactive Tools:¶
Gradient Visualizer - Use this tool to visualize the gradient vector fields associated with a surface.
Gradient Ascent Visualizer. - Use this tool to visualize gradient ascent on the same surfaces provided in the Gradient Visualizer.
Least Squares Visualizer - Use this tool to visualize the mean square error objective function used in least squares regression.
Partial Derivatives¶
All definitions and results are available in Section 9.1.
A partial derivative of a surface is a derivative with respect to one of the variables, holding all the rest fixed.
For example: .
The partial derivative of with respect to is the slope of the tangent line to its cross-section
To compute partial derivatives, pretend every variable except the variable in the subscript is a constant, then take an ordinary derivative with respect to the variable in the subscript.
To linearize a surface about some input vector , compute:
The function defines the tangent plane to the surface at the input . It is the plane containing the tangent lines to every cross section of the surface at .
Gradients¶
All definitions and results are available in Section 9.2.
The gradient of a surface at an input vector is the vector of all the partial derivatives of at :
A gradient is a vector-valued function of
To compute a gradient, just compute the all of the partial derivatives
The gradient:
points in the direction of steepest ascent (the negative gradient points in the direction of steepest descent)
has magnitude equal to the fastest possible rate of ascent on the surface
is perpendicular to the level sets of where it is not zero
So, given a contour plot, we can draw the gradients by adding arrows, perpendicular to the level sets, pointing uphill
The tangent-plane at can be expressed concisely using the gradient:
The directional derivative of , at , in the direction , is the slope of the surface along a path, passing through , in the direction :
where is the unit vector pointing in the direction .
To compute a directional derivative, use the formula:
where is the angle between and .
Multivariate Optimization (Unconstrianed)¶
All definitions and results are available in Section 9.3.
An unconstrained optimization problem asks for the inputs that maximize (or minimize) a function.
Typically, we optimize iteratively, by moving uphill in the direction of the gradient. This approach is called gradient ascent.
If is a smooth surface, and our problem is unconstrained, then:
is not an extrema (maximum or minimum) unless .