Skip to content
Browse files

Normalize probdist of P(fname=fval|0, fname), since we are setting ne…

…gative values to zero
  • Loading branch information...
1 parent b4ff33a commit 7856897e26e189aead2469d161ce81d193882c75 @apresta apresta committed Feb 19, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 nltk/classify/positivenaivebayes.py
View
3 nltk/classify/positivenaivebayes.py
@@ -100,7 +100,8 @@ def train(positive_featuresets, unlabeled_featuresets, positive_prob_prior=0.5,
feature_probdist[True, fname].prob(fval)) \
/ negative_prob_prior
negative_feature_probs[fval] = max(prob, 0.0)
- feature_probdist[False, fname] = DictionaryProbDist(negative_feature_probs)
+ feature_probdist[False, fname] = DictionaryProbDist(negative_feature_probs,
+ normalize=True)
return PositiveNaiveBayesClassifier(label_probdist, feature_probdist)

0 comments on commit 7856897

Please sign in to comment.
Something went wrong with that request. Please try again.