4
$\begingroup$

I have two features which are both continuous. How to perform a classification task based on them? I've read the Wikipedia entry on Naive Bayes, but this is only for discrete outcome and one feature.

$\endgroup$
6
  • $\begingroup$ What is the outcome you want to classify? $\endgroup$
    – chl
    Mar 24, 2012 at 9:36
  • $\begingroup$ The outcome is discrete class (nominal). $\endgroup$
    – fikr4n
    Mar 24, 2012 at 13:33
  • 1
    $\begingroup$ Err, actually, not. The wikipedia page labels the features $F_1\ldots F_n$. $\endgroup$ Mar 24, 2012 at 13:48
  • $\begingroup$ @fkr Does this question/answer help ?: stats.stackexchange.com/questions/4298/… $\endgroup$
    – mlwida
    Mar 24, 2012 at 19:58
  • $\begingroup$ @ConjugatePrior Does it mean P(C).P(F1|C).P(F2|C) rather than P(C).P(F|C)? $\endgroup$
    – fikr4n
    Mar 25, 2012 at 2:36

1 Answer 1

1
$\begingroup$

I think I've found the solution in the same page. It might because I was dumb or being stressed :).

Example:

$$ \text{posterior}(\text{male})=\frac{P(\text{male})P(\text{height}\mid\text{male})P(\text{weight}\mid\text{male})P(\text{footsize}\mid\text{male})}{\text{evidence}} $$

Thanks @ConjugatePrior.

$\endgroup$
4
  • 3
    $\begingroup$ Glad to hear it now makes sense. btw you don't have to post the image - you can write it in latex math notation, e.g. Bayes theorem is written p(C|F) = \frac{p(F|C) p(C)}{p(F)} which when you surround it with $ signs renders automatically as $p(C|F) = \frac{p(F|C) p(C)}{p(F)}$. $\endgroup$ Mar 25, 2012 at 8:04
  • $\begingroup$ @fkr so, concluding from your answer your actual question was how to perform NB with more than one feature ? I ask because your answer does not aim at the special case of continuous features ;). Some have problems calculating the conditional probabilities for cont. features, so I thought your question aims in the same direction. $\endgroup$
    – mlwida
    Mar 25, 2012 at 10:15
  • $\begingroup$ @steffen Actually, I need simply two numerical features and a class of nominal :). $\endgroup$
    – fikr4n
    Mar 25, 2012 at 11:46
  • $\begingroup$ To point out a nuance about BornToCode's answer, the expression he wrote for the probability of a class is not technically correct. For continuous features such as height, the conditional probability of a single value is always 0. Fortunately, we can use the height of the conditional probability density function corresponding to the value of height as a proxy for the conditional probability of that value occurring. See this question for more details. $\endgroup$ Apr 21, 2015 at 15:31

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.