4 ms·
I entered expecting a cool implementation of Bayes through a simple if statement. Instead, I saw Bayes' rule in Haskell, a form that's more idiosyncratic than
by doctorpangloss 14y ago
I entered expecting a cool implementation of Bayes through a simple if statement.
Instead, I saw Bayes' rule in Haskell, a form that's more idiosyncratic than probability expressions.
Simple is in the eye of the beholder. Perhaps making monads isn't actually making Bayes' rule simpler.
- wfunction 14y ago+1 it was actually a rather horrifying presentation of Bayes's theorem. I would just explain it in 2 lines: P(Cause and Effect) = P(Cause) × P(Effect given Cause) = P(Effect) × P(Cause given Effect) so P(Cause) = P(Effect) × P(Cause given Effect) ÷ P(Effect given Cause)
- jhdevos 14y agoNaming it Cause and Effect is misleading; it makes it seem like bayes rule only applies when there is a causal relation somewhere. It also make the symmetry of the first line seem off. I would write the first line as P(A and B are both true) = P (A is true) x P (B is also true, given that we know A is already true) = P (B is true) x P (A is also true, given that we know B is already true)
- wfunction 14y agoI was actually going to write A and B at first, but then realized that wouldn't show the relationship of the formula to the disease example very obviously. I thought it'd be better to make it easier to understand (and more practical) by showing how it helps you infer causes from effects.
- ajanuary 14y agoTwo lines of equations aren't a simple to use programming tool. It's debatable whether TFA achieved that goal, but you certainly didn't.
- pekk 14y agoIt's very easy to turn those simply stated equations into a short program that looks quite similar, without lots of strange metaprogramming going on. As a bonus, others will easily be able to understand and fix or extend the code.
- hollerith 14y agoUnfortunately, "Cause" and "Effect" are actively misleading choices of names here. ("Evidence" and "Hypothesis" on the other hand are frequently used.) ADDED. Explanation: hearing squeaking noises in the night is evidence for the hypothesis that the cheese will have bite marks on it when we look in the morning (in the sense that the squeaking noises increase the probability of the bite-mark hypothesis) even though the squeaking noises do not cause the bite marks nor do the bite marks cause the squeaking noises. You and I know that the squeaking noises and the bite marks have the same underlying cause, but Bayes's rule is useful in situations where cause-and-effect remain unknown. E.g., it can be used by a space alien without knowledge of mice who cannot afford to ponder on the possible causes of the bite marks and the squeaking noises.
- lucian1900 14y agoThe end result is an expression executing Bayes' rule and it is used much like an if expression.
- vidarh 14y agoAs someone who have tried on occasion to get used to Haskell (and failed - Haskell makes me want to claw my eyes out), and who have minimal maths background, I found reading Bayes original paper substantially easier than figuring out the Haskell in that post.
- tristanz 14y agoBayes Theorem can be implemented as an if statement: posterior = [] [observables, unknowns] = simulate_from_model(priors) if observables == observed posterior.push(unknowns) posterior now includes random draws from the posterior p(unknowns|observed). This is my favorite explanation of Bayes statistics since it implements Bayes Theorem without math. It also is the underlying intuition behind the probabilistic programming approach to Bayesian statistics. Rubin (1984) has a great explanation: https://twitter.com/tristanzajonc/status/325120025428119552 https://twitter.com/tristanzajonc/status/325120025428119552
- deleted 14y ago[deleted]
- deleted 14y ago[deleted]