CS 188: Artificial Intelligence Fall 2009AnnouncementsTodayInference in GhostbustersUncertaintyRandom VariablesProbability DistributionsJoint DistributionsProbabilistic ModelsEventsMarginal DistributionsConditional ProbabilitiesConditional DistributionsNormalization TrickProbabilistic InferenceInference by EnumerationSlide 17The Product RuleThe Chain RuleBayes’ RuleInference with Bayes’ RuleGhostbusters, RevisitedIndependenceExample: Independence?Example: IndependenceCS 188: Artificial IntelligenceFall 2009Lecture 13: Probability10/8/2009Dan Klein – UC Berkeley1AnnouncementsUpcomingP3 Due 10/12W2 Due 10/15Midterm in evening of 10/22Review sessions:Probability review: Friday 12-2pm in 306 SodaMidterm review: on web page when confirmed2TodayProbabilityRandom VariablesJoint and Marginal DistributionsConditional DistributionProduct Rule, Chain Rule, Bayes’ RuleInferenceIndependenceYou’ll need all this stuff A LOT for the next few weeks, so make sure you go over it now!3Inference in GhostbustersA ghost is in the grid somewhereSensor readings tell how close a square is to the ghostOn the ghost: red1 or 2 away: orange3 or 4 away: yellow5+ away: greenP(red | 3) P(orange | 3) P(yellow | 3) P(green | 3)0.05 0.15 0.5 0.3 Sensors are noisy, but we know P(Color | Distance)[Demo]UncertaintyGeneral situation:Evidence: Agent knows certain things about the state of the world (e.g., sensor readings or symptoms)Hidden variables: Agent needs to reason about other aspects (e.g. where an object is or what disease is present)Model: Agent knows something about how the known variables relate to the unknown variablesProbabilistic reasoning gives us a framework for managing our beliefs and knowledge5Random VariablesA random variable is some aspect of the world about which we (may) have uncertaintyR = Is it raining?D = How long will it take to drive to work?L = Where am I?We denote random variables with capital lettersLike variables in a CSP, random variables have domainsR in {true, false} (sometimes write as {+r, r})D in [0, )L in possible locations, maybe {(0,0), (0,1), …}6Probability DistributionsUnobserved random variables have distributionsA distribution is a TABLE of probabilities of valuesA probability (lower case value) is a single numberMust have: 7T Pwarm 0.5cold 0.5W Psun 0.6rain 0.1fog 0.3meteor 0.0Joint DistributionsA joint distribution over a set of random variables:specifies a real number for each assignment (or outcome): Size of distribution if n variables with domain sizes d?Must obey:For all but the smallest distributions, impractical to write outT W Phot sun 0.4hot rain 0.1cold sun 0.2cold rain 0.38Probabilistic ModelsA probabilistic model is a joint distribution over a set of random variablesProbabilistic models:(Random) variables with domains Assignments are called outcomesJoint distributions: say whether assignments (outcomes) are likelyNormalized: sum to 1.0Ideally: only certain variables directly interactConstraint satisfaction probs:Variables with domainsConstraints: state whether assignments are possibleIdeally: only certain variables directly interactT W Phot sun 0.4hot rain 0.1cold sun 0.2cold rain 0.3T W Phot sun Thot rain Fcold sun Fcold rain T9Distribution over T,WConstraint over T,WEventsAn event is a set E of outcomesFrom a joint distribution, we can calculate the probability of any eventProbability that it’s hot AND sunny?Probability that it’s hot?Probability that it’s hot OR sunny?Typically, the events we care about are partial assignments, like P(T=hot) T W Phot sun 0.4hot rain 0.1cold sun 0.2cold rain 0.310Marginal DistributionsMarginal distributions are sub-tables which eliminate variables Marginalization (summing out): Combine collapsed rows by addingT W Phot sun 0.4hot rain 0.1cold sun 0.2cold rain 0.3T Phot 0.5cold 0.5W Psun 0.6rain 0.411Conditional ProbabilitiesA simple relation between joint and conditional probabilitiesIn fact, this is taken as the definition of a conditional probabilityT W Phot sun 0.4hot rain 0.1cold sun 0.2cold rain 0.312Conditional DistributionsConditional distributions are probability distributions over some variables given fixed values of othersT W Phot sun 0.4hot rain 0.1cold sun 0.2cold rain 0.3W Psun 0.8rain 0.2W Psun 0.4rain 0.6Conditional DistributionsJoint Distribution13Normalization TrickA trick to get a whole conditional distribution at once:Select the joint probabilities matching the evidenceNormalize the selection (make it sum to one)Why does this work? Sum of selection is P(evidence)! (P(r), here) T W Phot sun 0.4hot rain 0.1cold sun 0.2cold rain 0.3T R Phot rain 0.1cold rain 0.3T Phot 0.25cold 0.75SelectNormalize14Probabilistic InferenceProbabilistic inference: compute a desired probability from other known probabilities (e.g. conditional from joint)We generally compute conditional probabilities P(on time | no reported accidents) = 0.90These represent the agent’s beliefs given the evidenceProbabilities change with new evidence:P(on time | no accidents, 5 a.m.) = 0.95P(on time | no accidents, 5 a.m., raining) = 0.80Observing new evidence causes beliefs to be updated15Inference by EnumerationP(sun)?P(sun | winter)?P(sun | winter, warm)?S T W Psummer hot sun 0.30summer hot rain 0.05summer cold sun 0.10summer cold rain 0.05winter hot sun 0.10winter hot rain 0.05winter cold sun 0.15winter cold rain 0.2016Inference by EnumerationGeneral case:Evidence variables: Query* variable:Hidden variables:We want:First, select the entries consistent with the evidenceSecond, sum out H to get joint of Query and evidence:Finally, normalize the remaining entries to conditionalizeObvious problems:Worst-case time complexity O(dn) Space complexity O(dn) to store the joint distributionAll variables* Works fine with multiple query variables, tooThe Product RuleSometimes have conditional distributions but want the jointExample:R Psun 0.8rain 0.2D W Pwet sun 0.1dry sun 0.9wet rain 0.7dry rain 0.3D W Pwet sun 0.08dry sun 0.72wet rain 0.14dry rain 0.0618The Chain RuleMore generally, can always write any joint distribution as an incremental product of conditional distributionsWhy is this always true?19Bayes’ RuleTwo ways to factor a joint
View Full Document