# Q5 (3 marks)

Subject: Natural Language Processing

Exam: M2

Reader: https://deep-learning-study-room.vercel.app/nlp/#m2/mocks/mock-a/q5

Canonical: https://deep-learning-study-room.vercel.app/read/nlp/m2/mocks/mock-a--q5/

M2 · confirmed 2 + 2 + any two of 3 + 3 + 3 · worked practice

### Q5

For a two-sense Naive Bayes WSD model, P(F)=P(R)=0.5. After smoothing, P(loan|F)=0.4, P(money|F)=0.3, P(loan|R)=0.1 and P(money|R)=0.1. Classify “bank” using context {loan, money} and obtain the winning sense’s posterior. (3 marks)

**Given**

F=financial sense; R=river sense. Two exhaustive senses; conditional independence of the context words is assumed.

**To find**

Two scores, selected sense and normalised posterior.

### Formula and why it applies



$$
s(c)=P(c)P(\text{loan}\mid c)P(\text{money}\mid c)
$$





$$
P(c\mid x)=\frac{s(c)}{s(F)+s(R)}
$$



Multiply the prior by the two likelihoods, then normalise because a posterior is requested.

### Solution

#### Step 1. Financial score



$$
s(F)=0.5\times0.4\times0.3=0.06
$$



#### Step 2. River score



$$
s(R)=0.5\times0.1\times0.1=0.005
$$



#### Step 3. Total evidence score



$$
0.06+0.005=0.065
$$



#### Step 4. Normalise winner



$$
P(F\mid x)=\frac{0.06}{0.065}=\frac{12}{13}\approx0.923077
$$



Financial sense; posterior ≈0.923077.
