M Pawan Kumar pawankumarecpfr Slides available online http cvnecpfr personnel pawan Outline Problem Formulation Energy Function Energy Minimization Computing min marginals ID: 648491
Download Presentation The PPT/PDF document "Discrete Optimization Lecture 1" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
Discrete OptimizationLecture 1
M. Pawan Kumarpawan.kumar@ecp.fr
Slides available online http://
cvn.ecp.fr
/personnel/
pawan
/Slide2
Outline
Problem FormulationEnergy FunctionEnergy Minimization
Computing min-
marginals
Reparameterization
Energy Minimization for Trees
Loopy Belief PropagationSlide3
Energy Function
V
a
V
b
V
c
V
d
Label
l
0
Label
l
1
Random Variables V
= {V
a
, V
b
, ….}
Labels L
= {l
0
, l
1
, ….}
Labelling f: {a, b, …. }
{0,1, …} Slide4
Energy Function
V
a
V
b
V
c
V
d
Q(f)
=
∑
a
a;f(a)
Unary Potential
2
5
4
2
6
3
3
7
Label
l
0
Label
l
1
Easy to minimize
NeighbourhoodSlide5
Energy Function
V
a
V
b
V
c
V
d
E : (a,b)
E iff V
a
and V
b
are neighbours
E = { (a,b) , (b,c) , (c,d) }
2
5
4
2
6
3
3
7
Label
l
0
Label
l
1Slide6
Energy Function
V
a
V
b
V
c
V
d
+∑
(a,b)
ab;f(a)f(b)
Pairwise Potential
0
1
1
0
0
2
1
1
4
1
0
3
2
5
4
2
6
3
3
7
Label
l
0
Label
l
1
Q(f)
=
∑
a
a;f(a)Slide7
Energy Function
V
a
V
b
V
c
V
d
0
1
1
0
0
2
1
1
4
1
0
3
Parameter
2
5
4
2
6
3
3
7
Label
l
0
Label
l
1
+∑
(a,b)
ab;f(a)f(b)
Q(f;
)
=
∑
a
a;f(a)Slide8
Outline
Problem FormulationEnergy FunctionEnergy Minimization
Computing min-
marginals
Reparameterization
Energy Minimization for Trees
Loopy Belief PropagationSlide9
Energy Minimization
V
a
V
b
V
c
V
d
2
5
4
2
6
3
3
7
0
1
1
0
0
2
1
1
4
1
0
3
Q(f;
) = ∑
a
a;f
(a)
+ ∑
(
a,b
)
ab;f
(a)f(b)
Label
l
0
Label
l
1Slide10
Energy Minimization
V
a
V
b
V
c
V
d
2
5
4
2
6
3
3
7
0
1
1
0
0
2
1
1
4
1
0
3
Q(f;
) = ∑
a
a;f
(a)
+ ∑
(
a,b
)
ab;f
(a)f(b)
2 + 1 + 2 + 1 + 3 + 1 + 3 = 13
Label
l
0
Label
l
1Slide11
Energy Minimization
V
a
V
b
V
c
V
d
2
5
4
2
6
3
3
7
0
1
1
0
0
2
1
1
4
1
0
3
Q(f;
) = ∑
a
a;f
(a)
+ ∑
(
a,b
)
ab;f
(a)f(b)
Label
l
0
Label
l
1Slide12
Energy Minimization
V
a
V
b
V
c
V
d
2
5
4
2
6
3
3
7
0
1
1
0
0
2
1
1
4
1
0
3
Q(f;
) = ∑
a
a;f
(a)
+ ∑
(
a,b
)
ab;f
(a)f(b)
5 + 1 + 4 + 0 + 6 + 4 + 7 = 27
Label
l
0
Label
l
1Slide13
Energy Minimization
V
a
V
b
V
c
V
d
2
5
4
2
6
3
3
7
0
1
1
0
0
2
1
1
4
1
0
3
Q(f;
) = ∑
a
a;f
(a)
+ ∑
(
a,b
)
ab;f
(a)f(b)
f* =
arg
min
Q(f;
)
q*
= min
Q(f;
) =
Q(f*
; )
Label
l
0
Label
l
1Slide14
Energy Minimization
f(a)
f(b)
f(c)
f(d)
Q(f;
)
0
0
0
0
18
0
0
0
1
15
0
0
1
0
27
0
0
1
1
20
0
1
0
0
22
0
1
0
1
19
0
1
1
0
27
0
1
1
1
20
16 possible labellings
f(a)
f(b)
f(c)
f(d)
Q(f;
)
1
0
0
0
16
1
0
0
1
13
1
0
1
0
25
1
0
1
1
18
1
1
0
0
18
1
1
0
1
15
1
1
1
0
23
1
1
1
1
16
f* = {1, 0, 0, 1}
q* = 13Slide15
Outline
Problem FormulationEnergy FunctionEnergy Minimization
Computing min-
marginals
Reparameterization
Energy Minimization for Trees
Loopy Belief PropagationSlide16
Min-Marginals
V
a
V
b
V
c
V
d
2
5
4
2
6
3
3
7
0
1
1
0
0
2
1
1
4
1
0
3
f* =
arg
min
Q(f;
)
such that f(a) = i
Min-marginal q
a;i
Label
l
0
Label
l
1Slide17
Min-Marginals
16 possible labellings
q
a;0
= 15
f(a)
f(b)
f(c)
f(d)
Q(f;
)
0
0
0
0
18
0
0
0
1
15
0
0
1
0
27
0
0
1
1
20
0
1
0
0
22
0
1
0
1
19
0
1
1
0
27
0
1
1
1
20
f(a)
f(b)
f(c)
f(d)
Q(f;
)
1
0
0
0
16
1
0
0
1
13
1
0
1
0
25
1
0
1
1
18
1
1
0
0
18
1
1
0
1
15
1
1
1
0
23
1
1
1
1
16Slide18
Min-Marginals
16 possible labellings
q
a;1
= 13
f(a)
f(b)
f(c)
f(d)
Q(f;
)
1
0
0
0
16
1
0
0
1
13
1
0
1
0
25
1
0
1
1
18
1
1
0
0
18
1
1
0
1
15
1
1
1
0
23
1
1
1
1
16
f(a)
f(b)
f(c)
f(d)
Q(f;
)
0
0
0
0
18
0
0
0
1
15
0
0
1
0
27
0
0
1
1
20
0
1
0
0
22
0
1
0
1
19
0
1
1
0
27
0
1
1
1
20Slide19
Min-Marginals and MAP
Minimum min-marginal of any variable =
energy of MAP labelling
min
f
Q(f;
)
such that f(a) = i
q
a;i
mini
mini (
)
Va has to take one label
minf Q(f; )Slide20
Summary
Energy Minimization
f* =
arg
min
Q(f;
)
Q(f;
) = ∑a
a;f(a) + ∑(a,b
) ab;f(a)f(b)
Min-marginals
qa;i = min
Q(f; )
s.t. f(a) = iEnergy FunctionSlide21
Outline
Problem FormulationReparameterizationEnergy Minimization for Trees
Loopy Belief PropagationSlide22
Reparameterization
V
a
V
b
2
5
4
2
0
1
1
0
f(a)
f(b)
Q(f;
)
0
0
7
0
1
10
1
0
5
1
1
6
2 +
2 +
- 2
- 2
Add a constant to all
a;i
Subtract that constant from all
b;kSlide23
Reparameterization
f(a)
f(b)
Q(f;
)
0
0
7
+ 2 - 2
0
1
10
+ 2 - 2
1
0
5
+ 2 - 2
1
1
6
+ 2 - 2
Add a constant to all
a;i
Subtract that constant from all
b;k
Q(f;
’
) =
Q(f;
)
V
a
V
b
2
5
4
2
0
0
2 +
2 +
- 2
- 2
1
1Slide24
Reparameterization
V
a
V
b
2
5
4
2
0
1
1
0
f(a)
f(b)
Q(f;
)
0
0
7
0
1
10
1
0
5
1
1
6
- 3
+ 3
Add a constant to one
b;k
Subtract that constant from
ab;ik
for all
‘
i
’
- 3Slide25
Reparameterization
V
a
V
b
2
5
4
2
0
1
1
0
f(a)
f(b)
Q(f;
)
0
0
7
0
1
10
- 3 + 3
1
0
5
1
1
6
- 3 + 3
- 3
+ 3
- 3
Q(f;
’
) =
Q(f;
)
Add a constant to one
b;k
Subtract that constant from
ab;ik
for all
‘
i
’
Slide26
Reparameterization
V
a
V
b
2
5
4
2
3
1
0
1
2
V
a
V
b
2
5
4
2
3
1
1
0
1
- 2
- 2
- 2
+ 2
+ 1
+ 1
+ 1
- 1
V
a
V
b
2
5
4
2
3
1
2
1
0
- 4
+ 4
- 4
- 4
’
a;i
=
a;i
’
b;k
=
b;k
’
ab;ik
=
ab;ik
+ M
ab;k
- M
ab;k
+ M
ba;i
- M
ba;i
Q(f;
’
)
=
Q(f;
)Slide27
Reparameterization
Q(f;
’
) =
Q(f;
), for all f
’ is a reparameterization of , iff
’
’b;k =
b;k
’a;i =
a;i
’ab;ik = ab;ik
+ Mab;k- M
ab;k+ Mba;i
- Mba;i
Equivalently
Kolmogorov, PAMI, 2006
V
a
V
b
2
5
4
2
0
0
2 +
2 +
- 2
- 2
1
1Slide28
Recap
Energy Minimization
f* =
arg
min
Q(f;
)
Q(f;
) = ∑a a;f
(a) + ∑(a,b) ab;f(a)f(b)
Min-marginals
qa;i
= min Q(f; )
s.t. f(a) = i
Q(f; ’) = Q(f;
), for all f’
ReparameterizationSlide29
Outline
Problem FormulationReparameterizationEnergy Minimization for Trees
Loopy Belief Propagation
Pearl, 1988Slide30
Belief Propagation
Belief Propagation
is exact for
chains
Some problems
are easy
Exact MAP for trees
Clever ReparameterizationSlide31
Two Variables
V
a
V
b
2
5
2
1
0
V
a
V
b
2
5
4
0
1
Choose the
right
constant
’
b;k
= q
b;k
Add a constant to one
b;k
Subtract that constant from
ab;ik
for all
‘
i
’
Slide32
V
a
V
b
2
5
2
1
0
V
a
V
b
2
5
4
0
1
Choose the
right
constant
’
b;k
= q
b;k
a;0
+
ab;00
= 5 + 0
a;1
+
ab;10
= 2 + 1
min
M
ab;0
=
Two VariablesSlide33
V
a
V
b
2
5
5
-2
-3
V
a
V
b
2
5
4
0
1
Choose the
right
constant
’
b;k
= q
b;k
Two VariablesSlide34
V
a
V
b
2
5
5
-2
-3
V
a
V
b
2
5
4
0
1
Choose the
right
constant
’
b;k
= q
b;k
f(a) = 1
’
b;0
= q
b;0
Two Variables
Potentials along the red path add up to 0Slide35
V
a
V
b
2
5
5
-2
-3
V
a
V
b
2
5
4
0
1
Choose the
right
constant
’
b;k
= q
b;k
a;0
+
ab;01
= 5 + 1
a;1
+
ab;11
= 2 + 0
min
M
ab;1
=
Two VariablesSlide36
V
a
V
b
2
5
5
-2
-3
V
a
V
b
2
5
6
-2
-1
Choose the
right
constant
’
b;k
= q
b;k
f(a) = 1
’
b;0
= q
b;0
f(a) = 1
’
b;1
= q
b;1
Minimum of min-marginals = MAP estimate
Two VariablesSlide37
V
a
V
b
2
5
5
-2
-3
V
a
V
b
2
5
6
-2
-1
Choose the
right
constant
’
b;k
= q
b;k
f(a) = 1
’
b;0
= q
b;0
f(a) = 1
’
b;1
= q
b;1
f*(b) = 0
f*(a) = 1
Two VariablesSlide38
V
a
V
b
2
5
5
-2
-3
V
a
V
b
2
5
6
-2
-1
Choose the
right
constant
’
b;k
= q
b;k
f(a) = 1
’
b;0
= q
b;0
f(a) = 1
’
b;1
= q
b;1
We get all the min-marginals of V
b
Two VariablesSlide39
Recap
We only need to know two sets of equations
General form of Reparameterization
’
a;i
=
a;i
’
ab;ik
= ab;ik
+ Mab;k
-
Mab;k
+ Mba;i
- Mba;i’
b;k = b;k
Reparameterization of (a,b) in Belief PropagationMab;k
= mini { a;i +
ab;ik }
Mba;i = 0Slide40
Three Variables
V
a
V
b
2
5
2
1
0
V
c
4
6
0
1
0
1
3
2
3
Reparameterize the edge (a,b) as before
l
0
l
1Slide41
V
a
V
b
2
5
5
-3
V
c
6
6
0
1
-2
3
Reparameterize the edge (a,b) as before
f(a) = 1
f(a) = 1
-2
-1
2
3
Three Variables
l
0
l
1Slide42
V
a
V
b
2
5
5
-3
V
c
6
6
0
1
-2
3
Reparameterize the edge (a,b) as before
f(a) = 1
f(a) = 1
Potentials along the red path add up to 0
-2
-1
2
3
Three Variables
l
0
l
1Slide43
V
a
V
b
2
5
5
-3
V
c
6
6
0
1
-2
3
Reparameterize the edge (b,c) as before
f(a) = 1
f(a) = 1
Potentials along the red path add up to 0
-2
-1
2
3
Three Variables
l
0
l
1Slide44
V
a
V
b
2
5
5
-3
V
c
6
12
-6
-5
-2
9
Reparameterize the edge (b,c) as before
f(a) = 1
f(a) = 1
Potentials along the red path add up to 0
f(b) = 1
f(b) = 0
-2
-1
-4
-3
Three Variables
l
0
l
1Slide45
V
a
V
b
2
5
5
-3
V
c
6
12
-6
-5
-2
9
Reparameterize the edge (b,c) as before
f(a) = 1
f(a) = 1
Potentials along the red path add up to 0
f(b) = 1
f(b) = 0
q
c;0
q
c;1
-2
-1
-4
-3
Three Variables
l
0
l
1Slide46
V
a
V
b
2
5
5
-3
V
c
6
12
-6
-5
-2
9
f(a) = 1
f(a) = 1
f(b) = 1
f(b) = 0
q
c;0
q
c;1
f*(c) = 0
f*(b) = 0
f*(a) = 1
Generalizes to any length chain
-2
-1
-4
-3
Three Variables
l
0
l
1Slide47
V
a
V
b
2
5
5
-3
V
c
6
12
-6
-5
-2
9
f(a) = 1
f(a) = 1
f(b) = 1
f(b) = 0
q
c;0
q
c;1
f*(c) = 0
f*(b) = 0
f*(a) = 1
Dynamic
Programming
-2
-1
-4
-3
Three Variables
l
0
l
1Slide48
Dynamic Programming
3 variables
2 variables + book-keeping
n variables
(n-1) variables + book-keeping
Start from left, go to right
Reparameterize current edge (a,b)
M
ab;k
= mini {
a;i + ab;ik }
’ab;ik = ab;ik
+ Mab;k
- Mab;k
’b;k =
b;kRepeatSlide49
Dynamic Programming
Start from left, go to right
Reparameterize current edge (a,b)
M
ab;k
= min
i
{
a;i +
ab;ik }
Repeat
Messages
Message Passing
Why stop at dynamic programming?
’ab;ik = ab;ik
+ Mab;k
- Mab;k
’b;k =
b;kSlide50
V
a
V
b
2
5
5
-3
V
c
6
12
-6
-5
-2
9
Reparameterize the edge (c,b) as before
-2
-1
-4
-3
Three Variables
l
0
l
1Slide51
V
a
V
b
2
5
9
-3
V
c
11
12
-11
-9
-2
9
Reparameterize the edge (c,b) as before
-2
-1
-9
-7
’
b;i
= q
b;i
Three Variables
l
0
l
1Slide52
V
a
V
b
2
5
9
-3
V
c
11
12
-11
-9
-2
9
Reparameterize the edge (b,a) as before
-2
-1
-9
-7
Three Variables
l
0
l
1Slide53
V
a
V
b
9
11
9
-9
V
c
11
12
-11
-9
-9
9
Reparameterize the edge (b,a) as before
-9
-7
-9
-7
’
a;i
= q
a;i
Three Variables
l
0
l
1Slide54
V
a
V
b
9
11
9
-9
V
c
11
12
-11
-9
-9
9
Forward Pass
Backward Pass
-9
-7
-9
-7
All min-marginals are computed
Three Variables
l
0
l
1Slide55
Belief Propagation on Chains
Start from left, go to right
Reparameterize
current edge (
a,b
)
M
ab;k
= min
i { a;i
+ ab;ik }
’ab;ik = ab;ik
+
Mab;k
- Mab;k
’b;k = b;k
Repeat till the end of the chain
Start from right, go to left
Repeat till the end of the chainSlide56
Belief Propagation on Chains
A way of computing reparam constants
Generalizes to chains of any length
Forward Pass - Start to End
MAP estimate
Min-marginals of final variable
Backward Pass - End to start
All other min-marginalsSlide57
Computational Complexity
Each constant takes O(|L|)
Number of constants - O(|E||L|)
O(|E||L|
2
)
Memory required ?
O(|E||L|)Slide58
Belief Propagation on Trees
V
b
V
a
Forward Pass: Leaf
Root
All min-
marginals
are computed
Backward Pass: Root
Leaf
V
c
V
d
V
e
V
g
V
hSlide59
Outline
Problem FormulationReparameterizationEnergy Minimization for Trees
Loopy Belief Propagation
Pearl, 1988; Murphy et al., 1999Slide60
Belief Propagation on Cycles
V
a
V
b
V
d
V
c
Where do we start?
Arbitrarily
a;0
a;1
b;0
b;1
d;0
d;1
c;0
c;1
Reparameterize (a,b)Slide61
Belief Propagation on Cycles
V
a
V
b
V
d
V
c
a;0
a;1
’
b;0
’
b;1
d;0
d;1
c;0
c;1
Potentials along the red path add up to 0Slide62
Belief Propagation on Cycles
V
a
V
b
V
d
V
c
a;0
a;1
’
b;0
’
b;1
d;0
d;1
’
c;0
’
c;1
Potentials along the red path add up to 0Slide63
Belief Propagation on Cycles
V
a
V
b
V
d
V
c
a;0
a;1
’
b;0
’
b;1
’
d;0
’
d;1
’
c;0
’
c;1
Potentials along the red path add up to 0Slide64
Belief Propagation on Cycles
V
a
V
b
V
d
V
c
’
a;0
’
a;1
’
b;0
’
b;1
’
d;0
’
d;1
’
c;0
’
c;1
Potentials along the red path add up to 0Slide65
Belief Propagation on Cycles
V
a
V
b
V
d
V
c
’
a;0
’
a;1
’
b;0
’
b;1
’
d;0
’
d;1
’
c;0
’
c;1
Potentials along the red path add up to 0
-
a;0
-
a;1 Slide66
Belief Propagation on Cycles
V
a
V
b
V
d
V
c
a;0
a;1
b;0
b;1
d;0
d;1
c;0
c;1
Any suggestions?
Fix
V
a
to label l
0Slide67
Belief Propagation on Cycles
V
a
V
b
V
d
V
c
Any suggestions?
Fix
V
a
to label l
0
a;0
b;0
b;1
d;0
d;1
c;0
c;1
Equivalent to a tree-structured problemSlide68
Belief Propagation on Cycles
V
a
V
b
V
d
V
c
a;1
b;0
b;1
d;0
d;1
c;0
c;1
Any suggestions?
Fix
V
a
to label l
1
Equivalent to a tree-structured problemSlide69
Belief Propagation on Cycles
Choose the minimum energy solution
V
a
V
b
V
d
V
c
a;0
a;1
b;0
b;1
d;0
d;1
c;0
c;1
This approach quickly becomes infeasibleSlide70
Loopy Belief Propagation
V
1
V
2
V
3
V
4
V
5
V
6
V
7
V
8
V
9
Keep
reparameterizing
edges in some order
Hope for convergence and a good solutionSlide71
Belief Propagation
Generalizes to any arbitrary random field
Complexity per iteration ?
O(|E||L|
2
)
Memory required ?
O(|E||L|)Slide72
Graph Cuts as Reparameterization
?