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.
Asked
Active
Viewed 1,735 times
4
-
What is the outcome you want to classify? – chl Mar 24 '12 at 09:36
-
The outcome is discrete class (nominal). – fikr4n Mar 24 '12 at 13:33
-
1Err, actually, not. The wikipedia page labels the features $F_1\ldots F_n$. – conjugateprior Mar 24 '12 at 13:48
-
@fkr Does this question/answer help ?: http://stats.stackexchange.com/questions/4298/use-of-kernel-density-estimate-in-naive-bayes-classifier – mlwida Mar 24 '12 at 19:58
-
@ConjugatePrior Does it mean `P(C).P(F1|C).P(F2|C)` rather than `P(C).P(F|C)`? – fikr4n Mar 25 '12 at 02:36
-
@steffen Actually I don't understand... :) – fikr4n Mar 25 '12 at 02:37
1 Answers
1
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.
-
3Glad 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)}$. – conjugateprior Mar 25 '12 at 08:04
-
@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. – mlwida Mar 25 '12 at 10:15
-
@steffen Actually, I need simply two numerical features and a class of nominal :). – fikr4n Mar 25 '12 at 11:46
-
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](http://stats.stackexchange.com/questions/136577/how-to-deal-with-mixture-of-continuous-and-discrete-features-when-using-naive-ba/147535#147535) for more details. – Ashkon Farhangi Apr 21 '15 at 15:31