C 188: Atificial Intelligence Fall 2006 Lectue 14: oaility 10/17/2006 Dan Klein UC Bekeley Announcements Gades: Check midtem, p1.1, and p1.2 gades in glookup Let us know if thee ae polems, so we can calculate useful peliminay gade estimates If we missed you, tell us you patne s login Reades equest: List patnes and logins on top of you eadme files un off you deug output oject 3.1 up: witten poaility polems, stat now! Exta office hous: husday 2-3pm (if people use them) 1
oaility oday Random Vaiales Joint and Conditional Distiutions Bayes Rule Independence You ll need all this stuff fo the next few weeks, so make sue you go ove it! Uncetainty Geneal situation: Agent knows cetain things aout the state of the wold (e.g., senso eadings o symptoms) Agent needs to eason aout othe aspects (e.g. whee an oject is o what disease is pesent) Agent knows something aout how the known vaiales elate to the unknown vaiales oailistic easoning gives us a famewok fo managing ou eliefs and knowledge 2
Random Vaiales A andom vaiale is some aspect of the wold aout which we have uncetainty R = Is it ing? D = How long will it take to dive to wok? L = Whee am I? We denote andom vaiales with capital lettes Like in a C, each andom vaiale has a domain R in {tue, false} D in [0, ] L in possile locations oailities We geneally calculate conditional poailities (on time no epoted accidents) = 0.90 oailities change with new evidence: (on time no epoted accidents, 5 a.m.) = 0.95 (on time no epoted accidents, 5 a.m., ing) = 0.80 i.e., oseving evidence causes eliefs to e updated 3
oailistic Models Cs: Vaiales with domains Constts: map fom assignments to tue/false Ideally: only cetain vaiales diectly inteact oailistic models: (Random) vaiales with domains Joint distiutions: map fom assignments (o outcomes) to positive numes Nomalized: sum to 1.0 Ideally: only cetain vaiales diectly inteact Assignments ae called outcomes A A B B F F Distiutions on Random Vas A joint distiution ove a set of andom vaiales: is a map fom assignments (o outcomes, o atomic events) to eals: ize of distiution if n vaiales with domain sizes d? Must oey: Fo all ut the smallest distiutions, impactical to wite out 4
Examples An event is a set E of assignments (o outcomes) Fom a joint distiution, we can calculate the poaility of any event oaility that it s AND ny? oaility that it s? oaility that it s OR ny? Maginalization Maginalization (o summing out) is pojecting a joint distiution to a su-distiution ove suset of vaiales 0.6 5
Conditional oailities A conditional poaility is the poaility of an event given anothe event (usually evidence) Conditional oailities Conditional o posteio poailities: E.g., (cavity toothache) = 0.8 Given that toothache is all I know Notation fo conditional distiutions: (cavity toothache) = a single nume (Cavity, oothache) = 2x2 tale summing to 1 (Cavity oothache) = wo 2-element vectos, each summing to 1 If we know moe: (cavity toothache, catch) = 0.9 (cavity toothache, cavity) = 1 Note: the less specific elief emains valid afte moe evidence aives, ut is not always useful New evidence may e ielevant, allowing simplification: (cavity toothache, taffic) = (cavity toothache) = 0.8 his kind of infeence, guided y domain knowledge, is cucial 6
Conditioning Conditional poailities ae the atio of two poailities: Nomalization ick A tick to get the whole conditional distiution at once: Get the joint poailities fo each value of the quey vaiale Renomalize the esulting vecto elect Nomalize 5 0.75 7
he oduct Rule ometimes joint (X,Y) is easy to get ometimes easie to get conditional (X Y) Example: (, dy)? R 0.8 D wet dy wet dy 0.9 0.7 D wet dy wet dy 0.08 0.72 4 0.06 Lewis Caoll's ack olem ack contains a ed o lue token, 50/50 We add a ed token If we daw a ed token, what s the chance of dawing a second ed token? Vaiales: F={,} is the oiginal token D={,} is the fist token we daw Quey: (F= D=) F D F D F 1.0 0.0 8
Lewis Caoll's ack olem Now we have (F,D) Want (F= D=) F D 0.0 5 5 Bayes Rule wo ways to facto a joint distiution ove two vaiales: hat s my ule! Dividing, we get: Why is this at all helpful? Lets us invet a conditional distiution Often the one conditional is ticky ut the othe simple Foundation of many systems we ll see late (e.g. AR, M) In the unning fo most impotant AI equation! 9
Moe Bayes Rule Diagnostic poaility fom causal poaility: Example: m is meningitis, s is stiff neck Note: posteio poaility of meningitis still vey small Note: you should still get stiff necks checked out! Why? Battleship Let s say we have two distiutions: io distiution ove ship locations: (L) ay this is unifom enso eading model: (R L) Given y some known lack ox E.g. (R = yellow L=(1,1)) = Fo now, assume the eading is always fo the lowe left cone We can calculate the posteio distiution ove ship locations using (conditionalized) Bayes ule: 10
Infeence y Enumeation ()? R ( winte)? summe summe summe summe winte winte 0 0.05 0 0.05 0 0.05 ( winte, )? winte winte 5 0 Infeence y Enumeation Geneal case: Evidence vaiales: Quey vaiales: Hidden vaiales: All vaiales We want: Fist, select the enties consistent with the evidence econd, sum out H: Finally, nomalize the emaining enties to conditionalize Ovious polems: Wost-case time complexity O(d n ) pace complexity O(d n ) to stoe the joint distiution 11
Independence wo vaiales ae independent if: his says that thei joint distiution factos into a poduct two simple distiutions Independence is a modeling assumption Empiical joint distiutions: at est close to independent What could we assume fo {Weathe, affic, Cavity}? How many paametes in the joint model? How many paametes in the independent model? Independence is like something fom Cs: what? Example: Independence N fai, independent coin flips: H H H 12
Example: Independence? Aitay joint distiutions can e pooly modeled y independent factos 0.6 Conditional Independence (oothache,cavity,catch) has 2 3 = 8 enties (7 independent enties) If I have a cavity, the poaility that the poe catches in it doesn't depend on whethe I have a toothache: (catch toothache, cavity) = (catch cavity) he same independence holds if I don t have a cavity: (catch toothache, cavity) = (catch cavity) Catch is conditionally independent of oothache given Cavity: (Catch oothache, Cavity) = (Catch Cavity) Equivalent statements: (oothache Catch, Cavity) = (oothache Cavity) (oothache, Catch Cavity) = (oothache Cavity) (Catch Cavity) 13
Conditional Independence Unconditional (asolute) independence is vey ae (why?) Conditional independence is ou most asic and oust fom of knowledge aout uncetain envionments: What aout this domain: affic Umella Raining What aout fie, smoke, alam? he Chain Rule II Can always facto any joint distiution as an incemental poduct of conditional distiutions Why? his actually claims nothing What ae the sizes of the tales we supply? 14
ivial decomposition: he Chain Rule III With conditional independence: Conditional independence is ou most asic and oust fom of knowledge aout uncetain envionments Gaphical models (next class) will help us wok with independence Comining Evidence Imagine we have two senso eadings We want to calculate the distiution ove ship locations given those osevations: List the poailities we ae given We fist calculate the non-conditional (joint) poailities we cae aout hen we enomalize 15