[AI] 3. Bayes Network

0.0(0)
Studied by 0 people
call kaiCall Kai
Locked
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/56

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 1:11 AM on 9/18/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

57 Terms

1
New cards

Why do AI systems need probability when dealing with real world?

Because the real world contains uncertainty caused by:

  • Partial observability: We cannot observe everything

  • Noisy sensors: Observations may be inaccurate

  • Immense complexity: Completely modelling or predicting the world may be too difficult

  • Lack of knowledge of world dynamics: Unexpected events may occur

Probabilistic assertions summarise the effects of incomplete knowledge and limited effort.


2
New cards

How does an agent make decisions under uncertainty?

We combine:

  • Probability: How likely an outcome is

  • Utility: How desirable that outcome is

Then choose the action that maximise expected utility: a*

So the agent considers both how likely each outcome is and how good or bad it would be



<p>We combine:</p><ul><li><p>Probability: How likely an outcome is</p></li><li><p>Utility: How desirable that outcome is</p></li></ul><p>Then choose the action that maximise expected utility: a*</p><p>So the agent considers both how likely each outcome is and how good or bad it would be</p><p></p><p></p>
3
New cards

What are the basic laws of discrete probability ?

knowt flashcard image
4
New cards

What is a sample space (Omega) and what conditions must a discrete probability model satisfy?

The simple space, Omega, is the set of all possible outcomes.

Example: In the picture

<p>The simple space, Omega, is the set of all possible outcomes.</p><p>Example: In the picture</p>
5
New cards

What is an event and how do we calculate the probability of an event?

  • Event is any subset of the sample space, omega (subset of possible outcomes)

  • Probability of event is the sum of the probability of all outcomes belonging to the event

→ A = {1,5,3} , rolling a die in odd

→ P(A) = 1/6 + 1/6 + 1/6 =0.5

*6 because a die has 6 possibilities

<ul><li><p>Event is any subset of the sample space, omega (subset of possible outcomes)</p></li><li><p>Probability of event is the sum of the probability of all outcomes belonging to the event</p></li></ul><p>→ A = {1,5,3} , rolling a die in odd</p><p>→ P(A) = 1/6 + 1/6 + 1/6 =0.5</p><p>*6 because a die has 6 possibilities</p>
6
New cards

What is a random variable and what is its range?

  • Random variable: variable represent the uncertain aspect of the world. Represented by capital letter, T,D,X,etc

  • Formally, it is a deterministic function of an outcome, w

  • Range or domain: Set of possible values of random variable


Examples:

  • Odd = {True, False}

  • T = {Hot, Cold}

  • D = [0, ) for travel time

  • Location of ghost, L = {(0,0),(0,1),…}


7
New cards

What is the difference between an outcome(w), a random variable (X) and a value(x)?

  • w = an actual underlying outcome

  • X = A function or property, we are interested in

  • x = A possible value of X


Example : If the die outcome is w=5 and X=Odd, then Odd(5)=true

→ So 5 is the outcome, Odd is the random variable , and true is its value


8
New cards

What is the probability distribution of random variable, X and what is the difference between P(X=x) and P(x)?

  • A probability distribution of X: gives the probability for every possible value of X

  • P(X=x) : probability of one particular value

  • P(X) : Entire probability distribution usually represented as vector or table


<ul><li><p>A probability distribution of X: gives the probability for every possible value of X</p></li><li><p>P(X=x) : probability of one particular value</p></li><li><p>P(X) : Entire probability distribution usually represented as vector or table</p></li></ul><p></p>
9
New cards

What is a joint probability distribution?

  • Joint distribution : probability distribution involving two or more random variables simultaneously

  • Combine their values

  • All entries sum to 1


Example: P(T,W)

  • Gives probabilities for every combination of Temperature and Weather, such as:

  • P(T=hot, W=sunny) = 0.45



10
New cards

Can we obtain joint distribution from marginal distributions?

No, because marginals don’t contain enough info abt how they interact.

Except if the marginals are independent, then we can obtain their joint

11
New cards

Can we obtain marginals distribution from joint distribution?

Yes, because we know how they interact. Thus, to obtain the marginals must eliminate other variables

12
New cards

What is marginal distribution and Marginalization?

  • marginal distribution: distribution of a subset of variables from a joint, e.g. P(T) and P(W) are marginals of P(T,W)

  • Marginalization: summing out unwanted variables, equations 👆🏻


<ul><li><p>marginal distribution: distribution of a subset of variables from a joint, e.g. P(T) and P(W) are marginals of P(T,W)</p></li><li><p>Marginalization: summing out unwanted variables, equations 👆🏻 </p></li></ul><p></p>
13
New cards


14
New cards

How many entries are in a full joint distribution (size of joint) of n variables and range size,d?

  • n: # of variables

  • d: set of highest possible outcomes between random variables

  • d^n

  • Joijnt distribution grow exponentially with the # of variables


Example: n = 2 (T,W), d = 4 (sun, rain, fog, meteor)

→ 4² = 8


<ul><li><p>n: # of variables</p></li><li><p>d: set of highest possible outcomes between random variables </p></li><li><p>d^n</p></li><li><p>Joijnt distribution grow exponentially with the # of variables </p></li></ul><p></p><p>Example: n = 2 (T,W), d = 4 (sun, rain, fog, meteor)</p><p>→ 4² = 8</p><p></p>
15
New cards

When are 2 random variables X and Y independent?

When:

P(x,y) = P(x)P(y)

Equivalently:

P(x|y) = P(x)

Knowing one gives no information about the other

<p>When:</p><p>P(x,y) = P(x)P(y)</p><p>Equivalently:</p><p>P(x|y) = P(x)</p><p>Knowing one gives no information about the other</p>
16
New cards
<p>How do you calculate probability of an event in joint distribution ?</p><p>Solve the example:</p><ul><li><p>probability that its hot and sunny</p></li><li><p>Probability that its hot</p></li><li><p>Probability that its hot OR not foggy</p></li></ul><p></p>

How do you calculate probability of an event in joint distribution ?

Solve the example:

  • probability that its hot and sunny

  • Probability that its hot

  • Probability that its hot OR not foggy


Add the probabilities of all entries satisfying the event

Examples:

  • probability that its hot and sunny: 0.45

  • Probability that its hot: 0.45+0.02+0.03+0.0=0.5

  • Probability that its hot OR not foggy: 0.45+0.15+0.02+0.08+0.03+0.0+0.0=0.73

*only (cold,foggy) is excluded because oppose to either hot or foggy


17
New cards
<p>Which one has higher probability?</p><ol><li><p>Sunny vs rainy</p></li><li><p>Foggy vs hot</p></li><li><p>Cold and foggy vs rainy</p></li><li><p>If its rainy then cold (cold | rainy) vs sunny</p></li></ol><p></p>

Which one has higher probability?

  1. Sunny vs rainy

  2. Foggy vs hot

  3. Cold and foggy vs rainy

  4. If its rainy then cold (cold | rainy) vs sunny


  1. Sunny vs rainy: 0.6 vs 0.1 : SUNNY

  2. Foggy vs hot : 0.3 vs 0.5 : HOT

  3. Cold and foggy vs rainy : 0.27 vs 0.1 : COLD&FOGGY

  4. If its rainy then cold (cold | rainy) vs sunny : (cold&rain / rain = 0.08/0.1=0.8) vs 0.6 : RAINY THEN COLD

*#4 is conditional probability


18
New cards

What is conditional probability?

  • probability of A given that B has occurred:


P(A|B) = P(A,B) / P(B)


<ul><li><p>probability of A given that B has occurred:</p></li></ul><p></p><p>P(A|B) = P(A,B) / P(B)</p><p></p>
19
New cards
<p>Solve this conditional probability : P(W=sun | T=cold)</p>

Solve this conditional probability : P(W=sun | T=cold)

P(sun,cold) =0.15

P(cold)= 0.5

=> 0.15/0.5=0.3

<p>P(sun,cold) =0.15</p><p>P(cold)= 0.5</p><p>=&gt; 0.15/0.5=0.3 </p>
20
New cards

What is normalization?

  • normalization: rescaling values , so that distribution’s sum become 1

  • Multiply every entry by alpha


<ul><li><p>normalization: rescaling values , so that distribution’s sum become 1</p></li><li><p>Multiply every entry by alpha</p></li></ul><p></p>
21
New cards
<p>Normalize the example in red box</p>

Normalize the example in red box

  • sum of all entries= 0.15+0.08+0.27+0=0.5

  • a = 1/0.5=2

  • 0.15×2=0.3

  • 0.08×2=0.16

  • 0.27×2=0.54

  • 0.0×2=0


<ul><li><p>sum of all entries= 0.15+0.08+0.27+0=0.5 </p></li><li><p>a = 1/0.5=2 </p></li><li><p>0.15×2=0.3 </p></li><li><p>0.08×2=0.16 </p></li><li><p>0.27×2=0.54 </p></li><li><p>0.0×2=0 </p></li></ul><p></p>
22
New cards

What is conditional distribution?

  • conditional distribution: a distribution over one set of variables given values of another set of

  • E.g. P(W|T)

  • based on the example, table on the left is the joint distribution

  • From joint, the given variable (T) must disjoint its values ( hot and cold)

  • Then normalize them to sum 1

  • The right tables are 2 disjoint distribution


<ul><li><p>conditional distribution: a distribution over one set of variables given values of another set of</p></li><li><p>E.g. P(W|T)</p></li><li><p>based on the example, table on the left is the joint distribution </p></li><li><p>From joint, the given variable (T) must disjoint its values ( hot and cold)</p></li><li><p>Then normalize them to sum 1</p></li><li><p>The right tables are 2 disjoint distribution </p></li></ul><p></p>
23
New cards

What is the product rule?

Product rule: reconstruct joint distribution from conditional and marginals probabilities


<p>Product rule: reconstruct joint distribution from conditional and marginals probabilities </p><p></p>
24
New cards
<p>From the conditional distribution and marginal distribution given, construct a joint distribution </p>

From the conditional distribution and marginal distribution given, construct a joint distribution

knowt flashcard image
25
New cards
<p>Based on the marginals and conditional distribution, find the higher probability:-</p><ol><li><p>Sunny and hot vs sunny and cold?</p></li><li><p>Sunny vs foggy?</p></li></ol><p></p>

Based on the marginals and conditional distribution, find the higher probability:-

  1. Sunny and hot vs sunny and cold?

  2. Sunny vs foggy?


knowt flashcard image
26
New cards
<p>Based on the marginals and conditional distribution, find the higher probability:-</p><ol><li><p>hot|sunny vs cold|sunny?</p></li><li><p>hot|not foggy vs cold|not foggy?</p></li></ol><p></p>

Based on the marginals and conditional distribution, find the higher probability:-

  1. hot|sunny vs cold|sunny?

  2. hot|not foggy vs cold|not foggy?


knowt flashcard image
27
New cards

What is the chain rule?

Chain rule: express joint distribution as product of conditional distributions

<p>Chain rule: express joint distribution as product of conditional distributions </p>
28
New cards
<p>What is probability inference?</p>

What is probability inference?

  • probability inference: computing a desired probability from a probability model

  • —> usually P(query|evidence)

  • e.g. P(class on time|no holidays) = 0.9

  • These represent agent’s beliefs given the evidence

  • e.g. P(class on time|no holidays, 10 a.m, raining) = 0.85

  • More new evidence, changing agent’s beliefs


29
New cards

What is Query, Evidence, and Hidden variables?

  • Query variable, Q: variable(s) we want to know

  • Evidence variable , E: variable(s) that we know/observed

  • Hidden variable, H: unobserved variable that is neither query nor evidence


30
New cards

What are 3 steps of inference by enumeration?

  1. Select entries consistent with evidence

  2. Sum out the hidden variables

  3. Normalize


<ol><li><p>Select entries consistent with evidence </p></li><li><p>Sum out the hidden variables</p></li><li><p>Normalize</p></li></ol><p></p>
31
New cards
<p>Based on the table of P(Season, | sun), what are Q, E, H?</p>

Based on the table of P(Season, | sun), what are Q, E, H?

  • Q = Season

  • E = Weather sun

  • Hidden = Temp

  • To calculate, sum out Temp and normalize


32
New cards
<p>Calculate P(Season|sun)</p>

Calculate P(Season|sun)

  1. Enumerate options with sun: P(summer, hot, sun) , P(summer, cold, sun) , P(winter, hot, sun) , P(winter, cold sun)

  2. Sum out hidden variables:

  • P(summer, sun) = P(summer, hot, sun) + P(summer, cold, sun) =0.35+0.10=0.45

  • P(winter, sun) = P(winter, hot, sun) + P(winter, cold sun) =0.1+0.15=0.25

  1. Normalize:

    • P(Season|sun) = {summer: 0.45/(0.45+0.25) , winter: 0.25/(0.45+0.25)}

    • P(Season|sun) = {summer:0.64, winter:0.36}


<ol><li><p>Enumerate options with sun: P(summer, hot, sun) , P(summer, cold, sun) , P(winter, hot, sun) , P(winter, cold sun)</p></li><li><p>Sum out hidden variables:</p></li></ol><ul><li><p>P(summer, sun) = P(summer, hot, sun) + P(summer, cold, sun) =0.35+0.10=0.45 </p></li></ul><ul><li><p>P(winter, sun) = P(winter, hot, sun) + P(winter, cold sun) =0.1+0.15=0.25 </p></li></ul><ol start="3"><li><p>Normalize:</p><ul><li><p>P(Season|sun) = {summer: 0.45/(0.45+0.25) , winter: 0.25/(0.45+0.25)}</p></li><li><p>P(Season|sun) = {summer:0.64, winter:0.36}</p></li></ul></li></ol><p></p>
33
New cards

What is the main problem of inference by enumeration using a full joint distribution?

  • it is the exponential number of variables

  • d: range(size of domain) for each variable

  • n: # of variables

  • d^n is the entries of joint distribution

  • Time complexity: O(d^n) :exponential in # of var

  • Space complexity: O(d^n) : to store joint dist


34
New cards
<p>What is Bayes’ Rule?</p>

What is Bayes’ Rule?

  • Bayes’ Rule let us obtain one conditional probability from its reverse


<ul><li><p>Bayes’ Rule let us obtain one conditional probability from  its reverse </p></li></ul><p></p>
35
New cards
<p>What are likelihood, evidence , posterior, prior from the equation of Bayes Rule ?</p>

What are likelihood, evidence , posterior, prior from the equation of Bayes Rule ?

  • likelihood: P(b|a)

  • evidence: P(b)

  • prior/ unconditional probability : P(a)

  • posterior / conditional probability w evidence b: P(a|b)

  • Posterior = (Likelihood x Prior) / Evidence


36
New cards

List out the likelihood, evidence ,prior ,and posterior of P(Test|Disease)

  • Often one cond prob is trickier to get than another

  • P(Test|Disease) is easier to get than P(Disease|Test) from clinical records

  • Prior: P(Test = positive )

  • Likelihood: P(Disease|Test)

  • Evidence: P(Disease = true)

  • Posterior: P(Test|Disease)

e.g. P(Disease=true|Test=positive)

37
New cards
<p>What is the intuition behind Bayes Rule?</p>

What is the intuition behind Bayes Rule?

  • Start with prior belief ,P(a) and update with observed evidence, b to obtain posterior, P(a|b)


38
New cards
<p>Example of medical diagnostic:</p><ul><li><p>Disease = Covid or not Covid , Test = Positive or Negative</p></li><li><p>Solve P(Covid|Positive)</p></li><li><p>Why do we still need to get the test even though it is negative ?</p></li></ul><p></p>

Example of medical diagnostic:

  • Disease = Covid or not Covid , Test = Positive or Negative

  • Solve P(Covid|Positive)

  • Why do we still need to get the test even though it is negative ?


  • Because the posterior also depends on prior probability of the disease and test/evidence probability, not only P(positive |covid)

  • P(covid|positive) = 0.008 is VERY SMALL

  • due to high false positive P(negative |covid)=0.2 and very small P(covid)=0.0001



<ul><li><p>Because the posterior also depends on prior probability of the disease and test/evidence probability, not only P(positive |covid)</p></li><li><p>P(covid|positive) = 0.008 is VERY SMALL</p></li><li><p>due to high false positive P(negative |covid)=0.2 and very small P(covid)=0.0001</p><p></p></li></ul><p></p>
39
New cards
<p>Example of Hodu and Maru:</p><ul><li><p>assume there is 2 dogs {Hodu and Maru} and they could be {Maltese or Poodle}</p></li><li><p>One of them is poodle </p></li><li><p>What is the probability of having 2 Poodles?</p></li></ul><p></p>

Example of Hodu and Maru:

  • assume there is 2 dogs {Hodu and Maru} and they could be {Maltese or Poodle}

  • One of them is poodle

  • What is the probability of having 2 Poodles?


  • event a, P(a): at least one of them is poodle = { (P,P),(P,M),(M,P)}

  • event b, P(b): both are poodle = {(P,P)}

  • Total of possible outcomes: 4 includes (M,M)

  • P(a) = ¾ , P(b) = ¼ , P(a|b) = 1/1

  • Probability get 2 poodles given at least one is poodle → P(b|a) = [ P(a|b)P(b) ] / P(a) = (1 × ¼ )/( ¾ )= 1/3


40
New cards

What is conditional independence?

  • given P(x|y,z) = P(x|z) : x is conditionally independent of y given z


<ul><li><p>given P(x|y,z) = P(x|z) : x is conditionally independent of y given z</p></li></ul><p></p>
41
New cards

What is the difference of independence and conditional independence?

  • Independence: P(X|Y) = P(X) : Y gives no info of X

  • Conditional Independence: P(X|Y,Z) = P(X|Z) : once Z is known, Y gives no additional info of X

  • Independence is rare while conditional independence is more related


42
New cards

Why is Independence powerful but conditional independence is nore useful in practice?

  • Independence can greatly reduce representation size but complete independence is RARE!

  • Conditional independence is more common in real world problems


43
New cards

What is independence of random variables?

  • Independence: no relation between 2 or more random variables



<ul><li><p>Independence: no relation between 2 or more random variables </p><p></p></li></ul><p></p>
44
New cards

What is Ghostbusters game about?

  • Given a grid, ghost is somewhere in the grid

  • Find the ghost by choosing the square and get a clue how far it is from the ghost

  • Noisy sensor tell how close a is to the ghost:

    on the ghost: Red

    1-2 away: Orange

    3-4 away: Yellow

    5+ away: Green

  • Thus, you will get updated of the probability of ghost on each square


<ul><li><p>Given a grid, ghost is somewhere in the grid </p></li><li><p>Find the ghost by choosing the square and get a clue how far it is from the ghost</p></li><li><p>Noisy sensor tell how close a is to the ghost:</p><p>on the ghost: Red</p><p>1-2 away: Orange </p><p>3-4 away: Yellow </p><p>5+ away: Green</p></li><li><p>Thus, you will get updated of the probability of ghost on each square </p></li></ul><p></p>
45
New cards

What are the random variables and range of ghostbusters model?

  • G has uniform prior, P(G) = 0.11

  • while sensor readings follow posterior,P((C x,y) | G) which the color is depend on distance from ghost


<ul><li><p>G has uniform prior, P(G) = 0.11</p></li><li><p>while sensor readings follow posterior,P((C x,y) | G) which the color is depend on distance from ghost</p></li></ul><p></p>
46
New cards

What is the sensor model of Ghostbusters model?

How to get location of ghost given colour of measured at square x,y , P(G|C)?

knowt flashcard image
47
New cards
<p>Are sensor readings such as C(1,1) = yellow and C(1,2) = orange independent?</p>

Are sensor readings such as C(1,1) = yellow and C(1,2) = orange independent?

  • Not necessarily

  • Both depend on the same hidden variable, which is ghost location ,G

  • They are conditionally independent given G

  • P(C1,1 | G, C1,2) = P(C1,1| G)


<ul><li><p>Not necessarily</p></li><li><p>Both depend on the same hidden variable, which is ghost location  ,G</p></li><li><p>They are conditionally independent given G </p></li><li><p>P(C1,1 | G, C1,2) = P(C1,1| G)</p></li></ul><p></p>
48
New cards

What is the size of joint distribution of ghostbuster model?

knowt flashcard image
49
New cards

Why does knowing G make one sensoring irrelevant to predicting another?

  • Once ghost location G is known, each sensor’s probability depends only on its distance from G

  • Thus, another sensor reading provides no additional information

  • For example, P(C1,1 | G, C1,2) → Once G is known, Information of C1,2 is irrelevant to C1,1

  • Causing C1,1 to be the conditional independence to C1,2 given G


<ul><li><p>Once ghost location G is known, each sensor’s probability depends only on its distance from G </p></li><li><p>Thus, another sensor reading provides no additional information</p></li><li><p>For example, P(C1,1 | G, C1,2) → Once G is known, Information of C1,2 is irrelevant to C1,1</p></li><li><p>Causing C1,1 to be the conditional independence to C1,2 given G</p></li></ul><p></p>
50
New cards

How does join distribution decomposed by chain rule/ without simplification of conditional independence?

knowt flashcard image
51
New cards

How does conditional independence simplify the Ghostbusters joint distribution?

knowt flashcard image
52
New cards

What is Naïve Bayes model?

A model with:

  • One query( class or category variable)

  • Other variables acting as evidence

  • Evidence variables conditionally independent given the query variable


<p>A model with:</p><ul><li><p>One query( class or category variable)</p></li><li><p>Other variables acting as evidence</p></li><li><p>Evidence variables conditionally independent given the query variable </p></li></ul><p></p>
53
New cards

How is Bayesian Network represented?

  • Nodes = Random variables

  • Domains = Possible values

  • Directed arcs = Direct influences or interactions X → Y

  • e.g. Cavity → Toothache , Cavity → Catch

  • No arc can encode independence

  • e.g . No influence btw Weather and other variables, No direct influence btw Toothache and Catch

  • P(X|Y) quantifies X’s influence on Y


<ul><li><p>Nodes = Random variables</p></li><li><p>Domains = Possible values</p></li><li><p>Directed arcs = Direct influences or interactions X → Y</p></li><li><p>e.g. Cavity → Toothache , Cavity → Catch</p></li><li><p>No arc can encode independence</p></li><li><p>e.g . No influence btw Weather and other variables, No direct influence btw Toothache and Catch</p></li><li><p>P(X|Y) quantifies X’s influence on Y</p></li></ul><p></p>
54
New cards

What type of graph is Bayesian Network?

Directed Acyclic Graph (DAG)

<p>Directed Acyclic Graph (DAG)</p>
55
New cards

What is CPT?

  • Conditional Probability Table (CPT)

  • Gives conditional probability distribution of each node given its parent variables

  • Each row comes to one


56
New cards

What are the two components of a Bayesian Network?


<p></p>
57
New cards