Camera camera = Camera.open(); - - PowerPoint PPT Presentation

camera camera camera open camera setdisplayorientation 90
SMART_READER_LITE
LIVE PREVIEW

Camera camera = Camera.open(); - - PowerPoint PPT Presentation

Camera camera = Camera.open(); camera.setDisplayOrientation(90); Camera camera = Camera.open(); Camera camera = Camera.open(); camera.setDisplayOrientation(90);


slide-1
SLIDE 1
slide-2
SLIDE 2
slide-3
SLIDE 3
slide-4
SLIDE 4
slide-5
SLIDE 5

slide-6
SLIDE 6
slide-7
SLIDE 7
slide-8
SLIDE 8
slide-9
SLIDE 9

Camera camera = Camera.open(); camera.setDisplayOrientation(90);

slide-10
SLIDE 10

Camera camera = Camera.open(); camera.setDisplayOrientation(90); Camera camera = Camera.open(); camera.setDisplayOrientation(90); SurfaceHolder holder = getHolder(); holder.addCallback(this); holder.setType(SurfaceHolder.STP); MediaRecorder r = new MediaRecorder(); r.setAudioSource(MediaRecorder.AS); r.setVideoSource(MediaRecorder.VS); r.setOutFormat(MediaRecorder.MPEG4); camera.unlock(); r.setCamera(camera);

slide-11
SLIDE 11
slide-12
SLIDE 12

Console.WriteLine("Hi"); … System.out.println("Hi"); …

C# Java

slide-13
SLIDE 13
slide-14
SLIDE 14

function FZ(e, t) { var n = []; var r = e.length; var i = 0; for (; i < r; i += t) if (i + t < r) n.push(e.substring(i, i + t)); else n.push(e.substring(i, r)); return n; } function chunkData(str, step) { var colNames = []; var len = str.length; var i = 0; for (; i < len; i += step) if (i + step < len) colNames.push(str.substring(i, i + step)); else colNames.push(str.substring(i, len)); return colNames; }

slide-15
SLIDE 15

   

slide-16
SLIDE 16
slide-17
SLIDE 17

Probability Refresher

  • :  P(x) = 1
  • P(x,y),

:  P(x,y) = 1

  • : P(y | x) = P(y, x) / P(x)
  • P(y | x) = P(x | y) )  P(y) / P (x)

x y

slide-18
SLIDE 18

Probability Refresher

  • P(x, y) = P(x) )  P(y)

– : x  y

  • P(X, Y | Z) = P(X | Z)  P(Y | Z)

– X Y Z. –

X  Y | Z

slide-19
SLIDE 19

slide-20
SLIDE 20
slide-21
SLIDE 21

Camera camera = Camera.open(); camera.setDisplayOrientation(90); camera.unlock(); MediaRecorder rec = new MediaRecorder(); rec.setCamera(camera); rec.setAudioSource(MediaRecorder.AudioSource.MIC); rec.setVideoSource(MediaRecorder.VideoSource.DEFAULT); rec.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4); rec.setAudioEncoder(1); rec.setVideoEncoder(3); rec.setOutputFile("file.mp4"); ...

? ? ?

slide-22
SLIDE 22

Camera camera = Camera.open(); camera.setDisplayOrientation(90); camera.unlock(); MediaRecorder rec = new MediaRecorder(); rec.setCamera(camera); rec.setAudioSource(MediaRecorder.AudioSource.MIC); rec.setVideoSource(MediaRecorder.VideoSource.DEFAULT); rec.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4); rec.setAudioEncoder(1); rec.setVideoEncoder(3); rec.setOutputFile("file.mp4"); ...

slide-23
SLIDE 23

Camera camera = Camera.open(); camera.setDisplayOrientation(90); camera.unlock(); MediaRecorder rec = new MediaRecorder(); rec.setCamera(camera); rec.setAudioSource(MediaRecorder.AudioSource.MIC); rec.setVideoSource(MediaRecorder.VideoSource.DEFAULT); rec.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4); rec.setAudioEncoder(1); rec.setVideoEncoder(3); rec.setOutputFile("file.mp4"); ...

slide-24
SLIDE 24

Camera camera = Camera.open(); camera.setDisplayOrientation(90); camera.unlock(); MediaRecorder rec = new MediaRecorder(); rec.setCamera(camera); rec.setAudioSource(MediaRecorder.AudioSource.MIC); rec.setVideoSource(MediaRecorder.VideoSource.DEFAULT); rec.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4); rec.setAudioEncoder(1); rec.setVideoEncoder(3); rec.setOutputFile("file.mp4"); ...

slide-25
SLIDE 25

Camera camera = Camera.open(); camera.setDisplayOrientation(90); camera.unlock(); MediaRecorder rec = new MediaRecorder(); rec.setCamera(camera); rec.setAudioSource(MediaRecorder.AudioSource.MIC); rec.setVideoSource(MediaRecorder.VideoSource.DEFAULT); rec.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4); rec.setAudioEncoder(1); rec.setVideoEncoder(3); rec.setOutputFile("file.mp4"); ...

slide-26
SLIDE 26
slide-27
SLIDE 27

MediaRecorder rec = new MediaRecorder(); rec.setCamera(camera);

slide-28
SLIDE 28

MediaRecorder rec = new MediaRecorder(); rec.setCamera(camera);

slide-29
SLIDE 29
slide-30
SLIDE 30
slide-31
SLIDE 31

From Programs to Sentences

she = new X(); me = new Y(); me.sleep(); if (random()) { me.eat(); } she.enter(); me.talk(she);

slide-32
SLIDE 32

From Programs to Sentences

she = new X(); me = new Y(); me.sleep(); if (random()) { me.eat(); } she.enter(); me.talk(she);

Typestate analysis

slide-33
SLIDE 33

From Programs to Sentences

she = new X(); me = new Y(); me.sleep(); if (random()) { me.eat(); } she.enter(); me.talk(she);

Typestate analysis Alias analysis

slide-34
SLIDE 34

From Programs to Sentences

she = new X(); me = new Y(); me.sleep(); if (random()) { me.eat(); } she.enter(); me.talk(she);

Typestate analysis Alias analysis

me:

slide-35
SLIDE 35

From Programs to Sentences

she = new X(); me = new Y(); me.sleep(); if (random()) { me.eat(); } she.enter(); me.talk(she);

Typestate analysis Alias analysis

me:

Yinit sleep talk

slide-36
SLIDE 36

From Programs to Sentences

she = new X(); me = new Y(); me.sleep(); if (random()) { me.eat(); } she.enter(); me.talk(she);

Typestate analysis Alias analysis

me: Yinit sleep talk

Yinit sleep eat talk

slide-37
SLIDE 37

From Programs to Sentences

she = new X(); me = new Y(); me.sleep(); if (random()) { me.eat(); } she.enter(); me.talk(she);

Typestate analysis Alias analysis

me: Yinit sleep talk

Yinit sleep eat talk

she:

slide-38
SLIDE 38

From Programs to Sentences

she = new X(); me = new Y(); me.sleep(); if (random()) { me.eat(); } she.enter(); me.talk(she);

Typestate analysis Alias analysis

me: Yinit sleep talk

Yinit sleep eat talk

she: Xinit enter talkparam1

slide-39
SLIDE 39

Learn Regularities

Xinit enter talkparam1 talkparam1 enter

slide-40
SLIDE 40

Statistical Language Models

s = w1 w2 w3 … wn

P( w1 w2 w3 … wn ) P( w1 w2 w3 … wn ) = ∏i=1..n P( wi | w1 … wi-1 )

slide-41
SLIDE 41

Statistical Language Models

s = w1 w2 w3 … wn

P( w1 w2 w3 … wn ) P( w1 w2 w3 … wn ) = ∏i=1..n P( wi | w1 … wi-1 ) P( The quick brown fox jumped ) = P( The ) P( quick | The ) P( brown | The quick ) P( fox | The quick brown ) P( jumped | The quick brown fox )

slide-42
SLIDE 42

N-gram language model

n-1 P( wi | w1 … wi-1 ) ≈ P( wi | wi-n+1 … wi-1 )

slide-43
SLIDE 43

N-gram language model

n-1 P( wi | w1 … wi-1 ) ≈ P( wi | wi-n+1 … wi-1 )

n-1 words

slide-44
SLIDE 44

N-gram language model

n-1 P( wi | w1 … wi-1 ) ≈ P( wi | wi-n+1 … wi-1 )

n-1 words P( jumped | The quick brown fox ) ≈ P( jumped | brown fox ) ≈ #( brown fox jumped ) #( brown fox ) #( n-gram )

slide-45
SLIDE 45

Tri-gram language model

3-grams # of occurrences

brown fox jumped

125

brown fox walked

45

brown fox snapped

30

P (jumped | brown fox) ~= 125/200 ~= 0.625 P (brown fox jumped) ~= P (brown)  P (fox | brown)  P (jumped | brown fox) 200 / 600  200 / 200  125 / 200 ~= 0.208

P (w1  w2  w3  … wn) ~= P (w1)  P (w2  w1)  P (w3  w1  w2)  …  P (wn  wn-2  wn-1)

slide-46
SLIDE 46

Key Problem: Sparsity of Data

#( brown fox jumped ) #( brown fox ) P( jumped | brown fox ) ≈

slide-47
SLIDE 47
slide-48
SLIDE 48

Smoothing: Intuitively

slide-49
SLIDE 49

P( wi | wi-N+1) =

i-1

P( wi | wi-N+1)

i-1

B(wi-N+1)  P( wi | wi-N+2)

i-1

wi-N+1

i

i-1

slide-50
SLIDE 50

Training: Witten-Bell Interpolated

Pwbi (wi | wi-N+1) =

i-1

Fwbi (wi-N+1)

i

Bwbi (wi-N+1)  Pwbi( wi | wi-N+2)

i-1 i-1

+

Fwbi (wi-N+1) =

i

 PML( wi | wi-N+1)

i-1

N(ws) = | {w : # (

s

w ) > 0} |

i-N+1

i-1

w

N( )

i-N+1

i-1

w

N( )

+

i-N+1

i-1

#(w ) w

s

w

(1 - Bwbi (wi-N+1))

i-1

Bwbi (wi-N+1) =

i-1

slide-51
SLIDE 51

wi-K+1

i

Pwbi (wi | wi-N+1)

i-1

Bwbi (wi-K+1)

i-1

Pwbi (wi | wi-K+1)

i-1

wi-N+1

i

slide-52
SLIDE 52

N-gram language model

n-1 P( wi | w1 … wi-1 ) ≈ P( wi | wi-n+1 … wi-1 )

n-1 words

slide-53
SLIDE 53

Recurrent Neural Networks (RNN)

P( )

U V W

hidden layer input word

  • utput words
slide-54
SLIDE 54

Recurrent Neural Networks (RNN)

U V W

P( )

hidden layer input word

  • utput words

slide-55
SLIDE 55

Recurrent Neural Networks (RNN)

U V W

P( )

hidden layer input word

  • utput words

 

http://rnnlm.org/

slide-56
SLIDE 56

Code Completion

smsMgr = SmsManager.getDefault(); int length = message.length(); if (length > MAX_SMS_MESSAGE_LENGTH) { list = smsMgr.divideMessage(message); ? {smsMgr, list} // (Hole H1) } else { ? {smsMgr, message} // (Hole H2) }

slide-57
SLIDE 57

Code Completion

smsMgr = SmsManager.getDefault(); int length = message.length(); if (length > MAX_SMS_MESSAGE_LENGTH) { list = smsMgr.divideMessage(message); ? {smsMgr, list} // (Hole H1) } else { ? {smsMgr, message} // (Hole H2) } smsMgr: getDefaultresult divideMessage H1

getDefaultresult H2

slide-58
SLIDE 58

Code Completion

smsMgr = SmsManager.getDefault(); int length = message.length(); if (length > MAX_SMS_MESSAGE_LENGTH) { list = smsMgr.divideMessage(message); ? {smsMgr, list} // (Hole H1) } else { ? {smsMgr, message} // (Hole H2) } smsMgr: getDefaultresult divideMessage H1

getDefaultresult H2

slide-59
SLIDE 59

Code Completion

smsMgr = SmsManager.getDefault(); int length = message.length(); if (length > MAX_SMS_MESSAGE_LENGTH) { list = smsMgr.divideMessage(message); ? {smsMgr, list} // (Hole H1) } else { ? {smsMgr, message} // (Hole H2) } list: divideMessageresult H1 smsMgr: getDefaultresult divideMessage H1

getDefaultresult H2

slide-60
SLIDE 60

Code Completion

smsMgr = SmsManager.getDefault(); int length = message.length(); if (length > MAX_SMS_MESSAGE_LENGTH) { list = smsMgr.divideMessage(message); ? {smsMgr, list} // (Hole H1) } else { ? {smsMgr, message} // (Hole H2) } list: divideMessageresult H1 smsMgr: getDefaultresult divideMessage H1

getDefaultresult H2

slide-61
SLIDE 61

Code Completion

smsMgr = SmsManager.getDefault(); int length = message.length(); if (length > MAX_SMS_MESSAGE_LENGTH) { list = smsMgr.divideMessage(message); ? {smsMgr, list} // (Hole H1) } else { ? {smsMgr, message} // (Hole H2) } list: divideMessageresult H1 smsMgr: getDefaultresult divideMessage H1

getDefaultresult H2

message: length divideMessageparam1 length H2

slide-62
SLIDE 62

Code Completion

smsMgr = SmsManager.getDefault(); int length = message.length(); if (length > MAX_SMS_MESSAGE_LENGTH) { list = smsMgr.divideMessage(message); ? {smsMgr, list} // (Hole H1) } else { ? {smsMgr, message} // (Hole H2) } list: divideMessageresult H1 smsMgr: getDefaultresult divideMessage H1

getDefaultresult H2

message: length divideMessageparam1 length H2

slide-63
SLIDE 63

getDefaultresult divideMessage H1 getDefaultresult H2 divideMessageresult H1 length H2 13

Code Completion

slide-64
SLIDE 64

getDefaultresult divideMessage sendMultipartTextMessage 0.0033 getDefaultresult divideMessage sendTextMessage 0.0016 getDefaultresult sendTextMessage 0.0073 getDefaultresult sendMultipartTextMessage 0.0010 divideMessageresult sendMultipartTextMessageparam3 0.0821 length length 0.0132 length split 0.0080 length sendTextMessageparam3 0.0017

Code Completion

slide-65
SLIDE 65

getDefaultresult divideMessage sendMultipartTextMessage 0.0033 getDefaultresult divideMessage sendTextMessage 0.0016 getDefaultresult sendTextMessage 0.0073 getDefaultresult sendMultipartTextMessage 0.0010 divideMessageresult sendMultipartTextMessageparam3 0.0821 length length 0.0132 length split 0.0080 length sendTextMessageparam3 0.0017

Code Completion

slide-66
SLIDE 66

getDefaultresult divideMessage sendMultipartTextMessage 0.0033 getDefaultresult divideMessage sendTextMessage 0.0016 getDefaultresult sendTextMessage 0.0073 getDefaultresult sendMultipartTextMessage 0.0010 divideMessageresult sendMultipartTextMessageparam3 0.0821 length length 0.0132 length split 0.0080 length sendTextMessageparam3 0.0017

Code Completion

slide-67
SLIDE 67

getDefaultresult divideMessage sendMultipartTextMessage 0.0033 getDefaultresult divideMessage sendTextMessage 0.0016 getDefaultresult sendTextMessage 0.0073 getDefaultresult sendMultipartTextMessage 0.0010 divideMessageresult sendMultipartTextMessageparam3 0.0821 length length 0.0132 length split 0.0080 length sendTextMessageparam3 0.0017

Code Completion

slide-68
SLIDE 68

getDefaultresult divideMessage sendMultipartTextMessage 0.0033 getDefaultresult divideMessage sendTextMessage 0.0016 getDefaultresult sendTextMessage 0.0073 getDefaultresult sendMultipartTextMessage 0.0010 divideMessageresult sendMultipartTextMessageparam3 0.0821 length length 0.0132 length split 0.0080 length sendTextMessageparam3 0.0017

Code Completion

slide-69
SLIDE 69

smsMgr = SmsManager.getDefault(); int length = message.length(); if (length > MAX_SMS_MESSAGE_LENGTH) { list = smsMgr.divideMessage(message); smsMgr.sendMultipartTextMessage(...list...); } else { smsMgr.sendTextMessage(...message...); }

Code Completion

slide-70
SLIDE 70
slide-71
SLIDE 71
slide-72
SLIDE 72
slide-73
SLIDE 73

slide-74
SLIDE 74

slide-75
SLIDE 75

slide-76
SLIDE 76

function f(a) { var b = document.getElementById(a); return b; }

slide-77
SLIDE 77

function f(a) { var b = document.getElementById(a); return b; } getElementById f document a b

slide-78
SLIDE 78

function f(a) { var b = document.getElementById(a); return b; } getElementById f document a b

slide-79
SLIDE 79

Facts to be predicted are dependent Millions of candidate choices Must quickly learn from huge codebases Prediction should be fast (real time)

slide-80
SLIDE 80
slide-81
SLIDE 81
slide-82
SLIDE 82

Factors

  • A factor (or potential)  is a function from a set of

random variables D to a real number R  : D  R

  • The set of variables D is the scope of the factor 

– we are typically concerned with non-negative factors

  • Intuition: captures affinity, agreement, compatibility
  • f the variables in D
slide-83
SLIDE 83

Factors: Example

A B value 30 1 5 1 1 1 1 10

1 (0,0) = 30 says we believe Alice and Bob agree on 0 with belief 30 – 3 (C,D) says that Ceco and Dobri argue all the time 

1 (A,B)

B C value 100 1 1 1 1 1 1 100

2 (B,C)

C D value 1 1 100 1 100 1 1 1

3 (C,D)

D A value 100 1 1 1 1 1 1 100

4 (D,A)

slide-84
SLIDE 84

Factors: Example

A B value 30 1 5 1 1 1 1 10

1 (0,0) = 30 says we believe Alice and Bob agree on 0 with belief 30 – 3 (C,D) says that Ceco and Dobri argue all the time 

1 (A,B)

B C value 100 1 1 1 1 1 1 100

2 (B,C)

C D value 1 1 100 1 100 1 1 1

3 (C,D)

D A value 100 1 1 1 1 1 1 100

4 (D,A)

slide-85
SLIDE 85

Defining a Global Probabilistic Model

P(A, B, C, D) = F(A,B,C,D) / Z(A,B,C,D)

F(A, B, C, D) = 1 (A,B)  2 (B,C)  3 (C,D)  4 (D,A) Z(A,B,C,D) =  F(a, b, c, d)

a  A, b  B c  C, d  D

Partition function Joint probability distribution

slide-86
SLIDE 86

P(A,B,C,D)

A B C D Unnormalized (F) Normalized (P = F/Z) 300,000 0.04 1 300,000 0.04 1 300,000 0.04 1 1 30 4.1  10-6 … … … … … …

Z(A,B,C,D) = 7,201,840

slide-87
SLIDE 87

P(A,B,C,D)

A B C D Unnormalized (F) Normalized (P = F/Z) 300,000 0.04 1 300,000 0.04 1 300,000 0.04 1 1 30 4.1  10-6 … … … … … …

Z(A,B,C,D) = 7,201,840 P(A, B, C, D): P(B = 1) =  P(A, 1, C, D) ~= 0.732

a  A c  C d  D

slide-88
SLIDE 88

( ) 1 (

)  2 ( )  …  m ( ) ( ) ( )  1 ( )  2 ( )  …  m ( )

slide-89
SLIDE 89

( ) 1 (

)  2 ( )  …  m ( ) ( ) ( )  1 ( )  2 ( )  …  m ( )

slide-90
SLIDE 90

Graphs vs. Probability Distributions

slide-91
SLIDE 91

1 ( ) , … , m ( )

slide-92
SLIDE 92

1 ( ) , … , m ( )

( )

1 ( )  2 ( )  3 ( )  4 ( ) / Z

slide-93
SLIDE 93

1 ( ) , … , m ( )

( )

1 ( )  2 ( )  3 ( )  4 ( ) / Z

slide-94
SLIDE 94

1 ( ) , … , m ( )

( )

1 ( )  2 ( )  3 ( )  4 ( ) / Z

( )

1 ( )  2 ( ) / Z

slide-95
SLIDE 95

1 ( ) , … , m ( )

( )

1 ( )  2 ( )  3 ( )  4 ( ) / Z

( )

1 ( )  2 ( ) / Z

slide-96
SLIDE 96

1 ( ) , … , m ( )

( ) 1 (

)  2 ( ) / Z

slide-97
SLIDE 97

1 ( ) , … , m ( )

( ) 1 (

)  2 ( ) / Z

slide-98
SLIDE 98

1 ( ) , … , m ( )

( ) 1 (

)  2 ( ) / Z

( ) 1 (

) / Z

slide-99
SLIDE 99

1 ( ) , … , m ( )

( ) 1 (

)  2 ( ) / Z

( ) 1 (

) / Z

slide-100
SLIDE 100

1 ( ) , … , m ( )

( ) 1 (

)  2 ( )  3 ( )  4 ( ) / Z

slide-101
SLIDE 101

1 ( ) , … , m ( )

( ) 1 (

)  2 ( )  3 ( )  4 ( ) / Z

slide-102
SLIDE 102

Graphs vs. Probabilities

There is an important connection between a probability distribution that factorizes over a graph and the properties of the graph. In particular, we can discover various independence properties of the probabilistic distribution directly from the graph

slide-103
SLIDE 103

P(A, B | S) = P(A | S)  P(B | S)

slide-104
SLIDE 104

P(A, B | S) = P(A | S)  P(B | S)

slide-105
SLIDE 105
slide-106
SLIDE 106

 

slide-107
SLIDE 107

I( )

I( ) I( )  I( )

slide-108
SLIDE 108

I( )

I( ) I( )  I( ) I( )  I( )

slide-109
SLIDE 109

(0, 0, 0, 0) = 1/8 (1, 0, 0, 0) = 1/8 (1, 1, 0, 0) = 1/8 (1, 1, 1, 0) = 1/8 (0, 0, 0, 1) = 1/8 (0, 0, 1, 1) = 1/8 (0, 1, 1, 1) = 1/8 (1, 1, 1, 1) = 1/8

I( ):

 

slide-110
SLIDE 110

(0, 0, 0, 0) = 1/8 (1, 0, 0, 0) = 1/8 (1, 1, 0, 0) = 1/8 (1, 1, 1, 0) = 1/8 (0, 0, 0, 1) = 1/8 (0, 0, 1, 1) = 1/8 (0, 1, 1, 1) = 1/8 (1, 1, 1, 1) = 1/8

I( )  I( ),

I( ):

 

slide-111
SLIDE 111

( ) (

) : ( )  ( )

( ) ( ) ( )  ( )  ( )  ( )  ( )  ( )  ( )  ( )

slide-112
SLIDE 112

( ):

( ):

( ):

slide-113
SLIDE 113

Graphical Models: So far

So far we learned what a Markov Network is, what it means for a probability distribution to factor over a graph and how to extract information about independence of variables from the graph. We next look at two equivalent representation of Markov Networks, one of which is amenable to inference queries (factor graphs) and another which is amenable to learning from data (e.g., log-linear form).

slide-114
SLIDE 114

𝑔1(D1) 𝑔𝑙(D𝑙) D𝑗 𝑔𝑗(D𝑗)

( )  𝑓𝑦𝑞−

𝑥𝑗  𝑔𝑗(D𝑗)

𝑙 𝑗 =1

( ) = 1 ( ) 𝑓𝑦𝑞−

𝑥𝑗  𝑔𝑗(D𝑗)

𝑙 𝑗 =1

slide-115
SLIDE 115

i (D𝑗) 𝑓𝑦𝑞 −𝑥𝑗  𝑔𝑗(D𝑗) 𝑓𝑦𝑞−

𝑥𝑗  𝑔𝑗(D𝑗)

𝑙 𝑗 =1

= 𝑓𝑦𝑞−𝑥1  𝑔1 D1  𝑓𝑦𝑞−𝑥2  𝑔2 D2 …  𝑓𝑦𝑞(−𝑥𝑙  𝑔𝑙 D𝑙 = 𝑓𝑦𝑞(−𝑥1  𝑔1 D1 − 𝑥2  𝑔2 D2 … − 𝑥𝑙  𝑔𝑙(D𝑙)) = 1 (D1)  2 D2 …  k (D𝑙)

( ) 1 (D1)  2 (D2)  …  k (Dk)

( )

slide-116
SLIDE 116

( )  𝑓𝑦𝑞−

𝑥𝑗  𝑔𝑗(D𝑗)

𝑙 𝑗 =1

( ) = 1 ( ) 𝑓𝑦𝑞−

𝑥𝑗  𝑔𝑗(D𝑗)

𝑙 𝑗 =1

slide-117
SLIDE 117

Feature Function: Example

1 : 1 ( , ) = 148.41 1  𝑔A = B A, B 𝑔1 A, B = 1 A = B and 𝑥1 =

slide-118
SLIDE 118

Factors vs. Features + Weights

A B value 30 1 5 1 1 1 1 10

1 (A,B)

B C value 100 1 1 1 1 1 1 100

2 (B,C)

C D value 1 1 100 1 100 1 1 1

3 (C,D)

D A value 100 1 1 1 1 1 1 100

4 (D,A)

slide-119
SLIDE 119

Factors vs. Features + Weights

A B value 30 1 5 1 1 1 1 10

1 (A,B)

i (D𝑗) 𝑓𝑦𝑞 −𝑥𝑗  𝑔𝑗(D𝑗)

slide-120
SLIDE 120

Factors vs. Features + Weights

A B value 30 1 5 1 1 1 1 10

1 (A,B)

A B value

  • 3.4

1

  • 1.61

1 1 1

  • 2.3

𝑥1  𝑔1(A, B)

𝑥1 = 1 𝑔1 A, B = value

i (D𝑗) 𝑓𝑦𝑞 −𝑥𝑗  𝑔𝑗(D𝑗)

slide-121
SLIDE 121

Factors vs. Features + Weights

A B value 30 1 5 1 1 1 1 10

1 (A,B)

B C value 100 1 1 1 1 1 1 100

2 (B,C)

A B value

  • 3.4

1

  • 1.61

1 1 1

  • 2.3

𝑥1  𝑔1(A, B)

𝑥1 = 1 𝑔1 A, B = value

i (D𝑗) 𝑓𝑦𝑞 −𝑥𝑗  𝑔𝑗(D𝑗)

slide-122
SLIDE 122

Factors vs. Features + Weights

A B value 30 1 5 1 1 1 1 10

1 (A,B)

B C value 100 1 1 1 1 1 1 100

2 (B,C)

A B value

  • 3.4

1

  • 1.61

1 1 1

  • 2.3

𝑥1  𝑔1(A, B)

B C value

  • 4.61

1 1 1 1

  • 4.61

𝑥2  𝑔2(B, C)

𝑥1 = 1 𝑔1 A, B = value 𝑥2 = −4.61 𝑔2 B, C = 1 if B = C 0 else

i (D𝑗) 𝑓𝑦𝑞 −𝑥𝑗  𝑔𝑗(D𝑗)

slide-123
SLIDE 123

Factors vs. Features + Weights

A B value 30 1 5 1 1 1 1 10

1 (A,B)

B C value 100 1 1 1 1 1 1 100

2 (B,C)

C D value 1 1 100 1 100 1 1 1

3 (C,D)

A B value

  • 3.4

1

  • 1.61

1 1 1

  • 2.3

𝑥1  𝑔1(A, B)

B C value

  • 4.61

1 1 1 1

  • 4.61

𝑥2  𝑔2(B, C)

𝑥1 = 1 𝑔1 A, B = value 𝑥2 = −4.61 𝑔2 B, C = 1 if B = C 0 else

i (D𝑗) 𝑓𝑦𝑞 −𝑥𝑗  𝑔𝑗(D𝑗)

slide-124
SLIDE 124

Factors vs. Features + Weights

A B value 30 1 5 1 1 1 1 10

1 (A,B)

B C value 100 1 1 1 1 1 1 100

2 (B,C)

C D value 1 1 100 1 100 1 1 1

3 (C,D)

A B value

  • 3.4

1

  • 1.61

1 1 1

  • 2.3

𝑥1  𝑔1(A, B)

B C value

  • 4.61

1 1 1 1

  • 4.61

C D value 1

  • 4.61

1

  • 4.61

1 1

𝑥2  𝑔2(B, C) 𝑥3  𝑔3(C, D)

𝑥1 = 1 𝑔1 A, B = value 𝑥2 = −4.61 𝑔2 B, C = 1 if B = C 0 else 𝑥3 = −4.61 𝑔3 C, D = 1 if C  D 0 else

i (D𝑗) 𝑓𝑦𝑞 −𝑥𝑗  𝑔𝑗(D𝑗)

slide-125
SLIDE 125

Factors vs. Features + Weights

A B value 30 1 5 1 1 1 1 10

1 (A,B)

B C value 100 1 1 1 1 1 1 100

2 (B,C)

C D value 1 1 100 1 100 1 1 1

3 (C,D)

D A value 100 1 1 1 1 1 1 100

4 (D,A)

A B value

  • 3.4

1

  • 1.61

1 1 1

  • 2.3

𝑥1  𝑔1(A, B)

B C value

  • 4.61

1 1 1 1

  • 4.61

C D value 1

  • 4.61

1

  • 4.61

1 1

𝑥2  𝑔2(B, C) 𝑥3  𝑔3(C, D)

𝑥1 = 1 𝑔1 A, B = value 𝑥2 = −4.61 𝑔2 B, C = 1 if B = C 0 else 𝑥3 = −4.61 𝑔3 C, D = 1 if C  D 0 else

i (D𝑗) 𝑓𝑦𝑞 −𝑥𝑗  𝑔𝑗(D𝑗)

slide-126
SLIDE 126

Factors vs. Features + Weights

A B value 30 1 5 1 1 1 1 10

1 (A,B)

B C value 100 1 1 1 1 1 1 100

2 (B,C)

C D value 1 1 100 1 100 1 1 1

3 (C,D)

D A value 100 1 1 1 1 1 1 100

4 (D,A)

A B value

  • 3.4

1

  • 1.61

1 1 1

  • 2.3

𝑥1  𝑔1(A, B)

B C value

  • 4.61

1 1 1 1

  • 4.61

C D value 1

  • 4.61

1

  • 4.61

1 1 D A value

  • 4.61

1 1 1 1

  • 4.61

𝑥2  𝑔2(B, C) 𝑥3  𝑔3(C, D) 𝑥4  𝑔4(D, A)

𝑥1 = 1 𝑔1 A, B = value 𝑥2 = −4.61 𝑔2 B, C = 1 if B = C 0 else 𝑥3 = −4.61 𝑔3 C, D = 1 if C  D 0 else 𝑥4 = −4.61 𝑔4 D, A = 1 if D = A 0 else

i (D𝑗) 𝑓𝑦𝑞 −𝑥𝑗  𝑔𝑗(D𝑗)

slide-127
SLIDE 127

Indicator Feature Function

D𝑗

𝑔ab A, B

𝑔 A, B

slide-128
SLIDE 128

Example: Using Indicator Function

A B value

  • 3.4

1

  • 1.61

1 1 1

  • 2.3

𝑥1  𝑔1(A, B)

B C value

  • 4.61

1 1 1 1

  • 4.61

C D value 1

  • 4.61

1

  • 4.61

1 1 D A value

  • 4.61

1 1 1 1

  • 4.61

𝑥2  𝑔2(B, C) 𝑥3  𝑔3(C, D) 𝑥4  𝑔4(D, A)

𝑥1 = 1 𝑔1 A, B = value 𝑥2 = −4.61 𝑔2 B, C = 1 if B = C 0 else 𝑥3 = −4.61 𝑔3 C, D = 1 if C  D 0 else 𝑥4 = −4.61 𝑔4 D, A = 1 if D = A 0 else

slide-129
SLIDE 129

Example: Using Indicator Function

A B value

  • 3.4

1

  • 1.61

1 1 1

  • 2.3

𝑥1  𝑔1(A, B)

𝑥1 = 1 𝑔1 A, B = value

slide-130
SLIDE 130

Example: Using Indicator Function

A B value

  • 3.4

1

  • 1.61

1 1 1

  • 2.3

𝑥1  𝑔1(A, B)

𝑥1 = 1 𝑔1 A, B = value 𝑔1

00 A, B = 1 if

A = 0, B = 0 𝑔1

01 A, B = 1 if

A = 0, B = 1 𝑔1

10 A, B = 1 if

A = 1, B = 0 𝑔1

11 A, B = 1 if

A = 1, B = 1

slide-131
SLIDE 131

Example: Using Indicator Function

A B value

  • 3.4

1

  • 1.61

1 1 1

  • 2.3

𝑥1  𝑔1(A, B)

𝑥1 = 1 𝑔1 A, B = value 𝑔1

00 A, B = 1 if

A = 0, B = 0 𝑔1

01 A, B = 1 if

A = 0, B = 1 𝑔1

10 A, B = 1 if

A = 1, B = 0 𝑔1

11 A, B = 1 if

A = 1, B = 1 𝑔1 A, B =

  • 3.4  𝑔1

00 A, B +

  • 1.61 𝑔1

01 A, B +

1 𝑔1

10 A, B +

  • 2.3  𝑔1

11 A, B

slide-132
SLIDE 132

Example: Using Indicator Function

A B value

  • 3.4

1

  • 1.61

1 1 1

  • 2.3

𝑥1  𝑔1(A, B)

𝑥1 = 1 𝑔1 A, B = value 𝑔1 A, B =

  • 3.4  𝑔1

00 A, B +

  • 1.61 𝑔1

01 A, B +

1 𝑔1

10 A, B +

  • 2.3  𝑔1

11 A, B

slide-133
SLIDE 133

Example: Using Indicator Function

A B value

  • 3.4

1

  • 1.61

1 1 1

  • 2.3

𝑥1  𝑔1(A, B)

B C value

  • 4.61

1 1 1 1

  • 4.61

𝑥2  𝑔2(B, C)

𝑥1 = 1 𝑔1 A, B = value 𝑥2 = −4.61 𝑔2 B, C = 1 if B = C 0 else 𝑔1 A, B =

  • 3.4  𝑔1

00 A, B +

  • 1.61 𝑔1

01 A, B +

1 𝑔1

10 A, B +

  • 2.3  𝑔1

11 A, B

slide-134
SLIDE 134

Example: Using Indicator Function

A B value

  • 3.4

1

  • 1.61

1 1 1

  • 2.3

𝑥1  𝑔1(A, B)

B C value

  • 4.61

1 1 1 1

  • 4.61

𝑥2  𝑔2(B, C)

𝑥1 = 1 𝑔1 A, B = value 𝑥2 = −4.61 𝑔2 B, C = 1 if B = C 0 else 𝑔2

00 B, C = 1 if

B = 0, C = 0 𝑔2

01 B, C = 1 if

B = 0, C = 1 𝑔2

10 B, C = 1 if

B = 1, C = 0 𝑔2

11 B, C = 1 if

B = 1, C = 1 𝑔1 A, B =

  • 3.4  𝑔1

00 A, B +

  • 1.61 𝑔1

01 A, B +

1 𝑔1

10 A, B +

  • 2.3  𝑔1

11 A, B

slide-135
SLIDE 135

Example: Using Indicator Function

A B value

  • 3.4

1

  • 1.61

1 1 1

  • 2.3

𝑥1  𝑔1(A, B)

B C value

  • 4.61

1 1 1 1

  • 4.61

𝑥2  𝑔2(B, C)

𝑥1 = 1 𝑔1 A, B = value 𝑥2 = −4.61 𝑔2 B, C = 1 if B = C 0 else 𝑔2

00 B, C = 1 if

B = 0, C = 0 𝑔2

01 B, C = 1 if

B = 0, C = 1 𝑔2

10 B, C = 1 if

B = 1, C = 0 𝑔2

11 B, C = 1 if

B = 1, C = 1 𝑔2 B, C = 𝑔2

00 B, C + 𝑔2 11 B, C

𝑔1 A, B =

  • 3.4  𝑔1

00 A, B +

  • 1.61 𝑔1

01 A, B +

1 𝑔1

10 A, B +

  • 2.3  𝑔1

11 A, B

slide-136
SLIDE 136

Example: Using Indicator Function

A B value

  • 3.4

1

  • 1.61

1 1 1

  • 2.3

𝑥1  𝑔1(A, B)

B C value

  • 4.61

1 1 1 1

  • 4.61

𝑥2  𝑔2(B, C)

𝑥1 = 1 𝑔1 A, B = value 𝑥2 = −4.61 𝑔2 B, C = 1 if B = C 0 else 𝑔2 B, C = 𝑔2

00 B, C + 𝑔2 11 B, C

𝑔1 A, B =

  • 3.4  𝑔1

00 A, B +

  • 1.61 𝑔1

01 A, B +

1 𝑔1

10 A, B +

  • 2.3  𝑔1

11 A, B

slide-137
SLIDE 137

Example: Using Indicator Function

A B value

  • 3.4

1

  • 1.61

1 1 1

  • 2.3

𝑥1  𝑔1(A, B)

B C value

  • 4.61

1 1 1 1

  • 4.61

𝑥2  𝑔2(B, C)

𝑥1 = 1 𝑔1 A, B = value 𝑥2 = −4.61 𝑔2 B, C = 1 if B = C 0 else 𝑔2 B, C = 𝑔2

00 B, C + 𝑔2 11 B, C

𝑔1 A, B =

  • 3.4  𝑔1

00 A, B +

  • 1.61 𝑔1

01 A, B +

1 𝑔1

10 A, B +

  • 2.3  𝑔1

11 A, B

slide-138
SLIDE 138

Example: Using Indicator Function

A B value

  • 3.4

1

  • 1.61

1 1 1

  • 2.3

𝑥1  𝑔1(A, B)

B C value

  • 4.61

1 1 1 1

  • 4.61

C D value 1

  • 4.61

1

  • 4.61

1 1 D A value

  • 4.61

1 1 1 1

  • 4.61

𝑥2  𝑔2(B, C) 𝑥3  𝑔3(C, D) 𝑥4  𝑔4(D, A)

𝑥1 = 1 𝑔1 A, B = value 𝑥2 = −4.61 𝑔2 B, C = 1 if B = C 0 else 𝑥3 = −4.61 𝑔3 C, D = 1 if C  D 0 else 𝑥4 = −4.61 𝑔4 D, A = 1 if D = A 0 else 𝑔3

00 C, D = 1 if

C = 0, D = 0 𝑔3

01 C, D = 1 if

C = 0, D = 1 𝑔3

10 C, D = 1 if

C = 1, D = 0 𝑔3

11 C, D = 1 if

C = 1, D = 1 𝑔4

00 D, A = 1 if

D = 0, A = 0 𝑔4

01 C, D = 1 if

D = 0, A = 1 𝑔4

10 C, D = 1 if

D = 1, A = 0 𝑔4

11 C, D = 1 if

D = 1, A = 1 𝑔2 B, C = 𝑔2

00 B, C + 𝑔2 11 B, C

𝑔1 A, B =

  • 3.4  𝑔1

00 A, B +

  • 1.61 𝑔1

01 A, B +

1 𝑔1

10 A, B +

  • 2.3  𝑔1

11 A, B

slide-139
SLIDE 139

Example: Using Indicator Function

A B value

  • 3.4

1

  • 1.61

1 1 1

  • 2.3

𝑥1  𝑔1(A, B)

B C value

  • 4.61

1 1 1 1

  • 4.61

C D value 1

  • 4.61

1

  • 4.61

1 1 D A value

  • 4.61

1 1 1 1

  • 4.61

𝑥2  𝑔2(B, C) 𝑥3  𝑔3(C, D) 𝑥4  𝑔4(D, A)

𝑥1 = 1 𝑔1 A, B = value 𝑥2 = −4.61 𝑔2 B, C = 1 if B = C 0 else 𝑥3 = −4.61 𝑔3 C, D = 1 if C  D 0 else 𝑥4 = −4.61 𝑔4 D, A = 1 if D = A 0 else 𝑔3 C, D = 𝑔3

01 C, D + 𝑔3 10 C, D

𝑔4 D, A = 𝑔4

00 D, A + 𝑔4 11 D, A )

𝑔2 B, C = 𝑔2

00 B, C + 𝑔2 11 B, C

𝑔1 A, B =

  • 3.4  𝑔1

00 A, B +

  • 1.61 𝑔1

01 A, B +

1 𝑔1

10 A, B +

  • 2.3  𝑔1

11 A, B

slide-140
SLIDE 140

Example: Using Indicator Function

A B value

  • 3.4

1

  • 1.61

1 1 1

  • 2.3

𝑥1  𝑔1(A, B)

B C value

  • 4.61

1 1 1 1

  • 4.61

C D value 1

  • 4.61

1

  • 4.61

1 1 D A value

  • 4.61

1 1 1 1

  • 4.61

𝑥2  𝑔2(B, C) 𝑥3  𝑔3(C, D) 𝑥4  𝑔4(D, A)

𝑥1 = 1 𝑔1 A, B = value 𝑥2 = −4.61 𝑔2 B, C = 1 if B = C 0 else 𝑥3 = −4.61 𝑔3 C, D = 1 if C  D 0 else 𝑥4 = −4.61 𝑔4 D, A = 1 if D = A 0 else 𝑔3 C, D = 𝑔3

01 C, D + 𝑔3 10 C, D

𝑔4 D, A = 𝑔4

00 D, A + 𝑔4 11 D, A )

𝑔2 B, C = 𝑔2

00 B, C + 𝑔2 11 B, C

( ) = 1 ( ) 𝑓𝑦𝑞−

𝑥𝑗  𝑔𝑗(D𝑗)

𝑙 𝑗 =1 𝑔1 A, B =

  • 3.4  𝑔1

00 A, B +

  • 1.61 𝑔1

01 A, B +

1 𝑔1

10 A, B +

  • 2.3  𝑔1

11 A, B

slide-141
SLIDE 141

Example: Using Indicator Function

A B value

  • 3.4

1

  • 1.61

1 1 1

  • 2.3

𝑥1  𝑔1(A, B)

B C value

  • 4.61

1 1 1 1

  • 4.61

C D value 1

  • 4.61

1

  • 4.61

1 1 D A value

  • 4.61

1 1 1 1

  • 4.61

𝑥2  𝑔2(B, C) 𝑥3  𝑔3(C, D) 𝑥4  𝑔4(D, A)

𝑥1 = 1 𝑔1 A, B = value 𝑥2 = −4.61 𝑔2 B, C = 1 if B = C 0 else 𝑥3 = −4.61 𝑔3 C, D = 1 if C  D 0 else 𝑥4 = −4.61 𝑔4 D, A = 1 if D = A 0 else 𝑔1 A, B =

  • 3.4  𝑔1

00 A, B +

  • 1.61 𝑔1

01 A, B +

1 𝑔1

10 A, B +

  • 2.3  𝑔1

11 A, B

𝑔3 C, D = 𝑔3

01 C, D + 𝑔3 10 C, D

𝑔4 D, A = 𝑔4

00 D, A + 𝑔4 11 D, A )

𝑔2 B, C = 𝑔2

00 B, C + 𝑔2 11 B, C

(A, B, C, D) = 𝑓𝑦𝑞−SP Z(A, B, C, D)

SP = −3.4 3.4  𝑔1

00 A, B + −1.6

1.61  𝑔1

01 A, B + 1  𝑔1 10 A, B + −2.

2.3  𝑔1

11 A, B + −4.61  𝑔2 00 B, C +

−4.61  𝑔2

11 B, C + −𝟓. 𝟕𝟐  𝑔3 01 C, D + −𝟓. 𝟕𝟐  𝑔3 10 C, D +−4.61  𝑔4 00 D, A + −4.61  𝑔4 11 D, A )

slide-142
SLIDE 142

Graphical Models: So far

In the last segment we learned about log-linear models and indicator functions. Log-linear models are important because they allow to capture factors more concisely, the indicator functions can be directly extracted from data, and the weights can be learned (to fit the

  • ptimization objective, discussed later).

So far we have been discussing the joint probability distribution ( ). We next focus on conditional distributions.

slide-143
SLIDE 143

Conditional Random Field

   

(  ) 1 (

)  2 ( )  …  m ( ) ( ) ( )  1 ( )  2 ( )  …  m ( )

slide-144
SLIDE 144

(  ) 1 (

)  2 ( )  …  m ( ) ( ) ( )  1 ( )  2 ( )  …  m ( )

Conditional Random Field

slide-145
SLIDE 145

Conditional Random Field: Example

slide-146
SLIDE 146

Conditional Random Field: Example

slide-147
SLIDE 147

Conditional Random Field: Example

slide-148
SLIDE 148

Conditional Random Field: Example

slide-149
SLIDE 149

Conditional Random Field: Example

slide-150
SLIDE 150

Conditional Random Field: Example

slide-151
SLIDE 151

Conditional Random Field: Example

1

t (

) 2

t (

)

slide-152
SLIDE 152

Conditional Random Field: Example

1

t (

) 2

t (

)

slide-153
SLIDE 153

Conditional Random Field: Example

(  )

1

1 (

)  …  7

6 (

)  2

1 (

)  …  2

7 (

)  1

1 (

)  …  7

6 (

)  2

1 (

)  …  2

7 (

)

slide-154
SLIDE 154

Conditional Random Field: Example

(  )

1

1 (

)  …  7

6 (

)  2

1 (

)  …  2

7 (

)  1

1 (

)  …  7

6 (

)  2

1 (

)  …  2

7 (

)

slide-155
SLIDE 155

𝑄 𝑧 𝑦 =

1 𝑎(𝑦) exp

(𝒙𝑈𝒈(𝑧, 𝑦))

Conditional Random Field: Log-Linear Form

slide-156
SLIDE 156

i t r 𝑧 𝑗, 𝑠 𝑦 𝑢

𝑄 𝑧 𝑦 =

1 𝑎(𝑦) exp

(𝒙𝑈𝒈(𝑧, 𝑦))

slide-157
SLIDE 157

first town w Pencho Portland 0.1 James Portland 0.3 first last w Pencho Smith 0.7 James Chandra 0.4

𝑔1 𝑔2 𝑔3 𝑔4 first town last 𝑧 𝑦

𝑄 𝑧 𝑦 =

1 𝑎(𝑦) exp

(𝒙𝑈𝒈(𝑧, 𝑦))

slide-158
SLIDE 158

𝑄 first, last | town = exp ( 0.1 ∗ f1 + 0.3 ∗ f2 + 0.7 ∗ f3 + 0.4 ∗ f4) 𝑎(town)

𝑄 𝑧 𝑦 =

1 𝑎(𝑦) exp

(𝒙𝑈𝒈(𝑧, 𝑦))

first town w Pencho Portland 0.1 James Portland 0.3 first last w Pencho Smith 0.7 James Chandra 0.4

𝑔1 𝑔2 𝑔3 𝑔4 first town last 𝑧 𝑦

slide-159
SLIDE 159
slide-160
SLIDE 160

Queries: MAP vs. Max Marginals

(𝑧1, … , 𝑧𝑜)MAP 𝑄(𝑧1, … , 𝑧𝑜)

𝑧1, … , 𝑧𝑜

(𝑧1, … , 𝑧𝑜)ML (𝑧1

ML, … , 𝑧𝑜ML)

𝑧1

ML

𝑄(𝑧1)

𝑧1

𝑧n

ML

𝑄(𝑧𝑜)

𝑧𝑜 ……

A B val 0.2 1 0.3 1 0.15 1 1 0.35

slide-161
SLIDE 161

Queries: MAP vs. Max Marginals

(𝑧1, … , 𝑧𝑜)MAP 𝑄(𝑧1, … , 𝑧𝑜)

𝑧1, … , 𝑧𝑜

(𝑧1, … , 𝑧𝑜)ML (𝑧1

ML, … , 𝑧𝑜ML)

𝑧1

ML

𝑄(𝑧1)

𝑧1

𝑧n

ML

𝑄(𝑧𝑜)

𝑧𝑜 ……

A B val 0.2 1 0.3 1 0.15 1 1 0.35

(1,1) MAP (0,1)

ML

A 𝑄(A) 𝑄(A, B) A, B B 𝑄(B)

slide-162
SLIDE 162

 3 1 2

slide-163
SLIDE 163

0 1 2 3 4 B val 0.99 1 0.01

0 (B)

S B val 0.5 1 0.1 1 0.5 1 1 0.9

1 (S,B)

A B val 0.99 1 0.1 1 0.01 1 1 0.9

2 (A,B)

G S val 0.7 1 0.4 1 0.3 1 1 0.6

3 (G,S)

D S val 0.8 1 0.3 1 0.2 1 1 0.7

4 (D,S)

(B, S  G, D, A) 0 (B)  1 (S, B)  2 (A, B)  3 (G, S)  4 (D, S)

Z(G, D, A) B,S (G, D, A)  0 (B)  1 (S, B)  2 (A, B)  3 (G, S)  4 (D, S) P(B=0 | G = 1, D = 0, A = 1)

slide-164
SLIDE 164

0 1 2 3 4 B val 0.99 1 0.01

0 (B)

S B val 0.5 1 0.1 1 0.5 1 1 0.9

1 (S,B)

A B val 0.99 1 0.1 1 0.01 1 1 0.9

2 (A,B)

G S val 0.7 1 0.4 1 0.3 1 1 0.6

3 (G,S)

D S val 0.8 1 0.3 1 0.2 1 1 0.7

4 (D,S)

P(B=0  G, D, A) =  P(B=0, S  G, D, A) = P(B, S=0  G, D, A) + P(B, S=1  G, D, A)

S

P(B=0  G=1, D=0, A=1) = P(B=0, S = 0G=1, D=0, A=1) + P(B=0, S=1G=1, D=0, A=1) P(B=0 | G = 1, D = 0, A = 1)

slide-165
SLIDE 165

0 1 2 3 4 B val 0.99 1 0.01

0 (B)

S B val 0.5 1 0.1 1 0.5 1 1 0.9

1 (S,B)

A B val 0.99 1 0.1 1 0.01 1 1 0.9

2 (A,B)

G S val 0.7 1 0.4 1 0.3 1 1 0.6

3 (G,S)

D S val 0.8 1 0.3 1 0.2 1 1 0.7

4 (D,S)

(G=1, D=0, A=1)

0 (0)  1 (0, 0)  2 (1, 0)  3 (1, 0)  4 (0, 0) + 0 (1)  1 (0, 1)  2 (1, 1)  3 (1, 0)  4 (0, 0) + 0 (0)  1 (1, 0)  2 (1, 0)  3 (1, 1)  4 (0, 1) + 0 (1)  1 (1, 1)  2 (1, 1)  3 (1, 1)  4 (0, 1) + = 0.99  0.5  0.01  0.3  0.8 + 0.01  0.1  0.9  0.3  0.8 + 0.99  0.5  0.01  0.6  0.3 + 0.01  0.9  0.9  0.6  0.7 = 0.001188 + 0.000216 + 0.000891 + 0.003402 = 0.005697

P(B=0 | G = 1, D = 0, A = 1)

slide-166
SLIDE 166

0 1 2 3 4 B val 0.99 1 0.01

0 (B)

S B val 0.5 1 0.1 1 0.5 1 1 0.9

1 (S,B)

A B val 0.99 1 0.1 1 0.01 1 1 0.9

2 (A,B)

G S val 0.7 1 0.4 1 0.3 1 1 0.6

3 (G,S)

D S val 0.8 1 0.3 1 0.2 1 1 0.7

4 (D,S) P(B=0, S = 0G=1, D=0, A=1)

= 0 (B)  1 (S, B)  2 (A, B)  3 (G, S)  4 (D, S)/Z = = 0 (0)  1 (0, 0)  2 (1, 0)  3 (1, 0)  4 (0, 0)/Z = 0.99  0.5  0.01  0.3  0.8)/Z = 0.001188/0.005697

P(B=0, S = 1G=1, D=0, A=1)

= 0 (B)  1 (S, B)  2 (A, B)  3 (G, S)  4 (D, S)/Z = = 0 (0)  1 (1, 0)  2 (1, 0)  3 (1, 1)  4 (0, 1)/Z = 0.99  0.5  0.01  0.6  0.3)/Z = 0.000891/0.005697

+

0.002079/0.005697 P(B=0 | G = 1, D = 0, A = 1)

slide-167
SLIDE 167
slide-168
SLIDE 168

2 1 3 4

1 x(x) 2 x(x) 3 x(x) x 4(x) x 4(x) = 1 x(x)  2 x(x)  3 x(x) A ( )   X(x)

v : Val  MsgVal   v: Val  (MsgVal, (V  Val)) B ( ) C ( )   X(x) =  (( )  A ( )  B ( )  C ( ) )

slide-169
SLIDE 169

v   v(v) = (v) v  v  (v) = 1

  • X

(X) =    v(v) ( X)

slide-170
SLIDE 170

0 1 2 3 4 B val 0.99 1 0.01

0 (B)

S B val 0.5 1 0.1 1 0.5 1 1 0.9

1 (S,B)

A B val 0.99 1 0.1 1 0.01 1 1 0.9

2 (A,B)

G S val 0.7 1 0.4 1 0.3 1 1 0.6

3 (G,S)

D S val 0.8 1 0.3 1 0.2 1 1 0.7

4 (D,S)

P(B=0 | G = 1, D = 0, A = 1)

slide-171
SLIDE 171

0 1 2 3 4 B val 0.99 1 0.01

0 (B)

S B val 0.5 1 0.1 1 0.5 1 1 0.9

1 (S,B)

A B val 0.99 1 0.1 1 0.01 1 1 0.9

2 (A,B)

G S val 0.7 1 0.4 1 0.3 1 1 0.6

3 (G,S)

D S val 0.8 1 0.3 1 0.2 1 1 0.7

4 (D,S)

1 1

P(B=0 | G = 1, D = 0, A = 1)

slide-172
SLIDE 172

0 1 2 3 4

G 3(G = 0) = 0 G 3(G = 1) = 1 D 4(D = 0) = 1 D 4(D = 1) = 0 A 2(A = 0) = 0 A 2(A = 1) = 1 3 S(S = 0) =  3(G, S = 0)  G 3(G)

G

3 S(S = 1) =  3(G, S = 1) G 3(G)

G

4 S(S = 0) =  4(D, S = 0) D 4(D)

D

4 S(S = 1) =  4(D, S = 1)  D 4(D)

D

2 B(B = 0) =  2(A, B = 0)  A 2(A)

A

2 B(B = 1) =  2(A, B = 1) A 2(A)

A

0 B(B = 0) = 0(B = 0) 0 B(B = 1) = 0(B = 1) 1 B(B = 0) =  1(S, B = 0)  S 1(S)

S

1 B(B = 1) =  1(S, B = 1) S 1(S)

S

S 1(S = 0) = 3 S(S = 0)  4 S(S = 0) S 1(S = 1) = 3 S(S = 1)  4 S(S = 1)

P(B=0 | G = 1, D = 0, A = 1)

1 1

slide-173
SLIDE 173

0 1 2 3 4

P(B = 0 | G=1, D=0, A=1) =0 B(B = 0) 1 B(B = 0)  2 B(B = 0)

= 0(B = 0)  (  1(S, B = 0)  S 1(S) )  (  2(A, B = 0)  A 2(A) ) = 0(B = 0)  (  1(S, B = 0)  (3 S(S)  4 S(S)))  ( 2(A, B = 0)  (A 2(A) ) = 0(B = 0)  (  1(S, B = 0)  (( 3(G, S)  G 3(G))  ( 4(D, S) D 4(D))))

 (  2(A, B = 0)  (A 2(A))

S A S A S A G D

P(B=0 | G = 1, D = 0, A = 1)

1 1

slide-174
SLIDE 174

0 1 2 3 4

P(B = 0 | G=1, D=0, A=1) =

= 0.99  (1(S=0, B = 0)  (3(G=0, S=0)  G 3(G=0) + 3(G=1, S=0)  G 3(G=1))  (4(D=0, S=0) D 4(D=0) + 4(D=1, S=0) D 4(D=1))) + (1(S=1, B = 0)  (3(G=0, S=1)  G 3(G=0) + 3(G=1, S=1)  G 3(G=1))  (4(D=0, S=1) D 4(D=0) + 4(D=1, S=1) D 4(D=1)))  (2(A=0, B = 0)  (A 2(A=0) + 2(A=1, B = 0)  (A 2(A=1))) = 0.99  ((0.5  (0.7  0 + 0.3  1)  (0.8  1 + 0.2  0) + (0.5  (0.4  0 + 0.6  1)  (0.3  1 + 0.7  0))  (0.99  0 + 0.01  1) = 0.99  (0.50.30.8 + 0.50.60.3)  0.01 = 0.002079 B val 0.99 1 0.01

0 (B)

S B val 0.5 1 0.1 1 0.5 1 1 0.9

1 (S,B)

A B val 0.99 1 0.1 1 0.01 1 1 0.9

2 (A,B)

G S val 0.7 1 0.4 1 0.3 1 1 0.6

3 (G,S)

D S val 0.8 1 0.3 1 0.2 1 1 0.7

4 (D,S)

P(B=0 | G = 1, D = 0, A = 1)

1 1

slide-175
SLIDE 175

𝑦 𝑧 𝑧1 𝑧2 𝑧𝑜 𝑄 𝑧 𝑦 𝑧1 𝑧2 𝑧𝑜

𝑄 𝑧 𝑦 =

1 𝑎(𝑦) exp

(𝒙𝑈𝒈(𝑧, 𝑦))

slide-176
SLIDE 176

𝑦 𝑧 𝑧1 𝑧2 𝑧𝑜 𝑄 𝑧 𝑦 𝑧1 𝑧2 𝑧𝑜

𝑄 𝑧 𝑦 =

1 𝑎(𝑦) exp

(𝒙𝑈𝒈(𝑧, 𝑦))

𝑧best 𝑄 𝑧 𝑦 𝑧  𝑦 = 𝒙𝑈𝒈(𝑧, 𝑦) 𝑧  𝑦

slide-177
SLIDE 177

𝑦 𝑧 𝑧1 𝑧2 𝑧𝑜 𝑄 𝑧 𝑦 𝑧1 𝑧2 𝑧𝑜

𝑧best 𝑄 𝑧 𝑦 𝑧  𝑦 = 𝒙𝑈𝒈(𝑧, 𝑦) 𝑧  𝑦

𝑄 𝑧 𝑦 =

1 𝑎(𝑦) exp

(𝒙𝑈𝒈(𝑧, 𝑦))

slide-178
SLIDE 178

𝑧1

best

𝑄 𝑧1 𝑦 𝑧n

best

𝑄 𝑧𝑜 𝑦

…………..

𝑧best = (𝑧1

best, … , 𝑧n

best)

slide-179
SLIDE 179

𝑧1

best

𝑄 𝑧1 𝑦 𝑧n

best

𝑄 𝑧𝑜 𝑦

…………..

𝑧best = (𝑧1

best, … , 𝑧n

best)

slide-180
SLIDE 180

function chunkData(e, t) var n = []; var r = e.length; var i = 0; for (; i < r; i += t) if (i + t < r) n.push(e.substring(i, i + t)); else n.push(e.substring(i, r)); return n;

slide-181
SLIDE 181

function chunkData(e, t) var n = []; var r = e.length; var i = 0; for (; i < r; i += t) if (i + t < r) n.push(e.substring(i, i + t)); else n.push(e.substring(i, r)); return n;

t r i

length

i t r

length

… …

slide-182
SLIDE 182

t r i

length

i t r

length

i t w i step 0.5 j step 0.4 i r w i len 0.6 i length 0.3 r length w length length 0.5 len length 0.3

… … i t r

length function chunkData(e, t) var n = []; var r = e.length; var i = 0; for (; i < r; i += t) if (i + t < r) n.push(e.substring(i, i + t)); else n.push(e.substring(i, r)); return n;

slide-183
SLIDE 183

t r i

length

i t r

length

i t w i step 0.5 j step 0.4 i r w i len 0.6 i length 0.3 r length w length length 0.5 len length 0.3

… … i t r

length

𝒙𝑈𝒈(𝑗, 𝑢, 𝑠, 𝑚𝑓𝑜𝑕𝑢ℎ)

function chunkData(e, t) var n = []; var r = e.length; var i = 0; for (; i < r; i += t) if (i + t < r) n.push(e.substring(i, i + t)); else n.push(e.substring(i, r)); return n;

slide-184
SLIDE 184

t r i

length

i t r

length

i t w i step 0.5 j step 0.4 i r w i len 0.6 i length 0.3 r length w length length 0.5 len length 0.3

… … i t r length i len step

𝒙𝑈𝒈(𝑗, 𝑢, 𝑠, 𝑚𝑓𝑜𝑕𝑢ℎ)

function chunkData(e, t) var n = []; var r = e.length; var i = 0; for (; i < r; i += t) if (i + t < r) n.push(e.substring(i, i + t)); else n.push(e.substring(i, r)); return n;

slide-185
SLIDE 185

t r i

length

i t r

length

i t w i step 0.5 j step 0.4 i r w i len 0.6 i length 0.3 r length w length length 0.5 len length 0.3

… …

function chunkData(str, step) var colNames = []; var len = str.length; var i = 0; for (; i < len; i += step) if (i + step < len) colNames.push(str.substring(i, i + step)); else colNames.push(str.substring(i, len)); return colNames;

i t r length i len step

𝒙𝑈𝒈(𝑗, 𝑢, 𝑠, 𝑚𝑓𝑜𝑕𝑢ℎ)

function chunkData(e, t) var n = []; var r = e.length; var i = 0; for (; i < r; i += t) if (i + t < r) n.push(e.substring(i, i + t)); else n.push(e.substring(i, r)); return n;

slide-186
SLIDE 186
slide-187
SLIDE 187

𝒙𝑈

𝑄 𝑧 𝑦 =

1 𝑎(𝑦) exp

(𝒙𝑈𝒈(𝑧, 𝑦))

slide-188
SLIDE 188

∀j ∀y Σ 𝑥ifi(x(j),y(j)) ≥ Σ 𝑥ifi(x(j),y) + 𝚬(y,y(j))

𝒙𝑈

𝑄 𝑧 𝑦 =

1 𝑎(𝑦) exp

(𝒙𝑈𝒈(𝑧, 𝑦))

slide-189
SLIDE 189

∀j ∀y Σ 𝑥ifi(x(j),y(j)) ≥ Σ 𝑥ifi(x(j),y) + 𝚬(y,y(j))

𝒙𝑈

𝑄 𝑧 𝑦 =

1 𝑎(𝑦) exp

(𝒙𝑈𝒈(𝑧, 𝑦))

slide-190
SLIDE 190

∀j ∀y Σ 𝑥ifi(x(j),y(j)) ≥ Σ 𝑥ifi(x(j),y) + 𝚬(y,y(j))

𝒙𝑈

𝑎(𝑦)

𝑄 𝑧 𝑦 =

1 𝑎(𝑦) exp

(𝒙𝑈𝒈(𝑧, 𝑦))

slide-191
SLIDE 191
slide-192
SLIDE 192
slide-193
SLIDE 193
slide-194
SLIDE 194

var n = []; var r = e.length; var i = 0; for (; i < r; i += t) if (i + t < r) n.push(e.subs(i, i + t)); else n.push(e.subs(i, r)); return n; var colNames = []; var len = str.length; var i = 0; for (; i < len; i += step) if (i + step < len) colNames.push(str.subs(i, i + step)); else colNames.push(str.subs(i, len)); return colNames;

150MB Time: milliseconds

Names: 63% Types: 81% (helps typechecking) 𝑄 𝑧 𝑦

slide-195
SLIDE 195