Permalink
Browse files

syntax errors, new tests

  • Loading branch information...
1 parent 0cce59d commit a623b810fe0e2ea4d808444e897c8cb888ea94c1 @cathywu committed Jan 20, 2012
Showing with 37 additions and 37 deletions.
  1. +2 −2 classifier.py
  2. +35 −35 movie.py
View
@@ -152,11 +152,11 @@ def vectorToString(self, vec, cls = False, binary=False):
# creates a string of the format "[class if point is labeled] feature1:value1 feature2:value2..."
# where the only allowed features are the ones in restrictFeatures, if we're restricting the features
if binary:
- return ((str(cls) + " ") if cls else "") +
+ return ((str(cls) + " ") if cls else "") + \
" ".join(["-".join(str(i).split()) + ":1"
for i in vec if (not self.restrictFeatures) or
(i in self.restrictFeatures)]) + "\n"
- return ((str(cls) + " ") if cls else "") +
+ return ((str(cls) + " ") if cls else "") + \
" ".join(["-".join(str(i).split()) + ":" + str(vec[i])
for i in vec if (not self.restrictFeatures) or
(i in self.restrictFeatures)]) + "\n"
View
@@ -31,7 +31,7 @@ def __init__(self, clsf, n, ind, pos_dir, neg_dir, test_set=None,
self.limit = limit if limit else [0 for i in n]
self.clsf = clsf
self.idf = idf
- self.test_set = True if test_set else False
+ self.test_set = test_set
self.pos_dir = pos_dir
self.neg_dir = neg_dir
@@ -273,8 +273,8 @@ def test(classif, n=1, train_size=500, mode='k', iterations=1, dataset='',
# dataset='default',extra_dataset=1,limit=[16165],binary=True, idf=False)
#test(classifier.MaximumEntropyClassifier,n=[1],train_size=800,mode='k',iterations=3,
# dataset='default',extra_dataset=1,limit=[16165],binary=False, idf=False)
- test(classifier.LinearSVMClassifier,n=[1],train_size=800,mode='k',iterations=3,
- dataset='default',extra_dataset=1,limit=[16165],binary=True, idf=False)
+ #test(classifier.LinearSVMClassifier,n=[1],train_size=800,mode='k',iterations=3,
+ # dataset='default',extra_dataset=1,limit=[16165],binary=True, idf=False)
#
#test(classifier.BayesClassifier,n=[1],train_size=800,mode='k',iterations=3,
# dataset='default',extra_dataset=1,limit=None,binary=True, idf=False)
@@ -283,40 +283,40 @@ def test(classif, n=1, train_size=500, mode='k', iterations=1, dataset='',
#BORKED#test(classifier.LinearSVMClassifier,n=[1],train_size=800,mode='k',iterations=3,
#BORKED# dataset='default',extra_dataset=1,limit=None,binary=True, idf=False)
- test(classifier.BayesClassifier,n=[2],train_size=800,mode='k',iterations=3,
- dataset='default',extra_dataset=1,limit=[16165],binary=True, idf=False)
- test(classifier.MaximumEntropyClassifier,n=[2],train_size=800,mode='k',iterations=3,
- dataset='default',extra_dataset=1,limit=[16165],binary=False, idf=False)
- test(classifier.LinearSVMClassifier,n=[2],train_size=800,mode='k',iterations=3,
- dataset='default',extra_dataset=1,limit=[16165],binary=True, idf=False)
+ #test(classifier.BayesClassifier,n=[2],train_size=800,mode='k',iterations=3,
+ # dataset='default',extra_dataset=1,limit=[16165],binary=True, idf=False)
+ #test(classifier.MaximumEntropyClassifier,n=[2],train_size=800,mode='k',iterations=3,
+ # dataset='default',extra_dataset=1,limit=[16165],binary=False, idf=False)
+ #test(classifier.LinearSVMClassifier,n=[2],train_size=800,mode='k',iterations=3,
+ # dataset='default',extra_dataset=1,limit=[16165],binary=True, idf=False)
- test(classifier.BayesClassifier,n=[1,2],train_size=800,mode='k',iterations=3,
- dataset='default',extra_dataset=1,limit=[16165,16165],binary=True, idf=False)
- test(classifier.MaximumEntropyClassifier,n=[1,2],train_size=800,mode='k',iterations=3,
- dataset='default',extra_dataset=1,limit=[16165,16165],binary=False, idf=False)
- test(classifier.LinearSVMClassifier,n=[1,2],train_size=800,mode='k',iterations=3,
- dataset='default',extra_dataset=1,limit=[16165,16165],binary=True, idf=False)
+ #test(classifier.BayesClassifier,n=[1,2],train_size=800,mode='k',iterations=3,
+ # dataset='default',extra_dataset=1,limit=[16165,16165],binary=True, idf=False)
+ #test(classifier.MaximumEntropyClassifier,n=[1,2],train_size=800,mode='k',iterations=3,
+ # dataset='default',extra_dataset=1,limit=[16165,16165],binary=False, idf=False)
+ #test(classifier.LinearSVMClassifier,n=[1,2],train_size=800,mode='k',iterations=3,
+ # dataset='default',extra_dataset=1,limit=[16165,16165],binary=True, idf=False)
- test(classifier.BayesClassifier,n=[1],train_size=800,mode='k',iterations=3,
- dataset='partofspeech',extra_dataset=1,limit=None,binary=True, idf=False)
- test(classifier.MaximumEntropyClassifier,n=[1],train_size=800,mode='k',iterations=3,
- dataset='partofspeech',extra_dataset=1,limit=None,binary=False, idf=False)
- test(classifier.LinearSVMClassifier,n=[1],train_size=800,mode='k',iterations=3,
- dataset='partofspeech',extra_dataset=1,limit=None,binary=True, idf=False)
-
- test(classifier.BayesClassifier,n=[1],train_size=800,mode='k',iterations=3,
- dataset='adjectives',extra_dataset=1,limit=None,binary=True, idf=False)
- test(classifier.MaximumEntropyClassifier,n=[1],train_size=800,mode='k',iterations=3,
- dataset='adjectives',extra_dataset=1,limit=None,binary=False, idf=False)
- test(classifier.LinearSVMClassifier,n=[1],train_size=800,mode='k',iterations=3,
- dataset='adjectives',extra_dataset=1,limit=None,binary=True, idf=False)
-
- test(classifier.BayesClassifier,n=[1],train_size=800,mode='k',iterations=3,
- dataset='position',extra_dataset=1,limit=None,binary=True, idf=False)
- test(classifier.MaximumEntropyClassifier,n=[1],train_size=800,mode='k',iterations=3,
- dataset='position',extra_dataset=1,limit=None,binary=False, idf=False)
- test(classifier.LinearSVMClassifier,n=[1],train_size=800,mode='k',iterations=3,
- dataset='position',extra_dataset=1,limit=None,binary=True, idf=False)
+ #test(classifier.BayesClassifier,n=[1],train_size=800,mode='k',iterations=3,
+ # dataset='partofspeech',extra_dataset=1,limit=None,binary=True, idf=False)
+ #test(classifier.MaximumEntropyClassifier,n=[1],train_size=800,mode='k',iterations=3,
+ # dataset='partofspeech',extra_dataset=1,limit=None,binary=False, idf=False)
+ #BORKED#test(classifier.LinearSVMClassifier,n=[1],train_size=800,mode='k',iterations=3,
+ #BORKED# dataset='partofspeech',extra_dataset=1,limit=None,binary=True, idf=False)
+
+ #test(classifier.BayesClassifier,n=[1],train_size=800,mode='k',iterations=3,
+ # dataset='adjectives',extra_dataset=1,limit=None,binary=True, idf=False)
+ #test(classifier.MaximumEntropyClassifier,n=[1],train_size=800,mode='k',iterations=3,
+ # dataset='adjectives',extra_dataset=1,limit=None,binary=False, idf=False)
+ #test(classifier.LinearSVMClassifier,n=[1],train_size=800,mode='k',iterations=3,
+ # dataset='adjectives',extra_dataset=1,limit=None,binary=True, idf=False)
+
+ #test(classifier.BayesClassifier,n=[1],train_size=800,mode='k',iterations=3,
+ # dataset='position',extra_dataset=1,limit=None,binary=True, idf=False)
+ #test(classifier.MaximumEntropyClassifier,n=[1],train_size=800,mode='k',iterations=3,
+ # dataset='position',extra_dataset=1,limit=None,binary=False, idf=False)
+ #BORKED#test(classifier.LinearSVMClassifier,n=[1],train_size=800,mode='k',iterations=3,
+ #BORKED# dataset='position',extra_dataset=1,limit=None,binary=True, idf=False)
#mvc = MajorityVotingTester()
#ind = Indexes(mode='k',iterations=3,train_size=800)

0 comments on commit a623b81

Please sign in to comment.