Datasets:
Download code/math_code_010_solution.py from efe-T/bilingual-math-code-verification-v1: direct link, hf CLI and curl.
- Browser
- Download file 521 Bytes
-
https://huggingface.co/datasets/efe-T/bilingual-math-code-verification-v1/resolve/main/code/math_code_010_solution.py
- Command line
-
hf download hf://datasets/efe-T/bilingual-math-code-verification-v1/code/math_code_010_solution.py
-
curl -L -o math_code_010_solution.py https://huggingface.co/datasets/efe-T/bilingual-math-code-verification-v1/resolve/main/code/math_code_010_solution.py
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)) | |