1
$\begingroup$

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?

$\endgroup$
0
+50
$\begingroup$

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$.

$\endgroup$
  • $\begingroup$ Thanks for your reply Hossein. I should have been more explicit, what I'm trying to do is to rate "good" or "bad" a sentence that has a high probability. If I say good, the probability should be increased, else, the probability should be decreased. Adding a new training sample won't do the job will it? $\endgroup$ – Vico Mar 30 '17 at 20:41
  • $\begingroup$ Yes, it will do it. If you rate the response as "good", the mentioned process causes the prior probabilities and the likelihoods are changed in a way that the probability of the detected class for this sample is increased and the probabilities of other classes are decreased. On the other hand, if you say that the response is "bad" and determine the desired response for that sample, it will increase the probability of the true class for that sample and reduce the probabilities of other classes. Hope it is clear. $\endgroup$ – Hossein Mar 30 '17 at 21:39
  • $\begingroup$ Since I'm doing text detection (like trying to figure out if a sentence is related to a subject), if the probability is below 0.8, I decide the sentence is not assigned to any label. So if I understand properly, what you suggest when someone rate the answer as "bad" is to assign this sentence to a new label called "incorrect". Must I create an "incorrect" label for each label (eg: meditation_incorrect, football_incorrect) etc. or just one global is fine? $\endgroup$ – Vico Mar 31 '17 at 5:54
  • $\begingroup$ You can assign it to a new class, which I prefer to call it "unsure". But, it is better to assign this sample to its correct class, for example, the "football" class in your example. $\endgroup$ – Hossein Mar 31 '17 at 7:20
0
$\begingroup$

The NB prediction is based on the distribution of your training data. To improve your model you should add the new corrected data. Simply put, as your NB model is a function of your training data, to improve your model, just add more correct data and retrain using the 'old + new' data.

$\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.