# Text detection, Naive Bayes: How to rate results?

Is there a way to rate the results provided by Naive Bayes algorithm?

I mean, if NB detects "I love to play football" and label it as "tennis", is there a way to improve the detection by saying to NB "no, it's not tennis".

Same if I want to say "that's correct!" if NB labels it as a football.

I think if a detection is validated by the user, it should make it stronger.

I was thinking about creating a label "not_tennis" and teach it "this is not tennis" when I rate a result as bad.

To say a classification is good, can I simply retrain the model with the same correct sentence?

It is possible to improve the model learned by the Naive Bayes approach by giving it the feedbacks about its operation. You should just consider the feedback as a new training sample. For example, consider that for some input vector $\bf x$, the user says to the system that the correct output is $y$ (this can be equal to or different from the output of the current model). Now, the system has a new training sample $(\textbf{x}, y)$. Since the model learned by NB is nothing but some estimated probabilities, these probabilities can be simply updated based on the new training sample. To be more clear, assume that we have $p$ features $x_1,...,x_p$ and $n$ classes. The model learned by the NB include the prior probabilities of the classes, $p(c_1),\ldots,p(c_n)$ and the likelihood of different features for each class $p(x_1|c_1),p(x_2|c_1),\ldots,p(x_p|c_1),p(x_1|c_2),\ldots,p(x_p|c_n)$. Now that we have a new training sample, we can simply update these probabilities. For example, if the current number of training samples is $m$, and the current prior probability of the correct class is $\frac{m_y}{m}$ it is updated as $\frac{m_y+1}{m+1}$. Likewise, if the current prior probability of another class is $\frac{m_{c_i}}{m}$ for $c_i \neq y$ it is updated as $\frac{m_{c_i}}{m+1}$. The likelihood parameters are also updated in a similar manner by considering $\bf x$ as a new member of class $y$.