Presentation is loading. Please wait.

Presentation is loading. Please wait.

Tutorial 2 Simple examples of Bayesian networks, Queries, And the stories behind them Tal Shor.

Similar presentations


Presentation on theme: "Tutorial 2 Simple examples of Bayesian networks, Queries, And the stories behind them Tal Shor."β€” Presentation transcript:

1 Tutorial 2 Simple examples of Bayesian networks, Queries, And the stories behind them Tal Shor

2 Fatigue as a product of smoking
H 0.2 h1 Values β„Ž1 – Has a history of smoking 𝑏1 – Has Bronchitis 𝑙1 - Has lung cancer 𝑓1 – Is fatigue 𝑐1 – Positive X-ray B=1 H 0.25 h1 0.05 h2 B L L=1 H 0.003 h1 h2 F=1 L B 0.75 l1 b1 0.10 l2 0.5 b2 0.05 C=1 L 0.6 l1 0.02 l2 F C

3 BN Attributes 𝐼 𝐷 𝐡, βˆ…, 𝐢 - we can clearly see from the graph that bronchitis has no influence on X-ray, and it is only natural 𝐼 𝐷 (𝐻, 𝐡,𝐿 , 𝐹) – given that an individual has both bronchitis and lung cancer – his/her smoking history is no longer relevant when estimating the individual’s fatigue. 𝐼 𝐷 (𝐻, 𝐿, 𝐢) – if we know an individual does not have lung cancer, it does not matter how much he smoked, we won’t find anything in the X-ray scans.

4 BN Attributes (2) Those independencies create a probabilistic function that is easier to compute and much more compact than π·π‘œπ‘š 𝐻 Γ—π·π‘œπ‘š 𝐡 Γ—π·π‘œπ‘š 𝐿 Γ—Dom 𝐹 Γ—π·π‘œπ‘š(𝐢) variables. Without the independencies, those 5 variables would require a table with entries. With them - 𝑃 𝐻, 𝐡, 𝐿. 𝐹, 𝐢 =𝑃 𝐻 ×𝑃 𝐡 𝐻 ×𝑃 𝐿 𝐡 ×𝑃 𝐹 𝐡,𝐿 ×𝑃(𝐢|𝐿) and there are only 11 entries ( ) For example : 𝑃 𝐻=β„Ž1, 𝐡=𝑏2 , 𝐿=𝑙1. 𝐹,=𝑓1, 𝐢=𝑐2 =0.2Γ—0.75Γ—0.003Γ—0.5Γ—0.4

5 Simple Example of Bayesian Network
(*) 𝑃(π‘₯,𝑦,𝑧) = 𝑃(π‘₯) 𝑃(𝑦) 𝑃(𝑧|π‘₯,𝑦) In this BN, X and Y are independent. Follows from definition of BN by summing over values of Z in Eq. (*) yielding 𝑃(π‘₯, 𝑦) = 𝑃(π‘₯) 𝑃(𝑦) . X Y Z

6 Specifying Conditional Probability Tables
BB AA OB OA OO π‘Œ 𝑋 1 …

7 Specifying Conditional Probability Tables
Pr 𝑋=𝐴𝐴 = Pr 𝑋=𝐡𝐡 = Pr 𝑋=𝑂𝑂 = 1 9 Pr 𝑋=𝑂𝐴 = Pr 𝑋= 𝑂𝐡 = Pr 𝑋= 𝐴𝐡 = (twice the chance) Pr π‘Œ =Pr⁑(𝑋) Can you see where this is going?

8 Conditional Dependencies
Pr⁑(X=OA, Y=OA | Z=OO)= Pr Z=𝑂𝑂 X=𝑂𝐴, Y=𝑂𝐴)β‹…Pr⁑(X=𝑂𝐴, Y=𝑂𝐴) Pr Z=𝑂𝑂 = 1 4 β‹… = 2 18 Pr X=𝑂𝐴 Z=OO)= Pr Z=𝑂𝑂 X=𝑂𝐴)β‹…Pr⁑(X=𝑂𝐴) Pr Z=𝑂𝑂 = 𝑦 Pr Z=𝑂𝑂 X=𝑂𝐴, Y=y)β‹… Pr π‘Œ=𝑦 = = 4 18 β‡’Pr⁑(X=OO, Y=AA | Z=OO)β‰  Pr X=𝑂𝑂 Z=OO)Γ— Pr Y=𝐴𝐴 Z=OO) X Y Z

9 Probability function The probability function of 𝑋,π‘Œ,𝑍,𝑉,π‘Š in this graph is 𝑃 𝑋,π‘Œ,𝑍,𝑉,π‘Š =𝑃 𝑋 βˆ—π‘ƒ π‘Œ βˆ—π‘ƒ 𝑍 βˆ—π‘ƒ 𝑉 𝑋,π‘Œ βˆ—π‘ƒ(π‘Š|π‘Œ,𝑍) And we can see that the probability function of the subset 𝑋,π‘Œ,𝑉,π‘Š is the same in the corresponding sub graph 𝑃 𝑋,π‘Œ,𝑉,π‘Š = 𝑍 𝑃 𝑋,π‘Œ,𝑍,𝑉,π‘Š = 𝑍 𝑃 𝑋 βˆ—π‘ƒ π‘Œ βˆ—π‘ƒ 𝑍 βˆ—π‘ƒ 𝑉 𝑋,π‘Œ βˆ—π‘ƒ(π‘Š|π‘Œ,𝑍) = 𝑃 𝑋 βˆ—π‘ƒ π‘Œ βˆ—π‘ƒ 𝑉 𝑋,π‘Œ βˆ— 𝑍 𝑃 π‘Š π‘Œ,𝑍 βˆ—π‘ƒ 𝑍 =𝑃 𝑋 βˆ—π‘ƒ π‘Œ βˆ—π‘ƒ 𝑉 𝑋,π‘Œ βˆ—π‘ƒ(π‘Š|π‘Œ) X Y Z V W

10 Dependencies 𝐼 𝐷 𝑋,βˆ…,π‘Œ , 𝐼 𝐺 𝑋,βˆ…,𝑍 , 𝐼 𝐺 𝑍,βˆ…,π‘Œ Β¬ 𝐼 𝐷 (𝑋,𝑉,π‘Œ)
𝐼 𝐷 𝑋,βˆ…,π‘Œ , 𝐼 𝐺 𝑋,βˆ…,𝑍 , 𝐼 𝐺 𝑍,βˆ…,π‘Œ Β¬ 𝐼 𝐷 (𝑋,𝑉,π‘Œ) 𝐼 𝐷 (𝑉,π‘Œ,π‘Š) (NaΓ―ve Bayes) 𝐼 𝐷 (𝑋,βˆ…,π‘Š) Β¬ 𝐼 𝐷 (𝑋,𝑉,π‘Š) (the only path is blocked) X Y Z V W

11 The story behind the BN G would represent the Genotype. It is the DNA code of an attribute that is inherited. P would represent the Phenotype. It is the attribute itself, caused by the genotype Blood type genotype can be one of 9 options {OO, OA, OB, AO, AA, AB, BO, BA, BB} The phenotype can be one of 4 options {O, A, B, AB} 𝐺∈ 𝑂𝐴, 𝐴𝑂, 𝐴𝐴 ⇒𝑃=𝐴 𝐺∈ 𝑂𝐡, 𝐡𝑂, 𝐡𝐡 ⇒𝑃=𝐡 𝐺∈ 𝐴𝐡, 𝐡𝐴 ⇒𝑃=𝐴𝐡 𝐺=𝑂𝑂⇒𝑃=𝑂

12 Royal Blood The picture depicts the royal family’s pedigree
Each of the parents passes one of his {A, B, O} to his/her child at random (50-50). So each individual, in the end, has 2 of {A, B, O}

13 Royal Blood 𝐺 πΈπ‘™π‘–π‘§π‘Žπ‘π‘’π‘‘β„Ž 𝐼𝐼 𝐺 π‘ƒβ„Žπ‘–π‘™π‘–π‘ 𝑃 π‘ƒβ„Žπ‘–π‘™π‘–π‘ 𝑃 πΈπ‘™π‘–π‘§π‘Žπ‘π‘’π‘‘β„Ž 𝐼𝐼 The blood type Bayesian network where G denotes the genotype and P the phenotype. Each parent-child nodes pair have a directed edge between them. It represents the child genotype dependency of his parents The phenotype of an individual is only dependent on his/her genotype. 𝐺 π·π‘–π‘Žπ‘›π‘›π‘Ž 𝐺 πΆβ„Žπ‘Žπ‘Ÿπ‘™π‘’π‘  𝐺 𝐴𝑛𝑛𝑒 𝐺 π‘€π‘Žπ‘Ÿπ‘˜ 𝑃 π·π‘–π‘Žπ‘›π‘›π‘Ž 𝑃 πΆβ„Žπ‘Žπ‘Ÿπ‘™π‘’π‘  𝐺 π‘Šπ‘–π‘™π‘™π‘–π‘Žπ‘š

14 Royal Blood 𝐺 πΈπ‘™π‘–π‘§π‘Žπ‘π‘’π‘‘β„Ž β‰œπ΄ 𝐺 πΊπ‘’π‘œπ‘Ÿπ‘”π‘’ 𝑉𝐼 β‰œπ΅ From the simple example, and the fact that Elizabeth II has an O type blood, we can learn that the chance that both Elizabeth and George are AO is 1 18 If Elizabeth II’s genotype wasn’t known, but one of her descendant’s genotype was, A and B would still be dependent given that condition. Less so, but still. 𝐺 πΈπ‘™π‘–π‘§π‘Žπ‘π‘’π‘‘β„Ž 𝐼𝐼 β‰œπΆ 𝐺 πΆβ„Žπ‘Žπ‘Ÿπ‘™π‘’π‘  β‰œπ·

15 Royal Blood 𝐺 π½π‘Žπ‘›π‘’ π‘†π‘’π‘¦π‘šπ‘œπ‘Žπ‘Ÿ 𝐺 π»π‘’π‘›π‘Ÿπ‘¦ 𝑉𝐼𝐼𝐼 𝐺 𝐴𝑛𝑛𝑒 π΅π‘œπ‘™π‘’π‘¦π‘› 𝑃 𝐴,𝐡,𝐢,𝐷,𝐸 =
𝑃 𝐴 βˆ—π‘ƒ 𝐡 βˆ—π‘ƒ 𝐢 βˆ—π‘ƒ 𝐷 𝐴,𝐡 βˆ—π‘ƒ(𝐸|𝐡.𝐢) If Elizabeth I genotype is known, Edwards VI’s and Jane’s genotype are not independent anymore. It blocks the only active path between them. For Example, If Elizabeth I genotype was AB, So if Jane’s genotype was BB then Henry’s most likely would be AA giving an A to Edward. 𝐺 πΈπ‘™π‘–π‘§π‘Žπ‘π‘’π‘‘β„Ž 𝐼 𝐺 πΈπ‘‘π‘€π‘Žπ‘Ÿπ‘‘ 𝑉𝐼

16 Royal Blood 𝐺 π΄π‘’π‘”π‘’π‘ π‘‘π‘Ž β‰œπ΄ 𝐺 πΈπ‘Ÿπ‘›π‘’π‘ π‘‘ 𝐼 β‰œπ΅ 𝐺 πΈπ‘‘π‘€π‘Žπ‘Ÿπ‘‘ β‰œπΆ 𝐺 π΄π‘™π‘π‘’π‘Ÿπ‘‘ β‰œπ·
𝑃 𝐴,𝐡,𝐢,𝐷,𝐸,𝐹 = 𝑃 𝐴 𝑃 𝐡 𝐴 𝑃 𝐢 𝐴 𝑃 𝐷 𝐡 𝑃 𝐸 𝐢 𝑃 𝐹 𝐷,𝐸 Β¬ 𝐼 𝐷 (𝐹,𝐺, 𝐴) – exists an active path 𝐼 𝐷 (𝐹, 𝐷,𝐸 ,𝐴) – removing parents from paths 𝐼 𝐷 (𝐹, 𝐡,𝐢 ,𝐴) – simply removing all active paths so it’s also d-seperated 𝐺 π΄π‘™π‘π‘’π‘Ÿπ‘‘ β‰œπ· 𝐺 π‘‰π‘–π‘π‘‘π‘œπ‘Ÿπ‘–π‘Ž β‰œπΈ 𝐺 πΈπ‘‘π‘€π‘Žπ‘Ÿπ‘‘ 𝑉𝐼𝐼 β‰œπΉ


Download ppt "Tutorial 2 Simple examples of Bayesian networks, Queries, And the stories behind them Tal Shor."

Similar presentations


Ads by Google