This is due to the Laplace smoothening. If I understand correctly, you want the 
classification to fail if there is a new feature value (e.g., a word that is 
not in the vocabulary when you are doing text classification)?

You can set the alpha parameter to 0 (see 
http://scikit-learn.org/stable/modules/generated/sklearn.naive_bayes.MultinomialNB.html#sklearn.naive_bayes.MultinomialNB)
 which would disable the Laplace smoothening.

Best,
Sebastian Raschka

> On Sep 3, 2014, at 6:20 AM, Karimkhan Pathan <[email protected]> wrote:
> 
> I have trained my classifier using 20 domain datasets using  MultinomialNB. 
> And it is working fine for these 20 domains. 
> 
> Issue is, if I make query which contains text which does not belongs to any 
> of these 20 domain, even it gives classification result. 
> 
> Is it possible that if query does not belongs to any of 20 domain, it should 
> get probability value 0? 
> ------------------------------------------------------------------------------
> Slashdot TV.  
> Video for Nerds.  Stuff that matters.
> http://tv.slashdot.org/
> _______________________________________________
> Scikit-learn-general mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to