Permalink
Browse files

Added binary flag to other classifiers

  • Loading branch information...
1 parent d9d435b commit 8b77632a6a031271bb4971ea5dd272169e4418c9 @pranjalv123 pranjalv123 committed Jan 20, 2012
Showing with 3 additions and 3 deletions.
  1. +3 −3 classifier.py
View
@@ -184,11 +184,11 @@ def validate(self, n):
print self.data
outp = self.svm.cv(self.data, numFolds = n)
print outp
- def classify(self, pt):
+ def classify(self, pt, binary = False):
self.compile()
f = tempfile.NamedTemporaryFile(delete=False)
fname = f.name
- f.write(self.vectorToString(pt, binary = self.binary))
+ f.write(self.vectorToString(pt, binary = binary))
f.close()
data = SparseDataSet(fname)
os.remove(fname)
@@ -222,7 +222,7 @@ def compile(self):
#self.model.train(100, 'gis', 2)
print "> Models trained"
- def classify(self, point, label='1'):
+ def classify(self, point, label='1', binary=False):
result = self.model.eval(point.keys(), label)
if result >= 0.5:
return 1

0 comments on commit 8b77632

Please sign in to comment.