Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
33 views

Convex Functions

This document summarizes key points from a lecture on convexity-preserving operations and their applications. The lecture covered operations that preserve convexity such as nonnegative weighted sums, composition with affine mappings, and pointwise maximum. It also discussed convex envelopes and their use in cardinality constrained optimization and LASSO. Finally, it provided an overview of support vector machines as an application of supervised learning.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views

Convex Functions

This document summarizes key points from a lecture on convexity-preserving operations and their applications. The lecture covered operations that preserve convexity such as nonnegative weighted sums, composition with affine mappings, and pointwise maximum. It also discussed convex envelopes and their use in cardinality constrained optimization and LASSO. Finally, it provided an overview of support vector machines as an application of supervised learning.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

ORF 523 Lecture 8 Spring 2017, Princeton University

Instructor: A.A. Ahmadi


Scribe: G. Hall Thursday, March 9, 2017

When in doubt on the accuracy of these notes, please cross check with the instructor’s notes,
on aaa. princeton. edu/ orf523 . Any typos should be emailed to gh4@princeton.edu.

1 Outline
• Convexity-preserving operations

• Convex envelopes, cardinality constrained optimization and LASSO

• An application in supervised learning: support vector machines (SVMs)

2 Operations that preserve convexity


The role of convexity preserving operations is to produce new convex functions out of a
set of “atom” functions that are already known to be convex. This is very important for
broadening the scope of problems that we can recognize as efficiently solvable via convex
optimization. There is a long list of convexity-preserving rules; see section 3.2 of [2]. We
present only a few of them here. The software CVX has a lot of these rules built in [1],[4].

2.1 Nonnegative weighted sums


Rule 1. If f1 , . . . , fm : Rn → R are convex functions and ω1 , . . . , ωm are nonnegative scalars
then

f (x) = ω1 f1 (x) + . . . + ωm fm (x)

is convex also. Similarly, a nonnegative weighted sum of concave functions is concave.


Exercise: If f1 , f2 are convex functions,
• is f1 − f2 convex?

• is f1 · f2 convex?
f1
• is f2
convex?

1
2.2 Composition with an affine mapping
Rule 2. Suppose f : Rn → R, A ∈ Rn×m , and b ∈ Rn . Define g : Rm → R as

g(x) = f (Ax + b)

with dom(g) = {x|Ax + b ∈ dom(f )}. Then, if f is convex, so is g; if f is concave, so is g.

The proof is a simple exercise.


Example: The following function is immediately seen to be convex. (Without knowing the
previous rule, it would be much harder to prove convexity.)

f (x1 , x2 ) = (x1 − 2x2 )4 + 2e3x1 +2x2 −5

2.3 Pointwise maximum


Rule 3. If f1 , . . . , fm are convex functions, then their pointwise maximum

f (x) = max{f1 (x), . . . , fm (x)},

with dom(f ) = dom(f1 ) ∩ . . . ∩ dom(fm ) is also convex.

Figure 1: An illustration of the pointwise maximum rule

Proof: Pick any x, y ∈ dom(f ), λ ∈ [0, 1]. Then,

f (λx + (1 − λ)y) = fj (λx + (1 − λ)y) (for some j ∈ {1, . . . , m})


≤ λfj (x) + (1 − λ)fj (y)
≤ λ max{f1 (x), . . . , fm (x)} + (1 − λ) max{f1 (y), . . . , fm (y)}
= λf (x) + (1 − λ)f (y). 

2
• It is also easy to prove this result using epigraphs. Recall that f convex ⇔ epi(f ) is
convex. But epi(f ) = ∩m i=1 epi(fi ), and we know that the intersection of convex sets is
convex.

• One can similarly show that the pointwise minimum of two concave functions is con-
cave.

• But the pointwise minimum of two convex functions may not be convex.

2.4 Restriction to a line


Rule 4. Let f : Rn → R be a convex function and fix some x, y ∈ Rn . Then the function
g : R → R given by g(α) = f (x + αy) is convex.

Figure 2: An illustration of the restriction to a line rule (image credit: [6])

3
Many algorithms for unconstrained convex optimization (e.g., steepest descent with exact
line search) work by iteratively minimizing a function over lines. It’s useful to remember
that the restriction of a convex function to a line remains convex. This tells us that in each
subproblem we are faced with a univariate convex minimization problem, and hence we can
simply find a global minimum e.g. by finding a zero of the first derivative.

2.5 Power of a nonnegative function


Rule 5. If f is convex and nonnegative (i.e., f (x) ≥ 0, ∀x) and k ≥ 1, then f k is convex.

Proof: We prove this in the case where f is twice differentiable. Let g = f k . Then

∇g(x) = kf k−1 ∇f (x)


∇2 g(x) = k (k − 1)f k−2 ∇f (x)∇f T (x) + f k−1 ∇2 f (x) .


We see that ∇2 g(x)  0 for all x (why?). 

Does this result hold if you remove the nonnegativity assumption on f ?

3 Convex envelopes
Definition 1. The convex envelope (or convex hull) convD f of a function f : Rn → R
over a convex set D ⊆ Rn is “the largest convex underestimator of f on D”; i.e.,

if h(x) ≤ f (x) ∀x ∈ D and h is convex ⇒ h(x) ≤ convD f (x), ∀x ∈ D.

Figure 3: The convex envelope of a function over two different sets

• Equivalently, convD f (x) is the pointwise maximum of all convex function that lie
below f (on D).

4
• As the pictures suggest, the epigraph of conv f is the convex hull of the epigraph of f .

• Computing convex hulls of functions is in general a difficult task; e.g., computing


the convex envelope of a mulitilinear function over the unit hypercube is NP-hard [3].
Indeed if we could compute convD f , then we could minimize f over D as the following
statement illustrates.

Theorem 1 ([5]). Consider the problem minx∈S f (x), where S is a convex set. Then,

f ∗ := min f (x) = min convS f (x) (1)


x∈S x∈S

and

{y ∈ S| f (y) = f ∗ } ⊆ {y ∈ S| convS f (y) = f ∗ }. (2)

Proof: First we prove (1). As convS f is an underestimator of f , we clearly have

min convS f ≤ min f (x).


x∈S x∈S

To see the converse, note that the constant function g(x) = f ∗ is a convex underestimator
of f . Hence, we must have convS f (x) ≥ f ∗ , ∀x ∈ S.

To prove (2), let y ∈ S be such that f (y) = f ∗ . Suppose for the sake of contradiction that
convS f (y) < f ∗ . But this means that the function

max{f ∗ , convS f }

is convex (why?), an underestimator of f on D (why?), but larger than convS f at y. This


contradicts convS f being the convex envelope. 
Example: In simple cases, the convex envelope of some functions over certain sets can be
computed. A well-known example is the envelope of the function l0 (x) := ||x||0 , which is
the function l1 (x) = ||x||1 . The l0 “pseudonorm”, also known as the cardinality function, is
defined as
||x||0 = # of nonzero elements of x.
This function is not a norm (why?) and is not convex (why?).

Theorem 2. The convex envelope of the l0 pseudonorm over the set {x| ||x||∞ ≤ 1} is the
l1 function.

5
This simple observation is the motivation (or one motivation) behind many heuristics for l0
optimization like compressed sensing, LASSO, etc.

3.1 LASSO [7]


LASSO stands for least absolute shrinkage and selection operator. It is simply a least squares
problem with an l1 penalty
min ||Ax − b||2 + λ||x||1 ,
x

where λ > 0 is a fixed parameter. This is a convex optimization problem (why?).

• By increasing λ, we increase our preference for having sparse solutions.

• By decreasing λ, we increase our preference for decreasing the regression error.

Here’s the idea behind why this could be useful. Consider a very simple scenario where you
are given m data points in Rn and want to fit a function f to the data that minimizes the
sum of the squares of the deviations. The problem is, however, that you don’t have a good
idea of what function class exactly f belongs to. So you decide to throw in a lot of functions
in your basis: maybe you include a term for every monomial up to a certain degree, you
add trigonometric functions, exponential functions, etc. After this, you try to write f as a
linear combination of this massive set of basis functions by solving an optimization problem
that finds the coefficients of the linear combination. Well, if you use all the basis functions
(nonzero coefficients everywhere), then you will have very small least squares error but you
would be overfitting the data like crazy. What LASSO tries to do, as you increase λ, is to
set many of these coefficients equal to zero and tell you (somehow magically) that which of
the basis functions were actually important for fitting the data and which weren’t.

6
4 Support vector machines
• Support vector machines (SVM) constitute a prime example of supervised learning. In
such a setting, we would like to learn a classifier from a labeled data set (called the
training set). The classifier is then used to label future data points.

• A classic example is an email spam filter:

– Given a large number of emails with correct labels “spam” or “not spam”, we
would like an algorithm for classifying future emails as spam or not spam.
– The emails for which we already have the labels constitute the “training set”.

Figure 4: An example of a good spam filter

• A basic approach is to associate a pair (xi , yi ) to each email: yi is the label, which is
either 1 (spam) or −1 (not spam). The vector xi ∈ Rn is called a feature vector ; it
collects some relevant information about email i. For example:

– How many words are in the email?


– How many misspelled words?
– How many links?
– Is there a $ sign?
– Does the word “bank account” appear?
– Is the sender’s email client trustworthy?
– ...

7
• If we have m emails, we end up with m vectors in Rn , each with a label ±1. Here is a
toy example in R2 :

Figure 5: An example of a labeled training with only two features

• The goal is now to find a classifier f : Rn → R, which takes a positive value on spam
emails and a negative value on non-spam emails.

• The zero level set of f serves as a classifier for future predictions.

• We can search for many classes of classifier functions using convex optimization.

• The simplest one is linear classification: f (x) = aT x − b.

• Here, we need to find a ∈ Rn , b ∈ R that satisfy

aT xi − b > 0 if yi = 1
aT xi − b < 0 if yi = −1

• This is equivalent (why?) to finding a ∈ Rn , b ∈ R that satisfy:

yi (aT xi − b) ≥ 1, i = 1, . . . , m.

8
• This is a convex feasibility problem (in fact a set of linear inequalities). It may or may
not be feasible (compare examples above and below). Can you identify the geometric
condition for feasibility of linear classification? (Hint: think of convex hulls.)

Figure 6: An example of linearly separable data

• When linear separation is possible, there could be many (in fact infinitely many) linear
classifiers to choose from. Which one should we pick?

• As we explain next, the following optimization problem (known as maximum-margin


SVM ) tries to find the most “robust” one:

min ||a|| (3)


a,b

s.t. yi (aT xi − b) ≥ 1, i = 1, . . . , m.

– This is a convex optimization problem (why?).


– Its optimal solution is unique (why?).
– But what exactly is this optimization problem doing?

9
Claim 1. The optimization problem above is equivalent to

max t
a,b,t

s.t. yi (aT xi − b) ≥ t, i = 1, . . . , m, (4)


||a|| ≤ 1.

Claim 2. An optimal solution of (4) always satisfies ||a|| = 1.

Claim 3. The Euclidean distance of a point v ∈ Rn to a hyperplane aT z = b is given by


|aT v − b|
.
||a||

• Let’s believe these three claims for the moment. What optimization problem (3) is
then doing is finding a hyperplane that maximizes the minimum distance between the
hyperplane (our classifier) and any of our data points. Do you see why?

• We are trying to end up with as wide a margin as possible. Formally, the margin is
defined to be the distance between the two gray hyperplanes in the figure above. What
is the length of this margin in terms of a∗ (ans possibly b∗ )?

• Having a wide margin helps us be robust to noise, in case the feature vector of our
future data points happens to be slightly misspecified.

The proof of the three claims are given as homework. Here are a few hints:

10
• Claim 1: how would you get feasible solutions to one from the other?

• Claim 2: how would you improve the objective if it didn’t?

• Claim 3: good exercise of our optimality conditions.

4.1 Data that is not linearly separable


• What if the data points are not linearly separable?

• Idea: let’s try to minimize the number of points misclassified:

min ||η||0
a,b,η

s.t. yi (aT xi − b) ≥ 1 − ηi , i = 1, . . . , m
ηi ≥ 0, i = 1, . . . , m.

• Here, ||η||0 denotes th number of nonzero elements of η.

• If ηi = 0, data point i is correctly classified.

• The optimization problem above is trying to set as many entries of η to zero as possible.

– Unfortunately, it is a hard problem to solve.


– Which entries to set to zero? Many different subsets to consider.
– As a powerful heuristic for this problem, people solve the following problem in-
stead:

min ||η||1
a,b,η

s.t. yi (aT xi − b) ≥ 1 − ηi , i = 1, . . . , m
ηi ≥ 0, i = 1, . . . , m.

11
• This is a convex program (why?). We can solve it efficiently.

• The solution with minimum l1 norm tends to be sparse; i.e., has many entries that are
zero.

• Note that when ηi ≤ 1, data point i is still correctly classified but it falls within our
margin; hence it is not “robustly classified”.

• When ηi > 1, data point i is misclassified.

• We can solve a modified optimization problem to balance the tradeoff between the
number of missclassified points and the width of our margin:

min ||a|| + γ||η||1


a,b,η

s.t. yi (aT xi − b) ≥ 1 − ηi , i = 1, . . . , m
ηi ≥ 0, i = 1, . . . , m.

• γ ≥ 0 is a parameter that we fix a priori.

• Larger γ means we assign more importance to reducing number of misclassified points.

• Smaller γ means we assign more importance to having a large margin.


2
– Note that the length of our margin (counting both sides) is ||a||
(why?).

• For each γ, the problem is a convex program (why?).

• On your homework, you will run some numerical experiments on this problem.

12
Notes
Further reading for this lecture can include Chapter 3 of [2]. You can read more about SVMs
in Section 8.6 of [2].

References
[1] S. Boyd and M. Grant. Graph implementations for nonsmooth convex programs. Recent
Advances in Learning and Control. Springer-Verlag, 2008.

[2] S. Boyd and L. Vandenberghe. Convex Optimization. Cambridge University Press,


http://stanford.edu/ boyd/cvxbook/, 2004.

[3] Y. Crama. Recognition problems for special classes of polynomials in 0-1 variables.
Mathematical Programming, 44, 1989.

[4] Inc. CVX Research. CVX: Matlab software for disciplined convex programming, version
2.0. Available online at http://cvxr.com/cvx, 2011.

[5] D.Z. Du, P.M. Pardalos, and W. Weili. Mathematical Theory of Optimization. Kluwer
Academic Publishers, 2001.

[6] J.R. Shewchuk. An introduction to the conjugate gradient method without the agonizing
pain. Carnegie-Mellon University. Department of Computer Science, 1994.

[7] R. Tibshirani. Regression shrinkage and selection via the Lasso. Journal of the Royal
Statistical Society. Series B (Methodological), pages 267–288, 1996.

13

You might also like