0
$\begingroup$

I'm trying to do text detection thanks to Naive Bayes Algorithm.

If I teach my tool: "Football is a great hobby" and assign it to the label "football", I'm totally fine with it detecting "I play football" as "football"

The issue is, if I have a sentence that does not match ANY label, the probability will be the same for all labels.

So I could obviously say that, if all probabilities are equal, I mark the sentence as not found, but if one day, two labels really have the same probability?

What do we do when we have a "not found" label with Naive Bayes algorithm?

$\endgroup$
1
$\begingroup$

The question is about the decision rule you are going to use. The "default" decision rule for Naive Bayes classifier is

$$ \DeclareMathOperator*{\argmax}{\mathrm{arg\ max}} \hat{C_k} = \argmax_{k \in \{1, \dots, K\}} \ p(C_k) \displaystyle\prod_{i=1}^n p(x_i \mid C_k) $$

i.e. classify some observation as belonging to class $\hat{C_k}$ by taking the class that maximizes the posterior probability. This rule can be relaxed, you can, for example, say that two different classifications are equivalent, and neither is favored, if absolute difference between their predicted probabilities is not more then some $\varepsilon$.

If you have equivalent classifications you can do a number of things: take one at random, take both, take neither, classify them as having multiple categories etc. Notice that the decision rule you choose will have consequences for your further actions. For example, if you output multiple classifications you have to deal with the fact that you are no longer in the black-and-white world, where every object is uniquely classified. This may, or may not, be acceptable for you.

On another hand, in real life, things are often not black-and-white. Using your example, if someone says "Football is a great hobby, the same as basketball!", will you classify it as football, basketball, or as something else? If as both, how would you deal with dual labels? If you would classify it as not found, then would it be a reasonable to decide that if someone likes football and basketball, you cannot tell if he likes football? Those are the decisions that you have to make depending on what is your data and you want to achieve with it. There is no single good answer for such problems.

$\endgroup$

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.