Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Bayes is BAE

Bayes is BAE

Before programming, before formal probability there was Bayes. He introduced the notion that multiple uncertain estimates which are related could be combined to form a more certain estimate. It turns out that this extremely simple idea has a profound impact on how we write programs and how we can think about life. The applications range from machine learning and robotics to determining cancer treatments. In this talk we'll take an in depth look at Bayses rule and how it can be applied to solve problems in programming and beyond.

Richard Schneeman

May 08, 2017
Tweet

More Decks by Richard Schneeman

Other Decks in Science

Transcript

  1. Divine Benevolence, or an Attempt to Prove That the Principal

    End of the Divine Providence and Government is the Happiness of His Creatures
  2. &

  3. An Introduction to the Doctrine of Fluxions, and a Defence

    of the Mathematicians Against the Objections of the Author of The Analyst
  4. No

  5. SSL

  6. P(B) = H H H T probability of heads P(B)

    = 0.5 * 0.5 + 0.5 * 1 0.75 P(B) =
  7. P(A) = P(A ∣ B) = P(B ∣ A) P(A)

    P(B) 0.75 probability of $3.7 million
  8. P(A ∣ B) = P(B ∣ A) P(A) P(B) P(B

    ∣ A) = 0.75 0.50 probability of heads given $3.7
  9. P(B ∣ A) = 0.5 P(A ∣ B) = P(B

    ∣ A) P(A) P(B) 0.75 0.5 * 0.5
  10. $3.7 mil given Heads P(A ∣ B) = P(B ∣

    A) P(A) P(B) 0.75 0.5 * 0.5 P(A ∣ B) = 1 3 = 0.3333
  11. P(Ai ∣ B) = P(B ∣ Ai ) P(Ai )

    ∑ j P(B ∣ Aj ) P(Aj )
  12. P(A ∣ B) = P(B ∣ A) P(A) P(B) P(Ai

    ∣ B) = P(B ∣ Ai ) P(Ai ) ∑ j P(B ∣ Aj ) P(Aj )
  13. P(Hea d s) = P(Hea d s ∣ $$$)P($$$) +

    P(Hea d s ∣ $0)P($0) $3.7 mil $0 Heads Tails
  14. $3.7 mil $0 P(Hea d s) = P(Hea d s

    ∣ $$$)P($$$) + P(Hea d s ∣ $0)P($0) Heads Tails
  15. P(B) = H H H T probability of heads P(B)

    = 0.5 * 0.5 + 0.5 * 1 0.75 P(B) =
  16. P(B) = ∑ j P(B ∣ Aj ) P(Aj )

    P(Hea d s) = P(Hea d s ∣ $$$)P($$$) + P(Hea d s ∣ $0)P($0) Total Probability
  17. P(Ai ∣ B) = P(B ∣ Ai ) P(Ai )

    ∑ j P(B ∣ Aj ) P(Aj )
  18. P(Coini ∣ HH ) = P(HH ∣ Coini ) P(Coini

    ) ∑ j P(HH ∣ Coinj ) P(Coinj )
  19. P(Coini ∣ HH ) = P(HH ∣ Coini ) P(Coini

    ) ∑ j P(HH ∣ Coinj ) P(Coinj ) P(HH ∣ Coini ) = 0.5 * 0.5
  20. P(Coini ∣ HH ) = P(HH ∣ Coini ) P(Coini

    ) ∑ j P(HH ∣ Coinj ) P(Coinj ) 0.5 P(Coini ) =
  21. P(Coini ∣ HH ) = P(HH ∣ Coini ) P(Coini

    ) ∑ j P(HH ∣ Coinj ) P(Coinj ) ∑ j P(B ∣ Aj ) P(Aj ) = P(HH ∣ $$$)P($$$) + P(HH ∣ $0)P($0) ∑ j P(B ∣ Aj ) P(Aj ) = 0.25(0.5) + 1.0(0.5)
  22. P(Coini ∣ HH ) = P(HH ∣ Coini ) P(Coini

    ) ∑ j P(HH ∣ Coinj ) P(Coinj ) ∑ j P(B ∣ Aj ) P(Aj ) = P(HH ∣ $$$)P($$$) + P(HH ∣ $0)P($0) ∑ j P(B ∣ Aj ) P(Aj ) = 0.25(0.5) + 1.0(0.5)
  23. P(Coin$$$ ∣ HH ) = 0.25(0.5) 0.625 = 1 5

    = 0.2 P(Coini ∣ HH ) = P(HH ∣ Coini ) P(Coini ) ∑ j P(HH ∣ Coinj ) P(Coinj )
  24. P(Coin$$$ ∣ HH ) = 0.25(0.5) 0.625 = 1 5

    = 0.2 P(Coini ∣ HH ) = P(HH ∣ Coini ) P(Coini ) ∑ j P(HH ∣ Coinj ) P(Coinj )
  25. P(Coini ∣ HH ) = 0.25(0.5) 0.625 = 1 5

    = 0.2 P(Coini ∣ HH ) = P(HH ∣ Coini ) P(Coini ) ∑ j P(HH ∣ Coinj ) P(Coinj )
  26. P(A ∣ B) = P(B ∣ A) P(A) P(B) P(Ai

    ∣ B) = P(B ∣ Ai ) P(B) P(Ai )
  27. for k in range(10): measure = measure_array[k] # Predict x_guess

    = a * x_guess p = a * p * a # Update gain = p / (p + r) x_guess = x_guess + gain * (measure - x_guess)
  28. for k in range(10): measure = measure_array[k] # Predict x_guess

    = a * x_guess p = a * p * a # Update gain = p / (p + r) x_guess = x_guess + gain * (measure - x_guess) Low Predict Error, low gain
  29. for k in range(10): measure = measure_array[k] # Predict x_guess

    = a * x_guess p = a * p * a # Update gain = p / (p + r) x_guess = x_guess + 0 * (measure - x_guess) Low Predict Error, low gain
  30. for k in range(10): measure = measure_array[k] # Predict x_guess

    = a * x_guess p = a * p * a # Update gain = p / (p + r) x_guess = x_guess + 0 * (measure - x_guess) Low Predict Error, low gain
  31. for k in range(10): measure = measure_array[k] # Predict x_guess

    = a * x_guess p = a * p * a # Update gain = p / (p + r) x_guess = x_guess + 1 * (measure - x_guess) High Predict Error, High gain
  32. for k in range(10): measure = measure_array[k] # Predict x_guess

    = a * x_guess p = a * p * a # Update gain = p / (p + r) x_guess = x_guess + 1 * (measure - x_guess) High Predict Error, High gain
  33. for k in range(10): measure = measure_array[k] # Predict x_guess

    = a * x_guess p = a * p * a # Update gain = p / (p + r) x_guess = x_guess + gain * (measure - x_guess) p = (1 - g) * p
  34. BAE

  35. BAE

  36. BAE

  37. BAE