## Let's Bayesian thinking
---
## Bayesian Methods for Hackers ch1-2
- Present: Dragon Chen
- Date: 09/18
---
## Intro
- Title: Bayesian Methods for Hackers
- Github: [這](https://github.com/CamDavidsonPilon/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers)(qsirch 上也有 pdf)

----
- You are a **skilled programmer**, but bugs still slip into your code.
- After a particularly difficult implementation of an algorithm, you decide to **test your code** on a trivial example.
----
- It passes. You test the code on a harder problem.
- It passes once again. And it passes the next, even more difficult, test too!
- You are **starting to believe** that there may be no bugs in this code. . .
----
## You already are thinking Bayesian!
Bayesian inference is simply **updating your beliefs** after considering new **evidence**
---
## Bayesian Worldview
----
- Bayesian worldview interprets probability as measure of believability in an event
<span><!-- .element: class="fragment" -->==How confident we are in an event occurring==</span>
----
### versus Frequentists
- Frequentist assume probability is the long-run frequency of events
- *Probability of plane accidents* under a frequentist philosophy is interpreted as the *long-term frequency of plane accidents*
----
### Belief
- Bayesians interpret a probability as the measure of belief, or confidence, in an event occurring.
- An individual assigns belief of p(probability) to an event
- The definition leaves room for conflicting **beliefs between individuals**
----
### Different Belief
- Different individuals have different beliefs of events occurring because they possess different information about the world.
- The existence of different beliefs does not imply that anyone is wrong.
---
## Procedure
### Coin Example
- I flip a coin. We assume the coin is fair, that the probability of heads is 0.5. Assume, then, that I peek at the coin. Now I know for certain what the result is.
- Now what is your belief that the coin is heads?
----
- Assume the coin is fair, prob is 0.5
- We denote our belief about event A as P(A)
- We call this quantity the **prior probability**
"When the facts change, I change my mind. What do you do, sir?", John Maynard Keynes
----
- Bayesian updates his/her beliefs after seeing evidence
- We denote our updated belief as P(A|X)
- Prob of A given the evidence X
- We call the updated belief the **posterior probability**
----
- If you flip 1/3/5 coins keep showing head-up, do you still believe the coin is fair?
----

----
The posterior probabilities are represented by the curves, and our uncertainty is proportional to the <font color="red">width of the curve</font>.
----
- We did not **completely discard the prior belief** after seeing new evidence X, but we **re-weighted the prior** to incorporate the **new evidence**
---
## Else Detail
- N → ∞, our Bayesian results (often) align with frequentist results
- For small N, inference is much more unstable
---
## Some Detail of PyMC

----

----

---
### Thank you for listening! :dragon:
{"metaMigratedAt":"2023-06-15T12:58:18.125Z","metaMigratedFrom":"YAML","title":"Bayesian methods for Hackers ch1-2","breaks":true,"slideOptions":"{\"theme\":\"serif\",\"transition\":\"slide\"}","contributors":"[{\"id\":\"1155b8f4-1581-4900-adcf-1b4abbb2c7fd\",\"add\":3637,\"del\":2622}]"}