Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions 2016-11_Seminar/Session 3 - Relation CNN/code/CNN.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def getPrecision(pred_test, yTest, targetLabel):

f1Sum = 0
f1Count = 0
for targetLabel in xrange(1, max(yTest)):
for targetLabel in xrange(1, max(yTest)+1):
prec = getPrecision(pred_test, yTest, targetLabel)
rec = getPrecision(yTest, pred_test, targetLabel)
f1 = 0 if (prec+rec) == 0 else 2*prec*rec/(prec+rec)
Expand All @@ -143,4 +143,4 @@ def getPrecision(pred_test, yTest, targetLabel):

macroF1 = f1Sum / float(f1Count)
max_f1 = max(max_f1, macroF1)
print "Non-other Macro-Averaged F1: %.4f (max: %.4f)\n" % (macroF1, max_f1)
print "Non-other Macro-Averaged F1: %.4f (max: %.4f)\n" % (macroF1, max_f1)