C 188: Atificial Intelligence all 2006 Lectue 14: oaility 10/17/2006 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! an Klein UC Bekeley Exta office hous: husday 2-3pm (if people use them) oday oaility Random Vaiales Joint and Conditional istiutions 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 Random Vaiales A andom vaiale is some aspect of the wold aout which we have uncetainty R = Is it ing? = ow 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} 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 1
oailistic Models istiutions on Random Vas 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 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: o all ut the smallest distiutions, impactical to wite out Examples Maginalization An event is a set E of assignments (o outcomes) om a joint distiution, we can calculate the poaility of any event oaility that it s AN ny? oaility that it s? oaility that it s OR ny? Maginalization (o summing out) is pojecting a joint distiution to a su-distiution ove suset of vaiales 0.6 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 2
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 he oduct Rule ometimes joint (X,Y) is easy to get ometimes easie to get conditional (X Y) Example: (, )? 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: ={,} is the oiginal token ={,} is the fist token we daw Quey: (= =) R 0.8 0.9 0.7 0.08 0.72 4 0.06 1.0 0.0 Lewis Caoll's ack olem Now we have (,) Want (= =) Bayes Rule wo ways to facto a joint distiution ove two vaiales: hat s my ule! 0.0 5 5 ividing, we get: Why is this at all helpful? Lets us invet a conditional distiution Often the one conditional is ticky ut the othe simple oundation of many systems we ll see late (e.g. AR, M) In the unning fo most impotant AI equation! 3
Moe Bayes Rule Battleship iagnostic 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? 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)) = o now, assume the eading is always fo the lowe left cone We can calculate the posteio distiution ove ship locations using (conditionalized) Bayes ule: Infeence y Enumeation Infeence y Enumeation ()? ( winte)? ( winte, )? summe summe summe summe winte winte winte winte R 0 0 0 5 0 Geneal case: Evidence vaiales: Quey vaiales: idden vaiales: We want: ist, select the enties consistent with the evidence econd, sum out : inally, nomalize the emaining enties to conditionalize All vaiales Ovious polems: Wost-case time complexity O(d n ) pace complexity O(d n ) to stoe the joint distiution Independence wo vaiales ae independent if: Example: Independence N fai, independent coin flips: 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}? ow many paametes in the joint model? ow many paametes in the independent model? Independence is like something fom Cs: what? 4
Example: Independence? Conditional Independence Aitay joint distiutions can e pooly modeled y independent factos 0.6 (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) Conditional Independence Unconditional (asolute) independence is vey ae (why?) he Chain Rule II Can always facto any joint distiution as an incemental poduct of conditional distiutions Conditional independence is ou most asic and oust fom of knowledge aout uncetain envionments: Why? What aout this domain: affic Umella Raining What aout fie, smoke, alam? his actually claims nothing What ae the sizes of the tales we supply? ivial decomposition: he Chain Rule III With conditional 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 Conditional independence is ou most asic and oust fom of knowledge aout uncetain envionments Gaphical models (next class) will help us wok with independence hen we enomalize 5