# Q4(b) Naive Bayes: job offer [10]

Subject: Intelligent Systems II

Exam: TEE

Reader: https://deep-learning-study-room.vercel.app/is2/#tee/papers/paper-reexam-2026/q4b

Canonical: https://deep-learning-study-room.vercel.app/read/is2/tee/papers/paper-reexam-2026--q4b/

Actual TEE re-exam · 100 marks · 3 hours · Q1 compulsory + any 4 of Q2–Q7 · every answer verified (key errors flagged)

**Question. Predict whether a candidate accepts a job offer from Experience (Fresher/Mid/Senior), Expected Salary (Low/Medium/High) and Company Reputation (Good/Average). Data: (Fresher, Low, Good, Yes), (Mid, High, Good, Yes), (Senior, High, Average, No), (Fresher, Medium, Average, Yes), (Senior, Low, Good, No), (Mid, Medium, Good, Yes), (Fresher, High, Average, No), (Senior, Medium, Average, No). New candidate: Mid, Low, Good.** [10 marks]

### Answer

#### Given

The full training data are in Step 1. Query: Experience=Mid, Salary=Low, Reputation=Good. The main calculation uses unsmoothed counts.

#### To find

Both class scores and the predicted class.

#### Formula and why it applies



$$
score(C)=P(C)\prod_jP(a_j\mid C)
$$



C is a class label. Each aⱼ is one query feature value. First count inside a class, then multiply the prior and all three likelihoods.

#### Solution

##### Step 1. Write the training rows as a table

| Row | Experience | Salary | Reputation | Class |
| --- | --- | --- | --- | --- |
| 1 | Fresher | Low | Good | Yes |
| 2 | Mid | High | Good | Yes |
| 3 | Senior | High | Average | No |
| 4 | Fresher | Medium | Average | Yes |
| 5 | Senior | Low | Good | No |
| 6 | Mid | Medium | Good | Yes |
| 7 | Fresher | High | Average | No |
| 8 | Senior | Medium | Average | No |

##### Step 2. Separate the two class groups

| Class | Rows in this group | Class count | Prior |
| --- | --- | --- | --- |
| Yes | 1, 2, 4, 6 | 4 | 4/8 = 0.5 |
| No | 3, 5, 7, 8 | 4 | 4/8 = 0.5 |

##### Step 3. For class Yes, count Experience=Mid

Look only at class Yes rows 1, 2, 4, 6. The matching rows are 2, 6.



$$
P(\text{Experience}=\text{Mid}\mid C=\text{Yes})=\frac{2}{4}=0.5
$$



##### Step 4. For class Yes, count Salary=Low

Look only at class Yes rows 1, 2, 4, 6. The matching rows are 1.



$$
P(\text{Salary}=\text{Low}\mid C=\text{Yes})=\frac{1}{4}=0.25
$$



##### Step 5. For class Yes, count Reputation=Good

Look only at class Yes rows 1, 2, 4, 6. The matching rows are 1, 2, 6.



$$
P(\text{Reputation}=\text{Good}\mid C=\text{Yes})=\frac{3}{4}=0.75
$$



##### Step 6. Multiply the Yes score one factor at a time



$$
P(Yes)=4/8=0.5
$$





$$
0.5\times0.5=0.25
$$





$$
0.25\times0.25=0.0625
$$





$$
0.0625\times0.75=0.046875
$$



##### Step 7. For class No, count Experience=Mid

Look only at class No rows 3, 5, 7, 8. No row in this class has that feature value.



$$
P(\text{Experience}=\text{Mid}\mid C=\text{No})=\frac{0}{4}=0
$$



##### Step 8. For class No, count Salary=Low

Look only at class No rows 3, 5, 7, 8. The matching rows are 5.



$$
P(\text{Salary}=\text{Low}\mid C=\text{No})=\frac{1}{4}=0.25
$$



##### Step 9. For class No, count Reputation=Good

Look only at class No rows 3, 5, 7, 8. The matching rows are 5.



$$
P(\text{Reputation}=\text{Good}\mid C=\text{No})=\frac{1}{4}=0.25
$$



##### Step 10. Multiply the No score one factor at a time



$$
P(No)=4/8=0.5
$$





$$
0.5\times0=0
$$





$$
0\times0.25=0
$$





$$
0\times0.25=0
$$



##### Step 11. Compare the scores



$$
score(Yes)=0.046875\qquad score(No)=0
$$



The larger score belongs to Yes. Normalise only if a posterior probability is requested: divide each score by their total 0.046875.

**Final answer.** Predict Yes. Yes score=0.046875; No score=0.

**Official key note.** The key gives No = 0.0068 and P(Yes) = 0.873. That No value comes from Laplace smoothing (1/7 × 2/7 × 2/6 × 0.5), but the key did not smooth the Yes side. If you smooth, smooth both: Yes = 0.5 × 3/7 × 2/7 × 4/6 = 0.0408, No = 0.0068, P(Yes) = 0.857. The prediction is Yes either way.

**Yaad rakho:** Class ke rows alag karo. Har feature ka count usi class ke total se divide. Saare factors multiply karo.
