1.1 --- a/src/HOL/Tools/Sledgehammer/MaSh/src/naiveBayes.py Tue Dec 04 18:12:30 2012 +0100
1.2 +++ b/src/HOL/Tools/Sledgehammer/MaSh/src/naiveBayes.py Tue Dec 04 18:23:50 2012 +0100
1.3 @@ -16,7 +16,7 @@
1.4
1.5 class NBClassifier(object):
1.6 '''
1.7 - An updatable naive Bayes classifier.
1.8 + An updateable naive Bayes classifier.
1.9 '''
1.10
1.11 def __init__(self):
1.12 @@ -35,7 +35,9 @@
1.13 self.counts[d] = [dPosCount,dFeatureCounts]
1.14
1.15 for key in dicts.dependenciesDict.keys():
1.16 - keyDeps = dicts.dependenciesDict[key]
1.17 + # Add p proves p
1.18 + keyDeps = [key]+dicts.dependenciesDict[key]
1.19 +
1.20 for dep in keyDeps:
1.21 self.counts[dep][0] += 1
1.22 depFeatures = dicts.featureDict[key]
1.23 @@ -103,10 +105,11 @@
1.24 else:
1.25 resultA -= 15
1.26 predictions.append(resultA)
1.27 - expPredictions = array([exp(x) for x in predictions])
1.28 + #expPredictions = array([exp(x) for x in predictions])
1.29 predictions = array(predictions)
1.30 perm = (-predictions).argsort()
1.31 - return array(accessibles)[perm],expPredictions[perm]
1.32 + #return array(accessibles)[perm],expPredictions[perm]
1.33 + return array(accessibles)[perm],predictions[perm]
1.34
1.35 def save(self,fileName):
1.36 OStream = open(fileName, 'wb')