<jupyter_start><jupyter_text>The doctor has bad news and good news for X. The bad news is that X tested positive for a serious disease, and that the test is 99% accurate (i.e., the probability of testing positive given that you have the disease is 0.99, as is the probability of testing negative given that you don’t have the disease). The good news is that this is a rare disease, striking only one in 10,000 people. Why is it good news that the disease is rare? What are the chances that X actually has the disease?<jupyter_code>p_pos_given_dis = 0.99
p_pos_given_dis_not = 1 - p_pos_given_dis
p_neg_given_dis = 0.99

p_dis = 1 / 10000
p_dis_not = 1 - p_dis

p_pos = p_pos_given_dis * p_dis + p_pos_given_dis_not * p_dis_not

p_dis * p_pos_given_dis / p_pos<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.05449936628643853, 'fraction_numerical': 0.030418250950570342, 'mean_word_length': 4.563380281690141, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '591667', 'license': 'MIT', 'n_tokens_mistral': 289, 'n_tokens_neox': 261, 'n_words': 113, 'path': 'probabilistic-graphical-models/bayes-rule.ipynb', 'repo_name': 'ashishpatel26/learning', 'size': '789'}