Skip to content

Commit c22edb7

Browse files
committed
Warn against dodgy classification
1 parent 71a71e3 commit c22edb7

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

06-Naive-Bayes/general_classifier.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ def p_feature_given_label(self, feature, label):
2525
return self.featurecounts[label][feature] / self.labelcounts[label]
2626

2727
def p_feature(self,feature):
28+
# This function is broken and wrong...
29+
# It makes the assumption that the feature probabilities are class independent
30+
# That's just not the case...
2831
feature_total = 0.0
2932
for label in self.labels:
3033
feature_total += self.featurecounts[label][feature]

0 commit comments

Comments
 (0)