From 93150f6e6030d08fa49d8525c3563297096b9c33 Mon Sep 17 00:00:00 2001 From: Ramanakumar Sankar Date: Thu, 27 Jul 2023 18:17:50 -0500 Subject: [PATCH] fixing skill calculation for extracts that do not have feedback or difficulty data --- panoptes_aggregation/reducers/user_skill_reducer.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/panoptes_aggregation/reducers/user_skill_reducer.py b/panoptes_aggregation/reducers/user_skill_reducer.py index 04c62011..b780ccf3 100644 --- a/panoptes_aggregation/reducers/user_skill_reducer.py +++ b/panoptes_aggregation/reducers/user_skill_reducer.py @@ -66,6 +66,11 @@ def user_skill_reducer(extracts, relevant_reduction=[], mode='binary', null_clas - level_up : bool flag to show whether the user should be leveled up using the input thresholds ''' + extracts = [extracti for extracti in extracts if 'feedback' in extracti.keys()] + relevant_reduction = [redi for redi in relevant_reduction if 'difficulty' in redi['data'].keys()] + + assert len(extracts) == len(relevant_reduction), f"mismatch in length of extract ({len(extracts)}) and subject difficulty ({len(relevant_reduction)}) arrays!" + # confusion_simple, confusion_subject = get_confusion_matrix(extracts, relevant_reduction, mode, None) confusion_simple, confusion_subject, classes = get_confusion_matrix(extracts, relevant_reduction, mode, null_class)