in rules/ruleset.py [0:0]
def pass_threshold(r, stats: ConfusionMatrix):
num_pos = stats.pos_df.shape[0]
num_total = stats.df.shape[0]
ratio_whole = num_pos / num_total
min_support = math.sqrt(num_pos) / num_total
tps = stats.true_positive(r)
num_tp = len(tps)
exceeds_min_support = num_tp / stats.df.shape[0] >= min_support
if not exceeds_min_support:
return False
cur_tpr = stats.get_tp_ratio(r)
diff = cur_tpr - ratio_whole
if diff < cfg.rule_relevance_threshold:
return False
cur_coverage = stats.get_coverage_ratio(r)
return cur_coverage > cfg.rule_coverage_threshold