790 likes | 1.08k Views
Bayesian Networks. Yeni Herdiyeni Departemen Ilmu Komputer. Overview. Decision-theoretic techniques Explicit management of uncertainty and tradeoffs Probability theory Maximization of expected utility Applications to AI problems Diagnosis Expert systems Planning Learning.
E N D
Bayesian Networks Yeni Herdiyeni Departemen Ilmu Komputer
Overview • Decision-theoretic techniques • Explicit management of uncertainty and tradeoffs • Probability theory • Maximization of expected utility • Applications to AI problems • Diagnosis • Expert systems • Planning • Learning
Course Contents • Concepts in Probability • Probability • Random variables • Basic properties (Bayes rule) • Bayesian Networks • Inference • Applications
Probabilities • Probability distribution P(X|x) • X is a random variable • Discrete • Continuous • xis background state of information
Discrete Random Variables • Finite set of possible outcomes X binary:
Continuous Random Variable • Probability distribution (density function) over continuous values 5 7
More Probabilities • Joint • Probability that both X=x and Y=y • Conditional • Probability that X=x given we know that Y=y
Rules of Probability • Product Rule • Marginalization X binary:
Course Contents • Concepts in Probability • Bayesian Networks • Basics • Additional structure • Knowledge acquisition • Inference • Decision making • Learning networks from data • Reasoning over time • Applications
Bayesian networks • Basics • Structured representation • Conditional independence • Naïve Bayes model • Independence facts
Naïve Bayes vs Bayesian Network • Pada Naïve Bayes, mengabaikan korelasi antar variabel. • Sedangkan pada Bayesian Network, variabel input bisa saling dependent.
P( S=no) 0.80 P( S=light) 0.15 P( S=heavy) 0.05 Smoking= no light heavy P( C=none) 0.96 0.88 0.60 P( C=benign) 0.03 0.08 0.25 P( C=malig) 0.01 0.04 0.15 Bayesian Networks Smoking Cancer
Product Rule • P(C,S) = P(C|S) P(S)
Marginalization P(Smoke) P(Cancer)
Cancer= none benign malignant P( S=no) 0.821 0.522 0.421 P( S=light) 0.141 0.261 0.316 P( S=heavy) 0.037 0.217 0.263 Bayes Rule Revisited
A Bayesian Network Age Gender Exposure to Toxics Smoking Cancer Serum Calcium Lung Tumor
Independence Age and Gender are independent. Age Gender P(A,G) = P(G)P(A) P(A|G) = P(A) A ^G P(G|A) = P(G) G ^A P(A,G) = P(G|A) P(A) = P(G)P(A) P(A,G) = P(A|G) P(G) = P(A)P(G)
Conditional Independence Cancer is independent of Age and Gender given Smoking. Age Gender Smoking P(C|A,G,S) = P(C|S) C ^ A,G | S Cancer
Serum Calcium is independent of Lung Tumor, given Cancer P(L|SC,C) = P(L|C) More Conditional Independence:Naïve Bayes Serum Calcium and Lung Tumor are dependent Cancer Serum Calcium Lung Tumor
P(E = heavy | C = malignant) > P(E = heavy | C = malignant, S=heavy) More Conditional Independence:Explaining Away Exposure to Toxics and Smoking are independent Exposure to Toxics Smoking E ^ S Cancer Exposure to Toxics is dependent on Smoking, given Cancer
Age Gender Exposure to Toxics Smoking Cancer Serum Calcium Lung Tumor Put it all together
General Product (Chain) Rule for Bayesian Networks Pai=parents(Xi)
Conditional Independence A variable (node) is conditionally independent of its non-descendants given its parents. Age Gender Non-Descendants Exposure to Toxics Smoking Parents Cancer is independent of Age and Gender given Exposure to Toxics and Smoking. Cancer Serum Calcium Lung Tumor Descendants
Another non-descendant Age Gender Cancer is independent of Dietgiven Exposure toToxics and Smoking. Exposure to Toxics Smoking Diet Cancer Serum Calcium Lung Tumor
Bayesian Network • Bayesian Network atau Belief Network atau Probabilistik Network adalah model grafik untuk merepresentasikan interaksi antar variabel. • Bayesian Network digambarkan seperti graf yang terdiri dari simpul (node) dan busur (arc). Simpul menunjukkan variabel misal X beserta nilai probabilitasnya P(X) dan busur menunjukkan hubungan antar simpul. • Jika ada hubungan dari simpul X ke simpul Y, ini mengindikasikan bahwa variabel X ada pengaruh terhadap variabel Y. Pengaruh ini dinyatakan dengan peluang bersyarat P(Y|X).
Bayesian Network - Latihan Yeni Herdiyeni
Bayesian Network • Dari gambar tersebut dapat diketahui peluang gabungan dari P(R,W). Jika P(R) = 0.4, maka P(~R) = 0.6 dan jika P(~W|~R) = 0.8. • Kaidah Bayes dapat digunakan untuk membuat diagnosa.
Bayesian Network Sebagai contoh jika diketahui bahwa rumput basah, maka peluang hujan dapat dihitung sebagai berikut :
Bayesian Network • Berapa peluang rumput basah jika Springkler menyala (tidak diketahui hujan atau tidak)
Bayesian Network • Berapa peluang Springkler menyala setelah diketahui rumput basah P(S|W)?
Bayesian Network • Jika diketahui hujan, berapa peluang Springkler menyala?
Bayesian Network • Bagaimana jika ada asumsi : Jika cuacanya mendung (cloudy), maka Springkler kemungkinan besar tidak menyala.
Bayesian Network • Berapa peluang rumput basah jika diketahui cloudy?
Bayesian Network • Berapa peluang rumput basah jika diketahui cloudy?
Latihan • Jika ada seekor kucing yang suka berjalan di atap dan membuat keributan. Jika hujan, kucing tidak keluar. • Berapa peluang kita akan mendengar kucing diatap jika cuaca Cloudy? P(F|C)
Course Contents • Concepts in Probability • Bayesian Networks • Inference • Decision making • Learning networks from data • Reasoning over time • Applications
Inference • Patterns of reasoning • Basic inference • Exact inference • Exploiting structure • Approximate inference
Predictive Inference Age Gender How likely are elderly males to get malignant cancer? Exposure to Toxics Smoking P(C=malignant| Age>60, Gender= male) Cancer Serum Calcium Lung Tumor
Combined Age Gender How likely is an elderly male patient with high Serum Calciumto have malignant cancer? Exposure to Toxics Smoking Cancer P(C=malignant| Age>60, Gender= male, Serum Calcium = high) Serum Calcium Lung Tumor
Smoking • If we then observe heavy smoking, the probability of exposure to toxics goes back down. Explaining away Age Gender • If we see a lung tumor, the probability of heavy smoking and of exposure to toxics both go up. Exposure to Toxics Smoking Cancer Serum Calcium Lung Tumor
P(q, e) P(q | e) = P(e) Inference in Belief Networks • Find P(Q=q|E= e) • Q the query variable • E set of evidence variables X1,…, Xn are network variables except Q, E P(q, e) = S P(q, e, x1,…, xn) x1,…, xn
Basic Inference A B P(b) = ?
Product Rule S C • P(C,S) = P(C|S) P(S)
Marginalization P(Smoke) P(Cancer)
C P(b) = S P(a, b) = S P(b | a) P(a) a a P(c) = S P(c | b) P(b) b = S P(c | b) P(b | a) P(a) P(c) = S P(a, b, c) b,a b,a = S P(c | b) S P(b | a) P(a) b a P(b) Basic Inference A B
= S P(x | y1, y2) P(y1) P(y2) because of independence of Y1, Y2: y1, y2 Inference in trees Y2 Y1 X X P(x) = S P(x | y1, y2) P(y1, y2) y1, y2
Course Contents • Concepts in Probability • Bayesian Networks • Inference • Learning networks from data • Reasoning over time • Applications
Course Contents • Concepts in Probability • Bayesian Networks • Inference • Applications