From 0553b5b6382201420b44bce5a8fad2df645896aa Mon Sep 17 00:00:00 2001 From: g Date: Fri, 13 May 2016 11:26:03 +0200 Subject: [PATCH] fixes --- vdiscover/Recall.py | 5 +++-- vdiscover/Utils.py | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/vdiscover/Recall.py b/vdiscover/Recall.py index 0a51a14..fe0396b 100644 --- a/vdiscover/Recall.py +++ b/vdiscover/Recall.py @@ -28,11 +28,12 @@ def Recall(model_file, in_file, in_type, out_file, test_mode, probability=False) if test_mode == "simple": nclasses = len(set(test_classes)) + one_class = int(test_classes[0]) if nclasses == 1: err = [None, None] - err[test_classes[0]] = recall_score(test_classes, predicted_classes, average=None)[0] - err[1 - test_classes[0]] = 1.0 + err[one_class] = recall_score(test_classes, predicted_classes, average=None)[one_class] + err[1 - one_class] = err[one_class] else: err = recall_score(test_classes, predicted_classes, average=None) diff --git a/vdiscover/Utils.py b/vdiscover/Utils.py index 52ea72e..91ecf48 100644 --- a/vdiscover/Utils.py +++ b/vdiscover/Utils.py @@ -121,13 +121,13 @@ def read_traces(train_file, nsamples, cut=None, maxsize=50): if nsamples is None: for i,col in enumerate(csvreader): - if len(col) < 2: + if len(col) < 2 or len(col) > 3: print "Ignoring line", i, ":", "\t".join(col) continue program = col[0] features = col[1] - if len(col) > 2: + if len(col) == 3: cl = str(col[2]) #int(col[2]) else: cl = -1