2
$\begingroup$

Given the following data:

$$\begin{array}{c|c|c|c|c|} \text{Instance} & \text{A} & \text{B} &\text{C} &\text{Class} \\ \hline \text{1} & 1 & 2 & 1 & 1 \\ \hline \text{2}& 0 & 0 & 1 & 1 \\ \hline \text{3} & 2 & 1 & 2 & 2 \\ \hline \text{4} & 1 & 2 & 1 & 2 \\ \hline \text{5} & 0 & 1 & 2 & 1 \\ \hline \text{6} & 2 & 2 & 2 & 2 \\ \hline \text{7} & 1 & 0 & 1 & 1\\ \hline \end{array}$$

Predit the class label for instance $(A=1, B=2, C=2)$ using naive Bayes classifcation.

Let $C_{1}$ be class $1$ and $C_{2}$ be class $2$. I have so far that the class prior probabilties are:

$$P(C_{1})=\dfrac{4}{7}$$ $$P(C_{2})=\dfrac{3}{7}$$

Using Bayes Theorem: $$P(C{i}|X)=\dfrac{P(X|C{i})P(C_{i})}{P(X)}$$

I know that $P(X|C_{i})=\prod^{n}_{k=1}P(X_{k}|C_{i})$ but not sure how to calculate this.

Where do I go from here to go about answering the question?

$\endgroup$
2
$\begingroup$

For $C_1$, by the assumption of Naive Bayesian Classifier, we have $$ P(A = 1, B = 2, C=2 \mid C_1) = P(A = 1 \mid C_1) \cdot P(B = 2 \mid C_1) \cdot P(C = 2 \mid C_1) $$ Take $P(A = 1 \mid C_1)$ as an example. There are $4$ training records of $C_1$, among which there are $2$ records with $A = 1$. Therefore, $P(A = 1 \mid C_1) = \frac{2}{4}$. Similarly, you can calculate $P(B = 2 \mid C_1)$ and $P(C = 2 \mid C_1)$.

It is similar to calculate $P(A = 1, B = 2, C = 2 \mid C_2)$.

$\endgroup$
  • $\begingroup$ Then does the highest probability predict the class? $\endgroup$ – Sophie Filer Apr 24 '17 at 10:29
  • 1
    $\begingroup$ @SophieFiler Exactly. Note that you do not need to consider the term $P(X)$ in your formula since it is contained in both probabilities. $\endgroup$ – PSPACEhard Apr 24 '17 at 10:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.