सभी नोट्स

Reasoning under uncertainty

गेट DA210 मिनट में पढ़ें

मुफ़्त प्रीव्यू: नोट का 29%

Probability as a model of belief

Definition. When an agent cannot be certain, it assigns probabilities to the possible states of the world. A joint distribution P(X1,…,Xn)P(X_1, \dots, X_n) gives a probability to every combination of values; from it, any question can be answered:

  • Marginalisation (summing out): P(X)=∑yP(X,Y=y)P(X) = \sum_y P(X, Y = y).
  • Conditioning: P(X∣Y)=P(X,Y)P(Y)P(X \mid Y) = \dfrac{P(X, Y)}{P(Y)}.
  • Product rule: P(X,Y)=P(X∣Y) P(Y)P(X, Y) = P(X \mid Y)\,P(Y), and the chain rule P(X1,…,Xn)=∏iP(Xi∣X1,…,Xi−1)P(X_1, \dots, X_n) = \prod_i P(X_i \mid X_1, \dots, X_{i-1}).
  • Bayes' rule: P(H∣E)=P(E∣H) P(H)P(E)P(H \mid E) = \dfrac{P(E \mid H)\,P(H)}{P(E)}.

The full joint table over nn Boolean variables has 2n2^n entries, which is too many. Independence assumptions make the model small.

Independence and conditional independence

  • XX and YY are independent if P(X,Y)=P(X)P(Y)P(X, Y) = P(X)P(Y), equivalently P(X∣Y)=P(X)P(X \mid Y) = P(X).
  • XX and YY are conditionally independent given ZZ if P(X,Y∣Z)=P(X∣Z) P(Y∣Z)P(X, Y \mid Z) = P(X \mid Z)\,P(Y \mid Z), equivalently P(X∣Y,Z)=P(X∣Z)P(X \mid Y, Z) = P(X \mid Z): once ZZ is known, YY tells us nothing more about XX.

Exam point. Neither implies the other. Two symptoms of the same disease are usually dependent, but conditionally independent given the disease. Two independent causes of one effect become dependent once the effect is observed ("explaining away").

Bayesian networks

Definition. A Bayesian network is a directed acyclic graph: one node per random variable, an edge X→YX \to Y meaning XX directly influences YY, and for each node a conditional probability table (CPT) P(X∣Parents(X))P(X \mid \text{Parents}(X)). The joint distribution factorises as

P(X1,…,Xn)=∏i=1nP(Xi∣Parents(Xi)).P(X_1, \dots, X_n) = \prod_{i=1}^{n} P(X_i \mid \text{Parents}(X_i)).

Size. A Boolean node with kk Boolean parents needs 2k2^k independent numbers (one P(X=true)P(X = \text{true}) per parent combination). A network is usually far smaller than the 2n−12^n - 1 numbers of the full joint.

Reading independence from the graph. Each node is conditionally independent of its non-descendants given its parents. For a path through a middle node BB:

  • Chain A→B→CA \to B \to C: AA and CC are dependent, but independent given BB.
  • Fork A←B→CA \leftarrow B \to C: dependent, but independent given BB.
  • Collider A→B←CA \to B \leftarrow C: AA and CC are independent, but become dependent given BB (or given any descendant of BB).

This is d-separation: two nodes are conditionally independent given evidence EE if every path between them is blocked.

Solved examples

Example 1: number of parameters. Network: A→C←BA \to C \leftarrow B, C→DC \to D, all Boolean. AA and BB have no parents: 1 number each. CC has 2 parents: 22=42^2 = 4. DD has 1 parent: 2. Total 8, against 24−1=152^4 - 1 = 15 for the full joint.

Example 2: a joint probability. Rain RR → WetGrass WW, with P(R)=0.2P(R) = 0.2, P(W∣R)=0.9P(W \mid R) = 0.9, P(W∣¬R)=0.1P(W \mid \neg R) = 0.1. Then

P(R,W)=0.2×0.9=0.18,P(W)=0.18+0.8×0.1=0.26,P(R∣W)=0.180.26≈0.69.P(R, W) = 0.2 \times 0.9 = 0.18, \quad P(W) = 0.18 + 0.8 \times 0.1 = 0.26, \quad P(R \mid W) = \frac{0.18}{0.26} \approx 0.69 .

Exact inference: variable elimination

Goal. Compute P(Query∣evidence)P(\text{Query} \mid \text{evidence}). The naive way sums the full joint over all hidden variables: exponential work.

Variable elimination writes the query as a sum of products of CPTs and pushes each sum inside as far as it goes, so it is computed once and reused:

  1. Fix the evidence values in the CPTs.
  2. Choose an order for the hidden variables.
  3. For each hidden variable ZZ: multiply all factors that mention ZZ, then sum ZZ out, giving a new factor.
  4. Multiply the remaining factors and normalise.

The cost depends on the size of the largest factor created, which depends on the elimination order. On a polytree (no undirected cycles) inference is linear in the size of the network; in general it is NP-hard.

Solved example

Example 3. Chain A→B→CA \to B \to C with P(a)=0.5P(a) = 0.5, P(b∣a)=0.8P(b \mid a) = 0.8, P(b∣¬a)=0.2P(b \mid \neg a) = 0.2, P(c∣b)=0.9P(c \mid b) = 0.9, P(c∣¬b)=0.3P(c \mid \neg b) = 0.3. Find P(c)P(c).

  1. Eliminate AA: P(b)=0.5×0.8+0.5×0.2=0.5P(b) = 0.5 \times 0.8 + 0.5 \times 0.2 = 0.5, so P(¬b)=0.5P(\neg b) = 0.5.
  2. Eliminate BB: P(c)=0.5×0.9+0.5×0.3=0.6P(c) = 0.5 \times 0.9 + 0.5 \times 0.3 = 0.6.

P(c)=0.6P(c) = 0.6. Summing AA out first left a small factor over BB alone, instead of a table over all of A,B,CA, B, C.

Approximate inference by sampling

When exact inference is too costly, estimate probabilities from random samples drawn from the network.

  • Prior (forward) sampling: sample each variable in topological order from its CPT given the sampled parents. The fraction of samples with X=xX = x estimates P(x)P(x).
  • Rejection sampling: generate prior samples and discard those that disagree with the evidence; estimate the query from the rest. Correct, but wasteful when the evidence is unlikely (most samples are rejected).
  • Likelihood weighting: fix the evidence variables to their observed values and sample only the others; weight each sample by the product of P(e∣parents)P(e \mid \text{parents}) over the evidence variables. No samples are wasted.
  • Gibbs sampling (MCMC): start from any state consistent with the evidence and repeatedly resample one non-evidence variable given its Markov blanket; after a burn-in period the states are samples from the posterior.

All of these become exact as the number of samples grows (they are consistent estimators).

Example 4: a likelihood weight. In Example 2 with evidence W=trueW = \text{true}: a sample with R=trueR = \text{true} gets weight P(W∣R)=0.9P(W \mid R) = 0.9; one with R=falseR = \text{false} gets 0.10.1.

Working with a joint table

Example 5. Weather WW is Sunny or Rain, and Traffic TT is Heavy or Light. The joint distribution is:

HeavyLight
Sunny0.20.4
Rain0.30.1
  • Marginals: P(Heavy)=0.2+0.3=0.5P(\text{Heavy}) = 0.2 + 0.3 = 0.5 and P(Rain)=0.3+0.1=0.4P(\text{Rain}) = 0.3 + 0.1 = 0.4.
  • Conditional: P(Rain∣Heavy)=0.3/0.5=0.6P(\text{Rain} \mid \text{Heavy}) = 0.3 / 0.5 = 0.6.
  • Independence? P(Rain) P(Heavy)=0.4×0.5=0.2P(\text{Rain})\,P(\text{Heavy}) = 0.4 \times 0.5 = 0.2, but P(Rain,Heavy)=0.3P(\text{Rain}, \text{Heavy}) = 0.3. Dependent: rain makes heavy traffic more likely.
  • Normalisation trick: P(W∣Heavy)=α ⟨0.2,0.3⟩=⟨0.4,0.6⟩P(W \mid \text{Heavy}) = \alpha\,\langle 0.2, 0.3\rangle = \langle 0.4, 0.6\rangle, where α=1/0.5\alpha = 1/0.5. We can compute the unnormalised numbers first and scale them so they sum to 1. The value P(evidence)P(\text{evidence}) is never needed separately.

Bayes' rule in more depth

Odds form. Posterior odds = prior odds × likelihood ratio:

P(H∣E)P(¬H∣E)=P(H)P(¬H)×P(E∣H)P(E∣¬H).\frac{P(H \mid E)}{P(\neg H \mid E)} = \frac{P(H)}{P(\neg H)} \times \frac{P(E \mid H)}{P(E \mid \neg H)} .

आपने इस नोट का मुफ़्त 29% हिस्सा पढ़ लिया

आगे पढ़ने के लिए Google से साइन इन करें। यह मुफ़्त है, एक टैप में होता है, और साथ में मिलता है:

  • इस नोट से 10 अभ्यास सवाल
  • हर नोट पूरा, साथ में PDF लाइब्रेरी
  • आधिकारिक पिछले पेपर समय-सीमा वाले टेस्ट की तरह, व्याख्या के साथ
  • डाउट के लिए AI ट्यूटर, हिंदी या अंग्रेज़ी में
  • आपकी प्रगति, गलतियाँ और स्टडी प्लान हर डिवाइस पर सेव
आगे पढ़ें, मुफ़्त