30
1 Convex Optimization for Data Science Gasnikov Alexander [email protected] Lecture 2. Convex optimization and Big Data applications October, 2016

Convex Optimization for Data Science1 Convex Optimization for Data Science Gasnikov Alexander [email protected] Lecture 2. Convex optimization and Big Data applications October,

  • Upload
    others

  • View
    31

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Convex Optimization for Data Science1 Convex Optimization for Data Science Gasnikov Alexander gasnikov.av@mipt.ru Lecture 2. Convex optimization and Big Data applications October,

1

Convex Optimization for Data Science

Gasnikov Alexander

[email protected]

Lecture 2. Convex optimization and Big Data applications

October, 2016

Page 2: Convex Optimization for Data Science1 Convex Optimization for Data Science Gasnikov Alexander gasnikov.av@mipt.ru Lecture 2. Convex optimization and Big Data applications October,

2

Main books:

Nemirovski A. Lectures on modern convex optimization analysis, algorithms,

and engineering applications. – Philadelphia: SIAM, 2013.

Nesterov Yu., Shpirko S. Primal-dual subgradient method for huge-scale linear

conic problem // SIAM Journal on Optimization. – 2014. – V. 24. –no. 3. – P.

1444–1457.

Bubeck S. Convex optimization: algorithms and complexity // In Foundations

and Trends in Machine Learning. – 2015. – V. 8. – no. 3-4. – P. 231–357.

Blum A., Hopcroft J., Kannan R. Foundations of Data Science. Draft, June

2016. http://www.cs.cornell.edu/jeh/book2016June9.pdf

Gasnikov A. Searching equilibriums in large transport networks. Doctoral The-

sis. MIPT, 2016. https://arxiv.org/ftp/arxiv/papers/1607/1607.03142.pdf

Richtarik P. http://www.maths.ed.ac.uk/~prichtar/

Wright S.J. http://www.optimization-online.org/DB_FILE/2016/12/5748.pdf

Duchi J.C. http://stanford.edu/~jduchi/PCMIConvex/Duchi16.pdf

Page 3: Convex Optimization for Data Science1 Convex Optimization for Data Science Gasnikov Alexander gasnikov.av@mipt.ru Lecture 2. Convex optimization and Big Data applications October,

3

Structure of Lecture 2

Google problem (Page Rank)

Inverse problems: traffic demand matrix estimation from link loads

Empirical Risk Minimization (ERM)

Maximum Likelihood Estimation (MLE)

Bayesian inference

L1-optimization (sparse solution)

Typical Data Science problem formulation (as optimization problem)

Dual problem

Traffic assignment problem

Truss topology design

Page 4: Convex Optimization for Data Science1 Convex Optimization for Data Science Gasnikov Alexander gasnikov.av@mipt.ru Lecture 2. Convex optimization and Big Data applications October,

4

Google problem (Page Rank)

Let there are 1N users that independently walk at random on the web-

graph (n vertexes). Assume that transitional probability matrix of random

walks P is irreducible and aperiodic. Let’s denote in t – the number of us-

ers at the i -th web-page at the moment of time t . Using Gordon–Newell’s

theorem one can obtain: ! 1 : T T

np S p p P ( p – Page Rank) and

1

1

1

!lim ...

! ... !nnn

nt

n

NP n t n p p

n n

.

Hence, using Hoeffding’s inequality in a Hilbert space one can obtain

1

2

2 2 4 lnlimt

n tP p

N N

.

Page 5: Convex Optimization for Data Science1 Convex Optimization for Data Science Gasnikov Alexander gasnikov.av@mipt.ru Lecture 2. Convex optimization and Big Data applications October,

5

How to find Page Rank via Convex Optimization?

According to Frobenius’ theory for nonnegative matrix we have the fol-

lowing equivalent optimization’s type reformulations of Google problem:

2

2 1

1min

2 nx SAx

; (smooth representation)

1min

nx SAx

; (not smooth representation)

21 1min max ,

n nx S SAx

; (saddle point representation)

2

2

1min

2 Ax bx

, (required dual representation)

where T

nA P I , TA J A , ;n nJ I I , ;1T

nA P I

, 0,...,0,1

Tb .

Page 6: Convex Optimization for Data Science1 Convex Optimization for Data Science Gasnikov Alexander gasnikov.av@mipt.ru Lecture 2. Convex optimization and Big Data applications October,

6

Inverse problems: traffic demand matrix estimation from link loads

In the problem of traffic demand matrix estimation the goal is to recov-

er traffic demand matrix represented as a vector 0x from known route

matrix A (the element ,i jA is equal 1 iff the demand with number j goes

through link with number i and equals 0 otherwise) and link loads b

(amount of traffic which goes through every link). This leads to the prob-

lem of finding the solution of linear system Ax b . Also we assume that

we have some 0gx which reflects our prior assumption about x . Thus

we consider x to be a projection of gx on a simplex-type set

0 :x Ax b

2

2

2

2 00 0

min : min .gAx b Ax bx x

g x x x g x

Page 7: Convex Optimization for Data Science1 Convex Optimization for Data Science Gasnikov Alexander gasnikov.av@mipt.ru Lecture 2. Convex optimization and Big Data applications October,

7

Slater’s relaxation of this problem leads to the problem (denote *x the solu-

tion of this problem)

2 2

2

2

2

0

mingAx b

x

x x

.

This problem can be reduced to the problem (unfortunately without explicit

dependence )

2 2

22 0ming

xf x x x Ax b

,

where – dual multiplier to the convex inequality 2 2

2Ax b .

Page 8: Convex Optimization for Data Science1 Convex Optimization for Data Science Gasnikov Alexander gasnikov.av@mipt.ru Lecture 2. Convex optimization and Big Data applications October,

8

2 2

22 0ming

xf x x x Ax b

.

One might expect that 2

2

* 2gx x , but in reality can be chosen

much smaller ( 1 2 ) if we restrict ourselves only by approximate

solution. Let’s reformulate the problem

22

2 2 0ming

xf x Ax b x x

,

where 1 . But sometimes it is worth to consider more general cases:

2

2

1min

2 x Qf x Ax b g x

.

Hastie T., Tibshirani R., Friedman R. The Elements of statistical learning:

Data mining, Inference and Prediction. Springer, 2009.

Page 9: Convex Optimization for Data Science1 Convex Optimization for Data Science Gasnikov Alexander gasnikov.av@mipt.ru Lecture 2. Convex optimization and Big Data applications October,

9

2

2

1min

2 x Qf x Ax b g x

Possible variants for choosing g x are:

1. (Ridge Regression / Tomogravity model)

2

2

gg x x x , nQ ;

2. (Mimimal mutual information model)

1

lnn

g

k k k

k

g x x x x

, 1

, 0 :n

g

n k

k

x x Q S R x x R

.

3. (LASSO)

1

g x x , nQ ;

Page 10: Convex Optimization for Data Science1 Convex Optimization for Data Science Gasnikov Alexander gasnikov.av@mipt.ru Lecture 2. Convex optimization and Big Data applications October,

10

Empirical Risk Minimization (ERM)

Suppose we have observation 1

,n

i i ix y

. We obtain new X and we’d like

to predict Y . We have some loss (penalty) function ˆ , ,l f X Y . For example,

ˆ ˆ, ,l f X Y I f X Y – binary classification ( ˆ , 1,1f X Y );

2

ˆ ˆ, ,l f X Y f X Y – regression;

ˆ ˆ, , max 0,1l f X Y Yf X – hinge loss ( ˆ , 1,1f X Y ).

Let’s introduce V – VC -dimension of class F (binary classification),

1

, 1,

ˆ ˆ , , ,n

i i i

n

X Y i i ix yL f E l f X Y x y

, for

1,

ˆ ˆn

i i ix y

f f F

,

Page 11: Convex Optimization for Data Science1 Convex Optimization for Data Science Gasnikov Alexander gasnikov.av@mipt.ru Lecture 2. Convex optimization and Big Data applications October,

11

1

ˆ argmin , ,n

ERM i if F

i

f l f x y

, * inff F

L f L f

.

Then (Vapnik–Chervonenkis, Zauer, Hausler for binary classification)

1

*

2lnˆ 1ERM

VP L f L f C

n n

,

where C is universal constant.

Now Statistical Learning Theory (SLT) is a big branch of research

where ERM approach (and its penalized versions) is the main tools.

Shalev-Shwartz S., Ben-David S. Understanding Machine Learning: From

theory to algorithms. Cambridge University Press, 2014.

Sridharan K. Learning from an optimization viewpoint. PhD Thesis, 2011.

Page 12: Convex Optimization for Data Science1 Convex Optimization for Data Science Gasnikov Alexander gasnikov.av@mipt.ru Lecture 2. Convex optimization and Big Data applications October,

12

Maximum Likelihood Estimation (Fisher, Le Kam, Spokoiny)

Let x , 1,...,k k n – i.i.d. with density function x xp (supp. doesn’t

depend on ), depends on unknown vector of parameters . Then for all

statistics x (with 2

x xE ):

1

x ,x xT

p nE I

, (Rao–Cramer inequality)

, x x x ,1ln x ln xdef T

p n pI E p p nI

,

x xx argmax x argmax ln xMLE p p

x x

11

argmax ln x argmax ln x ,i i

n n

i i

ii

p p

Page 13: Convex Optimization for Data Science1 Convex Optimization for Data Science Gasnikov Alexander gasnikov.av@mipt.ru Lecture 2. Convex optimization and Big Data applications October,

13

* x x x * xargmax ln x argmax ln .i i i ii i i iE p p x p x dx

Le Kam theory (Fisher’s theorem): When n then xMLE is asymp-

totically normal and optimal in sense of Rao–Cramer inequality (“=”).

Recently V. Spokoiny’ve proposed non asymptotic variant of this

theory. In particular his theory allows to answer for the question: how fast

could m ( dimm ) with n for asymptotic optimality of xB .

He also considered closely connected result – Wilks’ phenomenon.

Example (Least Squares). i i iy kx b 20,i N , ,T

k b ,

x A , 1

xn

i iy

,

1 ...

1 ... 1

T

nx xA

, 2

2x argmin xMLE A

.

Page 14: Convex Optimization for Data Science1 Convex Optimization for Data Science Gasnikov Alexander gasnikov.av@mipt.ru Lecture 2. Convex optimization and Big Data applications October,

14

Van Trees inequality (generalization of Rao–Cramer inequality)

Let x , 1,...,k k n – i.i.d. with density function x xp (supp. doesn’t

depend on ), depends on unknown vector of parameters with prior dis-

tribution . Then for all statistics x (with 2

x xE ):

1

x, ,x xT

p nE I I

, (*)

, x, x x ,1ln x ln xdef T

p n pI E p p nI

,

ln lndef T

I E

.

Ibragimov I.A., Khas'minskii R.Z. Statistical estimation: Asymptotic theory.

Springer, 2013.

Page 15: Convex Optimization for Data Science1 Convex Optimization for Data Science Gasnikov Alexander gasnikov.av@mipt.ru Lecture 2. Convex optimization and Big Data applications October,

15

Bayesian inference

Bayesian estimation:

xx argmin , x ,B I p d

2

2

1, .

2I

Le Kam theory: When n then xB is asymptotically normal and

optimal in sense of (*) (“=”).

Recently V. Spokoiny’ve proposed non asymptotic variant of this

theory. In particular his theory allows to answer for the question: how fast

could m ( dimm ) with n for asymptotic optimality of xB .

Page 16: Convex Optimization for Data Science1 Convex Optimization for Data Science Gasnikov Alexander gasnikov.av@mipt.ru Lecture 2. Convex optimization and Big Data applications October,

16

Van Trees inequality Rao–Cramer inequality and xB xMLE

when 20,N I with .

Berstein–von Mises theorem say that xB is 1 2n -normaly concen-

trated around xMLE when n. Recently V. Spokoiny’ve proposed

non asymptotic variant of this theorem.

Example. Assume that

x A , 20,N I , prior on 2,gN I

Then (compare to the traffic demand matrix estimation problem)

22

2 2x argmin xB gA

, 2 2 .

Page 17: Convex Optimization for Data Science1 Convex Optimization for Data Science Gasnikov Alexander gasnikov.av@mipt.ru Lecture 2. Convex optimization and Big Data applications October,

17

Compressed Sensing and L1-optimization (Donoho, Candes, Tao)

There are many areas where linear systems arise in which a sparse solu-

tion is unique. One is in plant breading. Consider a breeder who has a

number of apple trees and for each tree observes the strength of some de-

sirable feature. He wishes to determine which genes are responsible for the

feature so he can cross bread to obtain a tree that better expresses the desir-

able feature. This gives rise to a set of equations Ax b where each row of

the matrix A corresponds to a tree and each column to a position on the ge-

nome. The vector b corresponds to the strength of the desired feature in

each tree. The solution x tells us the position on the genome corresponding

to the genes that account for the feature. So one can hope that NP-hard

problem 0

minAx b

x

can be replaced by convex problem 1

minAx b

x

. Due

to Lagrange multipliers principle we can relax this problem as

Page 18: Convex Optimization for Data Science1 Convex Optimization for Data Science Gasnikov Alexander gasnikov.av@mipt.ru Lecture 2. Convex optimization and Big Data applications October,

18

2

2 1

1min

2 xAx b x . // ~

1minAx b

x

under special 0

What are the sufficient conditions for: 0

minAx b

x

1

minAx b

x

?

Restricted Isometry Property (RIP)

2 2 2

2 2 21 1s sx Ax x for any s-sparse x .

Sufficient condition. Suppose that 0x (solution of 0

minAx b

x

) has at

most s nonzero coordinates, matrix A satisfy RIP with 1

5s s

, then

0x is the unique solution of the convex optimization problem 1

minAx b

x

.

Example RIP matrix: for all nx 2 2 2 2

2 2 21 1 1 2exp 6P x Ax x n ,

where i.i.d. 10,ijA N n (0 1 ). If A is ,2s -RIP and 0

x s satisfy Ax b then 0x x .

Page 19: Convex Optimization for Data Science1 Convex Optimization for Data Science Gasnikov Alexander gasnikov.av@mipt.ru Lecture 2. Convex optimization and Big Data applications October,

19

Examples of Data Science problems

Typically Data Science problems lead to the optimization problems:

1

minm

T

k kx Q

k

f A x g x

.

At least one of the dimensions is huge m (sample size), n (parameters).

Ridge Regression

2

k k k kf y C y b , 2

2

1

2g x x . (smooth, strongly convex)

Support Vector Machine (SVM has Bayesian nature, V.V. Mottl’)

max 0,1k k k kf y C b y , 2

2

1

2g x x . (non smooth, strongly convex)

Page 20: Convex Optimization for Data Science1 Convex Optimization for Data Science Gasnikov Alexander gasnikov.av@mipt.ru Lecture 2. Convex optimization and Big Data applications October,

20

Dual problem (convex case)

Sometimes it is proper to solve dual problem instead of primal one:

1

, minm

k kx Q

k

f A x g x

,

1 1

min minm m

T

k k k kx Q x Q

k kz Ax

f A x g x f z g x

1,

min max ,m

k kx Q y

kz Ax z

z z y f z g x

1

max max , max ,m

m

k kx Q zy

kz Ax

z y g x z y f z

Page 21: Convex Optimization for Data Science1 Convex Optimization for Data Science Gasnikov Alexander gasnikov.av@mipt.ru Lecture 2. Convex optimization and Big Data applications October,

21

1

max max , maxm

k

mT

k k k kx Q zy

k

A y x g x z y f z

* * * *

1 1

max minmm

m mT T

k k k kyy

k k

g A y f y g A y f y

.

1) 22

2 2min

2 2 ngx

LAx b x x

, 2)

2

2 11

ln min2 n

n

k kx S

k

LAx b x x

.

1) 2 2 2 2

2 222

1 1min

2 2 m

T

g gy

x A y x y b bL

, (dual for 1))

2) 2 2

2 21

1 1ln exp min

2 m

Tn

i

yi

A yy b b

L

. (dual for 2))

Page 22: Convex Optimization for Data Science1 Convex Optimization for Data Science Gasnikov Alexander gasnikov.av@mipt.ru Lecture 2. Convex optimization and Big Data applications October,

22

Good and Bad News

Good news: In convex case even with huge m and n these type of the

problems

1

, minm

k kx Q

k

f A x g x

are fast solvable numerically (often by accelerated primal or dual coordinate

descent methods – see Lecture 6).

Bad news: Real Data Science problems often lead to non convex optimi-

zation problems. Typical example is probabilistic topic modeling (see K.V.

Vorontsov). With MLE-approach one can obtain only non convex problem

1 11 ; 1

, ln min .t dW T

T D

t d wd wt tdt dS Sd D w W t T

f n

Page 23: Convex Optimization for Data Science1 Convex Optimization for Data Science Gasnikov Alexander gasnikov.av@mipt.ru Lecture 2. Convex optimization and Big Data applications October,

23

To find traffic assignment one has to solve convex optimization problem

,

min , : ,f x

x f f x x X *

*

dommin ,e e

te E

t t

1 1

1 1

1 1 2, :e e

e E

x f x f x

1 1 1 2 2

1 1 1 11

1 1 1 1 2 1ln , ,...

w

p p w w ww OD p P

x x d d f

ln expk k

k kkw

k k

w pp P

t g t

, 1,...,k m , 1 1

1 1

1 1 1 ,w w

w OD

t d t

m m m m m m m

m m m m

m

p e p e e p ee E e E

g t t t

,

1 1 1 .k k k k k k k

k k k k

k k k k

p e p e e p ee E e E

g t t t

Page 24: Convex Optimization for Data Science1 Convex Optimization for Data Science Gasnikov Alexander gasnikov.av@mipt.ru Lecture 2. Convex optimization and Big Data applications October,

24

Braess paradox (BMW-model, , 01m )

Demand: 4000 ,d car hour .up downx x d

Equilibrium: 2000 ,upx car hour 2000 ,downx car hour

65 min.up downT x T x

Equilibrium (if exists edge Up->Down): , 4000 ,up downx car hour

, 80 min.up downT x

https://arxiv.org/ftp/arxiv/papers/1701/1701.02473.pdf

Start Finish

Up

Down

f/100

f/100

45

45

0

Page 25: Convex Optimization for Data Science1 Convex Optimization for Data Science Gasnikov Alexander gasnikov.av@mipt.ru Lecture 2. Convex optimization and Big Data applications October,

25

Braess paradox (BMW-model, , 01m )

,

minlnw

p p w

p P

e ef x x X

e E

x x df

, 0

ef

e e ef z dz . (*)

Road pricing: .payment

f f f f

(VCG –mechanism);

1750 ,up downx x car hour , 500 .up downx car hour

Start Finish

Up

Down

f/100

f/100

45

45

0

Page 26: Convex Optimization for Data Science1 Convex Optimization for Data Science Gasnikov Alexander gasnikov.av@mipt.ru Lecture 2. Convex optimization and Big Data applications October,

26

Braess paradox (Stable Dynamic model, 1, 0m )

Demand: 13 23 121500 , 0;d d car hour d

0

, 0,

, ,

e e e

e e

e e e

t f ff

t f f

1

BPR : 1 ,e e e e ef t f f

12 13 23( ) 2000 ,f f f car hour 13 1 ,t hour

23 30 min,t 12 15 min.t

Equilibrium (1 2 ): 13 23 1500 ,x x car hour

13 1 ,T hour 23 30 min.T

Equilibrium (1 2 ): 13 1000 ,x car hour

123 500 ,x car hour

23 1500 ,x car hour 13 1 ,T hour

23 45 min.T

If in (*) we go to the limit 0 , then: , ,mine ee E f x f f x X

f t

.

2

2

2

3

2

2

1

2

2

Page 27: Convex Optimization for Data Science1 Convex Optimization for Data Science Gasnikov Alexander gasnikov.av@mipt.ru Lecture 2. Convex optimization and Big Data applications October,

27

Entropy model for demand matrix calculation ( 1m )

, 1

,

1, 1 1 1 1 1 , 1 , 0

ln min ,n

ij ij

i j

n n n n n n nL W

ij ij i ij j ij ij ij

i j i j i i i j d N d

T d d d d d

,L W

i j

– “attractive potentials” of districts (Kantorovich–Gavurin).

Unfortunately, we don’t know potential. But we know such ,i jL W , that

1

n

ij i

j

d L

, 1

n

ij j

i

d W

(1 1

n n

i j

i j

N L W

). (A)

,

A , 01, 1 , 1

ln min .ij

n n n

ij ij ij ijd d

i j i j

T d d d

2 3

1 2

O D

Page 28: Convex Optimization for Data Science1 Convex Optimization for Data Science Gasnikov Alexander gasnikov.av@mipt.ru Lecture 2. Convex optimization and Big Data applications October,

28

Problem (arising when we build multistage traffic model): d T arise

in demand matrix calculation model and e eT f d , where ef d

calculated according to BMW (or Stable Dynamic) models. We have vi-

cious circle!

In practice the problem is solved by simple iteration method (equili-

brium = fixed point). Though there is no theory (theoretical guarantees)

about the convergence of this procedure. One can propose another way of

rewriting this problem!

Key observation (Demyanov–Danskin’s formula for dual problem):

,

mine ef x

dx X d

T f d f

( x f x T x , minij

ij pp P

T T

).

A , 0; ,

, 1

ln min .ij

n

ij ijd d f x x X d

i j

f d d

Page 29: Convex Optimization for Data Science1 Convex Optimization for Data Science Gasnikov Alexander gasnikov.av@mipt.ru Lecture 2. Convex optimization and Big Data applications October,

29

Truss Topology Design

The problem consists in finding the best mechanical structure resisting

to an external force with an upper bound for the total weight of construc-

tion. Its mathematical formulation can be reduced to LP problem with huge

number of affine-type restrictions (dual multipliers here are also important)

, minAx b

c x

.

General property of all mentioned above (and almost all current) huge-

scale problem formulations is sparseness of main matrix A (or , P ). This

property sometimes allows to solve huge-scale problems with more than

billion variables or restrictions in personal PC.

Note: Term “huge-scale optimization” was introduced by Nesterov Yu. Sub-

gradient methods for huge-scale optimization problems // Math. Program., Ser. A.

– 2013. – V. 146. № 1-2. P. 275–297.

Page 30: Convex Optimization for Data Science1 Convex Optimization for Data Science Gasnikov Alexander gasnikov.av@mipt.ru Lecture 2. Convex optimization and Big Data applications October,

30

To be continued…