From a1c2580027ddede98be42d10e69b7fb0cda61698 Mon Sep 17 00:00:00 2001 From: Alexander Mattick Date: Sun, 25 Dec 2022 13:42:59 +0100 Subject: [PATCH] added utility functions to dataclass --- scripts/postprocessing/scoring.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/scripts/postprocessing/scoring.py b/scripts/postprocessing/scoring.py index 47d85f3e..96af9a11 100644 --- a/scripts/postprocessing/scoring.py +++ b/scripts/postprocessing/scoring.py @@ -32,8 +32,18 @@ class Voter: def voter_quality(self): return self.num_good_votes / self.num_votes - def is_well_behaved(self, threshhold): - return self.voter_quality() > threshhold + def rank_quality(self): + return self.num_good_rankings / self.num_rankings + + def prompt_quality(self): + return self.num_good_prompts / self.num_prompts + + def is_well_behaved(self, threshhold_vote, threshhold_prompt, threshhold_rank): + return ( + self.voter_quality() > threshhold_vote + and self.prompt_quality() > threshhold_prompt + and self.rank_quality() > threshhold_rank + ) def total_points(self, voting_weight, prompt_weight, ranking_weight): return (