Machine Learning with Spark(Second Edition)
上QQ阅读APP看书,第一时间看更新

Lagranges multipliers

In the math optimization problem, the method of Lagrange multipliers is used as a tool for finding the local minima and maxima of a function subject to equality constraints. An example involves finding the maximum entropy distribution subject to given constraints.

This is best explained with an example. Let's say we have to maximize K (x, y) = -x2 -y2 subject to y = x + 1.

The constraint function is g (x, y) = x-y+1=0. The L multiplier then becomes this:

Differentiating with respect to x, y, and lambda, and setting to 0 we get the following:

Solving the preceding equations, we get x=-0.5, y=0.5, lambda=-1.