Skip to content
This repository
Browse code

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

…gative values to zero
  • Loading branch information...
commit 7856897e26e189aead2469d161ce81d193882c75 1 parent b4ff33a
Alessandro Presta apresta authored

Showing 1 changed file with 2 additions and 1 deletion. Show diff stats Hide diff stats

  1. +2 1  nltk/classify/positivenaivebayes.py
3  nltk/classify/positivenaivebayes.py
@@ -100,7 +100,8 @@ def train(positive_featuresets, unlabeled_featuresets, positive_prob_prior=0.5,
100 100 feature_probdist[True, fname].prob(fval)) \
101 101 / negative_prob_prior
102 102 negative_feature_probs[fval] = max(prob, 0.0)
103   - feature_probdist[False, fname] = DictionaryProbDist(negative_feature_probs)
  103 + feature_probdist[False, fname] = DictionaryProbDist(negative_feature_probs,
  104 + normalize=True)
104 105
105 106 return PositiveNaiveBayesClassifier(label_probdist, feature_probdist)
106 107

0 comments on commit 7856897

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