Exemple #1
0
 def repeated_item_probability(self, item, category):
     item_feature_count = Counter(get_words(item))
     p = 1.
     for f, c in item_feature_count.iteritems():
         # this doesn't make sense unless you're trying to compare the probabilities for numerouse vs single occurences of a feature
         p *= pow(self.weighted_feature_probability(f, category), c)
     return p
Exemple #2
0
 def repeated_item_probability(self, item, category):
     item_feature_count = Counter(get_words(item))
     p = 1.
     for f, c in item_feature_count.iteritems():
         # this doesn't make sense unless you're trying to compare the probabilities for numerouse vs single occurences of a feature
         p *= pow(self.weighted_feature_probability(f, category), c)
     return p
Exemple #3
0
 def item_probability(self, item, category):
     item_features = set(get_words(item))
     p = 1.
     for f in item_features:
         p *= self.weighted_feature_probability(f, category)
     return p
Exemple #4
0
 def item_probability(self, item, category):
     item_features = set(get_words(item))
     p = 1.
     for f in item_features:
         p *= self.weighted_feature_probability(f, category)
     return p