Bayesian Networks. Graphical Models Bayesian networks Conditional random fields etc.

30
Bayesian Networks
  • date post

    20-Dec-2015
  • Category

    Documents

  • view

    217
  • download

    0

Transcript of Bayesian Networks. Graphical Models Bayesian networks Conditional random fields etc.

Page 1: Bayesian Networks. Graphical Models Bayesian networks Conditional random fields etc.

Bayesian Networks

Page 2: Bayesian Networks. Graphical Models Bayesian networks Conditional random fields etc.

Graphical Models

• Bayesian networks

• Conditional random fields

• etc.

Page 3: Bayesian Networks. Graphical Models Bayesian networks Conditional random fields etc.

Topic=Course

“Grading” “Instructor” “Syllabus” “Vapnik”“Exams”

)|(

)|()|()|()|()(

)(

CourseVapnikP

courseExamsPCourseSyllabusPCourseInstructorPCourseGradingPCourseP

VapnikExamsSyllabusInstructorGradingP

)|()(),...,|( 111 jii

ijnj cCxXPcCPxXxXcCP Naive Bayes:

Page 4: Bayesian Networks. Graphical Models Bayesian networks Conditional random fields etc.

Bayesian networks

• Idea is to represent dependencies (or causal relations) for all the variables so that space and computation-time requirements are minimized.

Topic=RussianMathematicians

Topic=Course

Vapnik Syllabus

Page 5: Bayesian Networks. Graphical Models Bayesian networks Conditional random fields etc.

true 0.01

false 0.99

Course

true false

true 0.9 0.1

false 0.2 0.8

Syllabus

Course

true 0.2

false 0.8

Russian Math

true false

True True 0.95 0.05

True False 0.8 0.2

False True 0.6 0.4

false false 0.05 0.95

Vapnik

CourseR.MConditional probabilitytables for each node

Topic=RussianMathematicians

Topic=Course

Vapnik Syllabus

Page 6: Bayesian Networks. Graphical Models Bayesian networks Conditional random fields etc.

Semantics of Bayesian networks

• If network is correct, can calculate full joint probability distribution from network.

where parents(Xi) denotes specific values of parents of Xi.

Compare with Naïve Bayes.

))(|(

)(

...

))(...)(|)((

ruleChain ))(...)(|)((

))(...)()((

1

3322

2211

2211

i

n

iii

nn

nn

nn

nn

XparentsxXP

xXP

xXxXxXP

xXxXxXP

xXxXxXP

Page 7: Bayesian Networks. Graphical Models Bayesian networks Conditional random fields etc.

Example

• Calculate

)]()()()[( fSyllabusfVapnikfCoursethRussianMatP

Page 8: Bayesian Networks. Graphical Models Bayesian networks Conditional random fields etc.

ExamplesWhat is unconditional (marginal) probability that Vapnik is true?

Page 9: Bayesian Networks. Graphical Models Bayesian networks Conditional random fields etc.

What is the unconditional (marginal) probability that Russian Mathematicians is true?

Page 10: Bayesian Networks. Graphical Models Bayesian networks Conditional random fields etc.

Causal inferenceEvidence is cause, inference is probability of effect

Example: Instantiate evidence Course= true. What is P(Syllabus | Course)?

Different types of inference in Bayesian Networks

Page 11: Bayesian Networks. Graphical Models Bayesian networks Conditional random fields etc.

Diagnostic inference

Evidence is effect, inference is probability of cause

Example: Instantiate evidence Syllabus = true. What is P(Course | Syllabus)?

Page 12: Bayesian Networks. Graphical Models Bayesian networks Conditional random fields etc.

Example: What is P(Course|Vapnik)?

Page 13: Bayesian Networks. Graphical Models Bayesian networks Conditional random fields etc.

Inter-causal inference

Explain away different possible causes of effect

Example: What is P(Course|Vapnik,RussianMath)?

Why is P(Course|Vapnik,RussianMath) < P(Course|Vapnik)?

Page 14: Bayesian Networks. Graphical Models Bayesian networks Conditional random fields etc.

Complexity of Bayesian Networks

For n random Boolean variables:

• Full joint probability distribution: 2n entries

• Bayesian network with at most k parents per node:

– Each conditional probability table: at most 2k entries

– Entire network: n 2k entries

Page 15: Bayesian Networks. Graphical Models Bayesian networks Conditional random fields etc.

What are the advantages of Bayesian networks?

• Intuitive, concise representation of joint probability distribution (i.e., conditional dependencies) of a set of random variables.

• Represents “beliefs and knowledge” about a particular class of situations.

• Efficient (?) (approximate) inference algorithms

• Efficient, effective learning algorithms

Page 16: Bayesian Networks. Graphical Models Bayesian networks Conditional random fields etc.

Issues in Bayesian Networks

• Building / learning network topology

• Assigning / learning conditional probability tables

• Approximate inference via sampling

Page 17: Bayesian Networks. Graphical Models Bayesian networks Conditional random fields etc.

• In general, however, exact inference in Bayesian networks is too expensive.

Page 18: Bayesian Networks. Graphical Models Bayesian networks Conditional random fields etc.

Approximate inference in Bayesian networks

Instead of enumerating all possibilities, sample to estimate probabilities.

X1 X2 X3 Xn

...

Page 19: Bayesian Networks. Graphical Models Bayesian networks Conditional random fields etc.

General question: What is P(X|e)?

Notation convention: upper-case letters refer to random variables; lower-case letters refer to specific values of those variables

Page 20: Bayesian Networks. Graphical Models Bayesian networks Conditional random fields etc.

Direct Sampling

• Suppose we have no evidence, but we want to determine P(C,S,R,W) for all C,S,R,W.

• Direct sampling:

– Sample each variable in topological order, conditioned on values of parents.

– I.e., always sample from P(Xi | parents(Xi))

Page 21: Bayesian Networks. Graphical Models Bayesian networks Conditional random fields etc.

1. Sample from P(Cloudy). Suppose returns true.

2. Sample from P(Sprinkler | Cloudy = true). Suppose returns false.

3. Sample from P(Rain | Cloudy = true). Suppose returns true.

4. Sample from P(WetGrass | Sprinkler = false, Rain = true). Suppose returns true.

Here is the sampled event: [true, false, true, true]

Example

Page 22: Bayesian Networks. Graphical Models Bayesian networks Conditional random fields etc.

• Suppose there are N total samples, and let NS (x1, ..., xn) be the observed frequency of the specific event x1, ..., xn.

• Suppose N samples, n nodes. Complexity O(Nn).

• Problem 1: Need lots of samples to get good probability estimates.

• Problem 2: Many samples are not realistic; low likelihood.

),...,(),...,(

lim 11

nnS

NxxP

N

xxN

),...,(),...,(

11

nnS xxP

N

xxN

Page 23: Bayesian Networks. Graphical Models Bayesian networks Conditional random fields etc.

Markov Chain Monte Carlo Sampling

• One of most common methods used in real applications.

• Uses idea of “Markov blanket” of a variable Xi:

– parents, children, children’s parents

Page 24: Bayesian Networks. Graphical Models Bayesian networks Conditional random fields etc.

Illustration of “Markov Blanket”

X

Page 25: Bayesian Networks. Graphical Models Bayesian networks Conditional random fields etc.

• Recall that: By construction of Bayesian network, a node is conditionaly independent of its non-descendants, given its parents.

• Proposition: A node Xi is conditionally independent of all other nodes in the network, given its Markov blanket.

Page 26: Bayesian Networks. Graphical Models Bayesian networks Conditional random fields etc.

Markov Chain Monte Carlo Sampling Algorithm

• Start with random sample from variables: (x1, ..., xn). This is the current “state” of the algorithm.

• Next state: Randomly sample value for one non-evidence variable Xi , conditioned on current values in “Markov Blanket” of Xi.

Page 27: Bayesian Networks. Graphical Models Bayesian networks Conditional random fields etc.

Example

• Query: What is P(Rain | Sprinkler = true, WetGrass = true)?

• MCMC: – Random sample, with evidence variables fixed:

[true, true, false, true]

– Repeat:

1. Sample Cloudy, given current values of its Markov blanket: Sprinkler = true, Rain = false. Suppose result is false. New state:

[false, true, false, true]

2. Sample Rain, given current values of its Markov blanket:

Cloudy = false, Sprinkler = true, WetGrass = true. Suppose

result is true. New state: [false, true, true, true].

Page 28: Bayesian Networks. Graphical Models Bayesian networks Conditional random fields etc.

• Each sample contributes to estimate for query

P(Rain | Sprinkler = true, WetGrass = true)

• Suppose we perform 100 such samples, 20 with Rain = true and 80 with Rain = false.

• Then answer to the query is

Normalize (20,80) = .20,.80

• Claim: “The sampling process settles into a dynamic equilibrium in which the long-run fraction of time spent in each state is exactly proportional to its posterior probability, given the evidence.”

• That is: for all variables Xi, the probability of the value xi of Xi appearing in a sample is equal to P(xi | e).

.

Page 29: Bayesian Networks. Graphical Models Bayesian networks Conditional random fields etc.
Page 30: Bayesian Networks. Graphical Models Bayesian networks Conditional random fields etc.

Claim (again)

• Claim: MCMC settles into behavior in which each state is sampled exactly according to its posterior probability, given the evidence.