0
990views
For a new example (Rural, Semideatached, low, No).What will be the predicted class label?

Subject: Data Mining And Business Intelligence

Topic: Classification

Difficulty: High

The table below shows a sample dataset of whether a customer responds to a survey or not. “Outcome” is the class label.Construst a Naïve Bayes’ Classifier for the dataset. For a new example (Rural, Semideatached, low, No).What will be the predicted class label?

District House Type Income Previous Customer Outcome
Suburban Detached High No Nothing
Suburban Detached High Yes Nothing
Rural Detached High No Responded
Urban Semi-dettached High No Responded
Urban Semi-dettached Low No Responded
Urban Semi-dettached Low Yes Nothing
Rural Semi-dettached Low Yes Responded
Suburban Terrace High No Nothing
Suburban Semi-dettached Low No Responded
Urban Terrace Low No Responded
Suburban Terrace Low Yes Responded
Rural Terrace High Yes Responded
Rural Detached Low No Responded
Urban Terrace High Yes Nothing
1 Answer
0
24views

Naive Bayes Classifier Example

Here, we want to classify a Rural, Semideatached, Low, No, and predict the class label for this sample.

The above sample dataset does not contain the class label for this sample. Hence, by using Naïve Bayes Classifier we can find out the class table value for the given sample.

To do this we need to calculate the below probabilities:


First, calculates the Probabilities for $P(x|Nothing)$

$$P(Nothing) = \frac{5}{14} $$

$$ P(Rural│Nothing) = \frac{0}{5} = 0 $$

$$ P(Semi-detached│Nothing) = \frac{1}{5} $$

$$ P(Low│Nothing) = \frac{1}{5} $$

$$P(No│Nothing) = \frac{2}{5} $$


Second, calculates the Probabilities for $P(x|Responded)$

$$P(Responded) = \frac{9}{14}$$

$$P(Rural│Responded) = \frac{4}{9}$$

$$P(Semi-detached│Responded) = \frac{4}{9}$$

$$P(Low│Responded) = \frac{6}{9}$$

$$P(No│Responded) = \frac{6}{9}$$


According to Naïve Bayes Classifier

$$P(C│X)=P(x1│C) × P(x2│C) ×…………P(xn│C) × P(C)$$


Therefore, Probability for Class label Nothing we have

$$Nothing=P(X│Nothing) × P(Nothing)$$

$$Nothing=P(Rural│Nothing)×P(Semi-detached│Nothing)×P(Low│Nothing)×P(No│Nothing)×P(Nothing)$$

$$= 0 ×\frac{1}{5} × \frac{1}{5} × \frac{2}{5} × \frac{5}{14} = 0$$

If one of the conditional probabilities is zero, then the entire expression becomes zero. This can be seen in the above scenario.


Therefore, Probability for Class label Responded we have

$$Responded=P(X│Responded) × P(Responded)$$

$$Responded= P(Rural│Responded)× P(Sumi-detached│Responded)× P(Low│Responded)×P(No│Responded)×P(Responded)$$

$$= \frac{4}{9} × \frac{4}{9} × \frac{6}{9} × \frac{6}{9} × \frac{9}{14} = 0.056$$


As

$$P(X│Responded).P(Responded) \gt P(X│Nothing).P(Nothing)$$

$$because,\ 0.056 \gt 0$$

Therefore, this sample (Rural, Semideatached, Low, No) gets classified under Class label ’Responded’.

Please log in to add an answer.