Skip to Content
Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow, 2nd Edition
book

Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow, 2nd Edition

by Aurélien Géron
September 2019
Intermediate to advanced content levelIntermediate to advanced
848 pages
24h 18m
English
O'Reilly Media, Inc.
Content preview from Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow, 2nd Edition

Appendix C. SVM Dual Problem

To understand duality, you first need to understand the Lagrange multipliers method. The general idea is to transform a constrained optimization objective into an unconstrained one, by moving the constraints into the objective function. Let’s look at a simple example. Suppose you want to find the values of x and y that minimize the function f(x, y) = x2 + 2y, subject to an equality constraint: 3x + 2y + 1 = 0. Using the Lagrange multipliers method, we start by defining a new function called the Lagrangian (or Lagrange function): g(x, y, α) = f(x, y) – α(3x + 2y + 1). Each constraint (in this case just one) is subtracted from the original objective, multiplied by a new variable called a Lagrange multiplier.

Joseph-Louis Lagrange showed that if (x^,y^) is a solution to the constrained optimization problem, then there must exist an α^ such that (x^,y^,α^) is a stationary point of the Lagrangian (a stationary point is a point where all partial derivatives are equal to zero). In other words, we can compute the partial derivatives of g(x, y, α) with regard to x, y, and α; we can find the points where these derivatives are all equal to zero; and the solutions to the constrained optimization problem (if they exist) must be among these stationary points.

In this example the partial derivatives are: xg(x,y,α)=2x-3αyg(x,y,α)=2-2ααg(x,y,α)=-3x-2y-1

When all these partial derivatives are equal to 0, we find that 2 x ^ - 3 α ^ = 2 - 2 α ^ = -3 x ^ - 2

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow, 3rd Edition

Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow, 3rd Edition

Aurélien Géron
Machine Learning with PyTorch and Scikit-Learn

Machine Learning with PyTorch and Scikit-Learn

Sebastian Raschka, Yuxi (Hayden) Liu, Vahid Mirjalili

Publisher Resources

ISBN: 9781492032632Errata Page