Skip to content

Commit

Permalink
Fixed esvm at easysvm
Browse files Browse the repository at this point in the history
  • Loading branch information
lisitsyn committed Aug 31, 2011
1 parent be81d77 commit 2e4b2b5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
6 changes: 3 additions & 3 deletions applications/easysvm/esvm/experiment.py
Expand Up @@ -182,8 +182,8 @@ def create_features(kname, examples, kparam, train_mode, preproc, seq_source, nu
if train_mode:
preproc = SortWordString()
preproc.init(wf)
wf.add_preproc(preproc)
ret = wf.apply_preproc()
wf.add_preprocessor(preproc)
ret = wf.apply_preprocessors()
assert(ret)
feats['combined'].append_feature_obj(wf)
feats['f0'] = wf
Expand Down Expand Up @@ -354,7 +354,7 @@ def train_and_test(trainex,trainlab,testex,C,kname,kparam, seq_source, nuc_con):
kernel.init(feats_train, feats_test)

kernel.set_optimization_type(SLOWBUTMEMEFFICIENT)
output = svm.classify().get_labels()
output = svm.apply().get_labels()

return output

Expand Down
10 changes: 6 additions & 4 deletions applications/easysvm/esvm/utils.py
Expand Up @@ -52,17 +52,19 @@ def accuracy(output, labels_test):

def calcroc(output, LTE):
"""The area under the receiver operating characteristic curve"""
pm=PerformanceMeasures(Labels(numpy.array(LTE)), Labels(numpy.array(output)))
pm=ROCEvaluation()
pm.evaluate(Labels(numpy.array(output)), Labels(numpy.array(LTE)))

auROC=pm.get_auROC()
return auROC ;
return auROC

def calcprc(output, LTE):
"""The area under the precision recall curve"""
pm=PerformanceMeasures(Labels(numpy.array(LTE)), Labels(numpy.array(output)))
pm=PRCEvaluation()
pm.evaluate(Labels(numpy.array(output)), Labels(numpy.array(LTE)))

auPRC=pm.get_auPRC()
return auPRC ;
return auPRC


def calcperf(output, LTE, perflist):
Expand Down

0 comments on commit 2e4b2b5

Please sign in to comment.