{
"version": "1",
"metadata": {
"marimo_version": "0.23.3",
"script_metadata_hash": null
},
"cells": [
{
"id": "Hbol",
"code_hash": "e238d786bb62a06c07450dfbac87a566",
"outputs": [
{
"type": "data",
"data": {
"text/plain": ""
}
}
],
"console": []
},
{
"id": "MJUe",
"code_hash": "0fa01e2b9524c22d32e81c353f6d2c43",
"outputs": [
{
"type": "data",
"data": {
"text/markdown": "Bayes' Theorem: Updating Beliefs with Evidence
\nBayes' Theorem is a fundamental concept in probability theory that helps us update our beliefs based on new evidence.\nThe formula is:\n$||(P(A|B) = \nrac{P(B|A)P(A)}{P(B)}||)$\nWhere:\n\n- ||(P(A|B)||) is the posterior probability: the probability of event A given that B occurred
\n- ||(P(B|A)||) is the likelihood: the probability of observing B given that A is true
\n- ||(P(A)||) is the prior probability: our initial belief about A before seeing B
\n- ||(P(B)||) is the evidence: the overall probability of observing B
\n
"
}
}
],
"console": []
},
{
"id": "vblA",
"code_hash": "c9e1e66d44b3c17a7882a8b80ef41e2e",
"outputs": [
{
"type": "data",
"data": {
"text/markdown": "Medical Testing Example
\nLet's say we're testing for a rare disease:\n\n- Prevalence (prior probability): 0.1% of the population has the disease
\n- Test accuracy:
\n- If you have the disease, the test correctly identifies it 99% of the time (true positive rate)
\n- If you don't have the disease, the test incorrectly says you do 5% of the time (false positive rate)
\n
\n \n
\nWhat's the probability that someone who tests positive actually has the disease?"
}
}
],
"console": []
},
{
"id": "bkHC",
"code_hash": "f43af12daae0fc2b4b02e4a47de73c57",
"outputs": [
{
"type": "data",
"data": {
"text/markdown": "Given:\n\n- Prior probability of disease: 0.1%
\n- Sensitivity (true positive rate): 99.0%
\n- False positive rate: 5.0%
\n
\nUsing Bayes' theorem:\nP(Disease|Test+) = [P(Test+|Disease) \u00d7 P(Disease)] / P(Test+)\nP(Test+) = P(Test+|Disease) \u00d7 P(Disease) + P(Test+|No Disease) \u00d7 P(No Disease)\nP(Test+) = 0.99 \u00d7 0.001 + 0.05 \u00d7 0.999\nP(Test+) = 0.0509\nP(Disease|Test+) = (0.99 \u00d7 0.001) / 0.0509 = 0.019\nOnly 1.9% of people who test positive actually have the disease!"
}
}
],
"console": []
},
{
"id": "lEQa",
"code_hash": "0945116d7539b44c0a5f8141266727b2",
"outputs": [
{
"type": "data",
"data": {
"text/html": ""
}
}
],
"console": []
},
{
"id": "PKri",
"code_hash": "a9f080ba5ad2d0c9d8a454b3258bfda1",
"outputs": [
{
"type": "data",
"data": {
"text/markdown": "Why This Matters
\nThis example shows why Bayes' Theorem is important:\n\n- High false positive rate combined with low prevalence leads to counterintuitive results
\n- 95% accurate tests can still give misleading results when the condition is rare
\n- Bayes' Theorem forces us to think about:
\n- Our initial beliefs (prior probability)
\n- How likely we are to observe evidence given our beliefs
\n- How to update our beliefs in light of new evidence
\n
\n \n
\nThis same logic applies to:\n\n- Spam detection
\n- Financial risk assessment
\n- Scientific hypothesis testing
\n- Machine learning classification
\n
"
}
}
],
"console": []
},
{
"id": "WyvZ",
"code_hash": null,
"outputs": [
{
"type": "data",
"data": {
"text/plain": ""
}
}
],
"console": []
},
{
"id": "IAFF",
"code_hash": null,
"outputs": [],
"console": []
}
]
}