<jupyter_start><jupyter_text>Conditional Probability & Bayes Rule Quiz P( C )	0.105	P( ~C  )	0.895		P(P|C)	0.905	P(N|C)	0.095		P(P|~C)	0.204	P(N|~C)	0.796							P(P)	P(P|C)*P( C )		0.095025		0.277605	P(P|~C)*P(~C)		0.18258							P(N)	P(N|C)*P( C )		0.009975		0.722395	P(N|~C)*P(~C)		0.71242							P(C|P)	P(P|C)	P( C )	0.342302912			P(P)									P(~C|P)	P(P|~C)	P(~C)	0.657697088			P(P)														P(C|N)	P(N|C)	P( C )	0.013808235			P(N)														P(~C|N)	P(N|~C)	P(~C)	0.986191765			P(N)<jupyter_code># load dataset
import pandas as pd
import numpy as np

df = pd.read_csv('cancer_test_data.csv')
df.head()
# What proportion of patients who tested positive has cancer?
print('proportion of patients who tested positive has cancer {}'.format(df[df['test_result'] == 'Positive'].has_cancer.value_counts(normalize='True')[True]))
# What proportion of patients who tested positive doesn't have cancer?
print('proportion of patients who tested positive doesn\'t have cancer {}'.format(df[df['test_result'] == 'Positive'].has_cancer.value_counts(normalize='True')[False]))
# What proportion of patients who tested negative has cancer?
print('proportion of patients who tested negative has cancer {}'.format(df[df['test_result'] == 'Negative'].has_cancer.value_counts(normalize='True')[True]))
# What proportion of patients who tested negative doesn't have cancer?
print('proportion of patients who tested negative doesn\'t have cancer {}'.format(df[df['test_result'] == 'Negative'].has_cancer.value_counts(normalize='True')[False]))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1672005124919923, 'fraction_numerical': 0.06662395900064061, 'mean_word_length': 4.850187265917603, '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': '478444', 'license': 'Apache-2.0', 'n_tokens_mistral': 742, 'n_tokens_neox': 621, 'n_words': 148, 'path': 'conditional_probability_bayes_rule.ipynb', 'repo_name': 'mohamedmahmed/ada_probability_practice', 'size': '1561'}