aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGertjan van den Burg <gertjanvandenburg@gmail.com>2019-08-27 14:34:21 +0100
committerGertjan van den Burg <gertjanvandenburg@gmail.com>2019-08-27 14:34:21 +0100
commit2295fb7a65d9f5a94ef616d04423dffde174f3ed (patch)
tree77053f3eacf3910de748aeed35a631640cdeb606 /app
parentAlso report number of false negatives (diff)
downloadAnnotateChange-2295fb7a65d9f5a94ef616d04423dffde174f3ed.tar.gz
AnnotateChange-2295fb7a65d9f5a94ef616d04423dffde174f3ed.zip
Use average F1 score as the demo performance
Diffstat (limited to 'app')
-rw-r--r--app/main/demo.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/app/main/demo.py b/app/main/demo.py
index c922d52..9a85405 100644
--- a/app/main/demo.py
+++ b/app/main/demo.py
@@ -331,18 +331,23 @@ def demo_performance(user_id):
).first()
annotations = (
Annotation.query.join(Task, Annotation.task)
- .filter_by(task_id=task.id)
+ .filter_by(id=task.id)
.all()
)
+
true_cp = get_demo_true_cps(dataset.name)
- user_cp = [a.cp_index for a in annotations]
+ user_cp = [a.cp_index for a in annotations if not a.cp_index is None]
if len(true_cp) == len(user_cp) == 0:
score += 1
continue
- n_correct, n_window, n_fp = metrics(true_cp, user_cp)
- score += (n_correct + n_window - n_fp) / len(true_cp)
- return score / len(DEMO_DATA)
+ n_correct, n_window, n_fp, n_fn = metrics(true_cp, user_cp)
+ n_tp = n_correct + n_window
+ f1 = (2 * n_tp) / (2 * n_tp + n_fp + n_fn)
+
+ score += f1
+ score /= len(DEMO_DATA)
+ return score
def redirect_user(demo_id, phase_id):