bilingual-math-code-verification-v1 / code /math_code_010_solution.py
efe-T's picture
Upload folder using huggingface_hub
93237a0 verified
Raw History Blame Contribute Delete
521 Bytes
from fractions import Fraction
prior = Fraction(1, 50)
sensitivity = Fraction(19, 20)
false_positive = Fraction(1, 10)
def posterior(positives):
good_evidence = prior * sensitivity ** positives
other_evidence = (1 - prior) * false_positive ** positives
return good_evidence / (good_evidence + other_evidence)
one, two = posterior(1), posterior(2)
assert 0 < one < two < 1
result = {"one_positive": str(one), "two_positives": str(two)}
import json
print(json.dumps(result, ensure_ascii=False, sort_keys=True))