Feb 20: Bayes' Rule, Expectation and Variance
How we design this course 1. Learning goals 2. Homework that tests learning goals 3. Lectures and sessions that provide tools to do homework that tests learning goals if something seems hard, look for the hidden clues! Source: Nintendo, shacknews.com
How to stay out of trouble on homework Integrity: ... You may discuss homework problems, but you have to write your own answers by yourself. You may consult online forums or look at examples, but you cannot copy text or code from them. You are not helping your friend by allowing them to not learn. ...
Contingency tables red blue circle square
Normalize to joint probability P(Shape, Color) red blue red blue circle circle 1/3 1/4 square square 1/6 1/4
Normalize to joint probability P(Shape, Color) red blue red blue circle circle 1/3 1/4 square square 1/6 1/4 "Normali{e" = Divide everything by the total sum
Normalization loses information red blue circle 1/3 1/4 square 1/6 1/4
Normalization loses information red blue red blue circle circle 1/3 1/4 square square 1/6 1/4
Normalization loses information red blue red blue circle circle 1/3 1/4 square square 1/6 1/4
Normalization loses information red blue red blue circle circle 1/3 1/4 square square 1/6 1/4 Tiree free Four free parameters parameters
Marginal probabilities sum over one axis Axis 1 P(S,C) red blue P(S) Axis 0 circle circle 7/12 square square 5/12 P(C) red blue 6/12 6/12
Divide joint by marginal to get conditionals red blue circle 1/3 1/4 square 1/6 1/4 / red blue 1/2 1/2 = red blue cir 2/3 cir 1/2 cle cle "Normali{e" = Divide everything by the total sum squ 1/3 squ 1/2 are are
Divide joint by marginal to get conditionals red blue circle 1/3 1/4 P(Shape, Color) square 1/6 1/4 / P(Color) red blue = 1/2 1/2 = red blue P(Shape | Color) cir 2/3 cir 1/2 cle cle "Given" squ 1/3 squ 1/2 are are
Which is larger? P(Shape=square, Color=blue) or P(Shape=square | Color=blue)
Multiply conditionals by marginal to get joint red blue P(Shape, Color) circle 1/3 1/4 square 1/6 1/4 = = red blue 1/2 1/2 P(Shape | Color) P(Color) * red blue cir 2/3 cir 1/2 cle cle squ 1/3 squ 1/2 are are
Divide by marginal going the other way red blue red blue = circle 1/3 1/4 circle 7/12 circle 4/7 3/7 / square 5/12 square 1/6 1/4 red blue square 2/5 3/5
Divide by marginal going the other way red blue red blue = circle 1/3 1/4 circle 7/12 circle 4/7 3/7 / square 5/12 square 1/6 1/4 red blue square 2/5 3/5 P(Shape, Color) = P(Color | Shape) P(Shape)
Bayes' Rule! red blue red blue = circle 1/3 1/4 circle 7/12 circle 4/7 3/7 / square 5/12 square 1/6 1/4 red blue = square 2/5 3/5 red blue 1/2 1/2 P(Shape | Color) P(Color) * P(Shape) red blue cir 2/3 cir 1/2 = P(Color | Shape) cle cle squ 1/3 squ 1/2 are are
What we did to load section data Read multiple files from CSV Extract values from filenames with regular expressions Change variable types (int -> string) Extract new variables from existing variables with regular expressions Recode four-value variable to two values Count co-occurrences of two variables (section, grade level)
What does it feel like to have a bug in code? Strange things keep happening, but you will ofuen be able to "explain away" results. At first. TRUST YOUR GUT. BE VIRTUOUS. BE PARANOID.
Recommend
More recommend