Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
g committed May 13, 2016
1 parent 4041929 commit 0553b5b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions vdiscover/Recall.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions vdiscover/Utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0553b5b

Please sign in to comment.