20
1 Knowledge Engineering for Bayesian Networks

1 Knowledge Engineering for Bayesian Networks. 2 Probability theory for representing uncertainty l Assigns a numerical degree of belief between 0 and

Embed Size (px)

Citation preview

Page 1: 1 Knowledge Engineering for Bayesian Networks. 2 Probability theory for representing uncertainty l Assigns a numerical degree of belief between 0 and

1

Knowledge Engineering for Bayesian Networks

Page 2: 1 Knowledge Engineering for Bayesian Networks. 2 Probability theory for representing uncertainty l Assigns a numerical degree of belief between 0 and

2

Probability theory for representing uncertainty

Assigns a numerical degree of belief between 0 and 1 to facts» e.g. “it will rain today” is T/F. » P(“it will rain today”) = 0.2 prior probability

(unconditional)

Conditional probability (Posterior)» P(“it wil rain today” | “rain is forecast”) = 0.8

Bayes’ Rule: P(H|E) = P(E|H) x P(H) P(E)

Page 3: 1 Knowledge Engineering for Bayesian Networks. 2 Probability theory for representing uncertainty l Assigns a numerical degree of belief between 0 and

3

Bayesian networks

Directed acyclic graphs Nodes: random variables,

» R: “it is raining”, discrete values T/F» T: temperature, continuous or discrete variable» C: color, discrete values {red, blue, green}

Arcs indicate dependencies (can have causal interpretation)

Page 4: 1 Knowledge Engineering for Bayesian Networks. 2 Probability theory for representing uncertainty l Assigns a numerical degree of belief between 0 and

4

Bayesian networks

Conditional Probability Distribution (CPD)– Associated with each variable– probability of each state given parent states

“Jane has the flu”

“Jane has a high temp”

“Thermometertemp reading”

XFlu

YTe

QTh

Models causal relationship

Models possible sensor error

P(Flu=T) = 0.05

P(Te=High|Flu=T) = 0.4P(Te=High|Flu=F) = 0.01

P(Th=High|Te=H) = 0.95P(Th=High|Te=L) = 0.1

Page 5: 1 Knowledge Engineering for Bayesian Networks. 2 Probability theory for representing uncertainty l Assigns a numerical degree of belief between 0 and

5

Inference in Belief Networks

Main task of a belief network: Compute the conditional probability of a set of query variables given exact values for some evidence variables: P(query | evidence).

Belief networks are flexible enough so that any node can serve as either a query or an evidence variable.

Page 6: 1 Knowledge Engineering for Bayesian Networks. 2 Probability theory for representing uncertainty l Assigns a numerical degree of belief between 0 and

6

BN inference Evidence: observation of specific state Task: compute the posterior probabilities for query

node(s) given evidence.

Th

Y

Flu

Te

Diagnostic inference

Th

Flu

YTe

Causal inference

Intercausal inference

Te

Flu TBFlu

Mixed inference

Th

Flu

Te

Page 7: 1 Knowledge Engineering for Bayesian Networks. 2 Probability theory for representing uncertainty l Assigns a numerical degree of belief between 0 and

7

Building a BN

Choose a set of random variables Xi that describe the domain.» Missing variables may cause the BN unreliable.

Page 8: 1 Knowledge Engineering for Bayesian Networks. 2 Probability theory for representing uncertainty l Assigns a numerical degree of belief between 0 and

8

Building a BN

Choose a set of random variables Xi that describe the domain.

Order the variables into a list L Start with an empty BN. For each variable X in L do

» Add X into the BN» Choose a minimal set of nodes already in the BN which

satisfy the conditional dependence property with X» Make these nodes the parents of X.» Fill in the CPT for X.

Page 9: 1 Knowledge Engineering for Bayesian Networks. 2 Probability theory for representing uncertainty l Assigns a numerical degree of belief between 0 and

9

The Alarm Example

Mr. Holmes’ security alarm at home may be triggered by either burglar or earthquake. When the alarm sounds, his two nice neighbors, Mary and John, may call him.

causal DAG

Page 10: 1 Knowledge Engineering for Bayesian Networks. 2 Probability theory for representing uncertainty l Assigns a numerical degree of belief between 0 and

10

The Alarm Example

Variable order: » Burglary» Earthquake» Alarm» JohnCalls» MaryCalls

BN

Page 11: 1 Knowledge Engineering for Bayesian Networks. 2 Probability theory for representing uncertainty l Assigns a numerical degree of belief between 0 and

11

The Alarm Example

Variable order: » MaryCalls» JohnCalls» Alarm» Burglary» Earthquake

BN

Page 12: 1 Knowledge Engineering for Bayesian Networks. 2 Probability theory for representing uncertainty l Assigns a numerical degree of belief between 0 and

12

The Alarm Example

Variable order: » MaryCalls» JohnCalls» Earthquake» Burglary» Alarm

BN

Page 13: 1 Knowledge Engineering for Bayesian Networks. 2 Probability theory for representing uncertainty l Assigns a numerical degree of belief between 0 and

13

Weakness of BN

Hard to obtain JPD (joint probability distribution)» Relative Frequency Approach: counting outcomes of

repeated experiments» Subjective Approach: an individual's personal

judgment about whether a specific outcome is likely to occur.

Worst time complexity is NP-hard.

Page 14: 1 Knowledge Engineering for Bayesian Networks. 2 Probability theory for representing uncertainty l Assigns a numerical degree of belief between 0 and

14

BN software

Commerical packages: Netica, Hugin, Analytica (all with demo versions)

Free software: Smile, Genie, JavaBayes, …http://HTTP.CS.Berkeley.EDU/~murphyk/Bayes/

bnsoft.html

Example running Netica software

Page 15: 1 Knowledge Engineering for Bayesian Networks. 2 Probability theory for representing uncertainty l Assigns a numerical degree of belief between 0 and

15

What’s Netica?

Netica is a powerful, easy-to-use, complete program for working with belief networks and influence diagrams. It has an intuitive and smooth user interface for drawing the networks, and the relationships between variables may be entered as individual probabilities, in the form of equations, or learned from data files.

Page 16: 1 Knowledge Engineering for Bayesian Networks. 2 Probability theory for representing uncertainty l Assigns a numerical degree of belief between 0 and

16

Netica Screen Shot

Priori probabilities are needed for each variables.Netica will compute CPT (conditional probability table).

Page 17: 1 Knowledge Engineering for Bayesian Networks. 2 Probability theory for representing uncertainty l Assigns a numerical degree of belief between 0 and

17

Netica Screen Shot

P(Jewelry = yes | Age < 30, Sex = Male)P(Fraud = yes | Jewelry = yes, Age < 30, Sex = male)

Page 18: 1 Knowledge Engineering for Bayesian Networks. 2 Probability theory for representing uncertainty l Assigns a numerical degree of belief between 0 and

18

Netica Screen Shot

P(Fraud = yes | Gas = yes, Jewelry = yes, Age < 30, Sex = male)P(Fraud = yes | Gas = yes, Jewelry = yes, Age > 50, Sex = female)

Page 19: 1 Knowledge Engineering for Bayesian Networks. 2 Probability theory for representing uncertainty l Assigns a numerical degree of belief between 0 and

19

Extensions of BN

Weaker requirement in a DAG: Instead of

I(X, NDX | PAX), ask I(X, NDX | MBX), where

MBX is called Markov Blanket of X, which is the set of neighboring nodes: its parents (PAX), its children, and any other parents of X’s children.

PAB = { H }MBB = { H, L, F }NDB = { L, X }

Page 20: 1 Knowledge Engineering for Bayesian Networks. 2 Probability theory for representing uncertainty l Assigns a numerical degree of belief between 0 and

20

Open Research Questions

Methodology for combining expert elicitation and automated methods» expert knowledge used to guide search» automated methods provide alternatives to be presented to

experts Evaluation measures and methods

» may be domain depended Improved tools to support elicitation

» e.g. visualisation of d-separation Industry adoption of BN technology