Feb 20: Bayes' Rule, Expectation and Variance How we design this - - PowerPoint PPT Presentation

feb 20 bayes rule expectation and variance how we design
SMART_READER_LITE
LIVE PREVIEW

Feb 20: Bayes' Rule, Expectation and Variance How we design this - - PowerPoint PPT Presentation

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,


slide-1
SLIDE 1

Feb 20: Bayes' Rule, Expectation and Variance

slide-2
SLIDE 2

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

slide-3
SLIDE 3

How to stay out of trouble on homework

Integrity: ... You may discuss homework problems, but you have to write your

  • wn 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. ...

slide-4
SLIDE 4

Contingency tables

red blue circle square

slide-5
SLIDE 5

Normalize to joint probability P(Shape, Color)

red blue circle square red blue circle 1/3 1/4 square 1/6 1/4

slide-6
SLIDE 6

Normalize to joint probability P(Shape, Color)

red blue circle square red blue circle 1/3 1/4 square 1/6 1/4

"Normali{e" = Divide everything by the total sum

slide-7
SLIDE 7

Normalization loses information

red blue circle 1/3 1/4 square 1/6 1/4

slide-8
SLIDE 8

Normalization loses information

red blue circle square red blue circle 1/3 1/4 square 1/6 1/4

slide-9
SLIDE 9

Normalization loses information

red blue circle square red blue circle 1/3 1/4 square 1/6 1/4

slide-10
SLIDE 10

Normalization loses information

red blue circle square red blue circle 1/3 1/4 square 1/6 1/4

Four free parameters Tiree free parameters

slide-11
SLIDE 11

Marginal probabilities sum over one axis

P(S,C) red blue circle square P(S) circle 7/12 square 5/12 P(C) red blue 6/12 6/12 Axis 0 Axis 1

slide-12
SLIDE 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 cir cle 2/3 squ are 1/3 blue cir cle 1/2 squ are 1/2 / =

"Normali{e" = Divide everything by the total sum

slide-13
SLIDE 13

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 cir cle 2/3 squ are 1/3 blue cir cle 1/2 squ are 1/2 / =

P(Shape, Color) P(Color)

=

P(Shape | Color)

"Given"

slide-14
SLIDE 14

Which is larger? P(Shape=square, Color=blue)

  • r

P(Shape=square | Color=blue)

slide-15
SLIDE 15

Multiply conditionals by marginal to get joint

red blue circle 1/3 1/4 square 1/6 1/4 red blue 1/2 1/2 red cir cle 2/3 squ are 1/3 blue cir cle 1/2 squ are 1/2 = *

P(Shape, Color)

=

P(Shape | Color) P(Color)

slide-16
SLIDE 16

Divide by marginal going the other way

red blue circle 1/3 1/4 square 1/6 1/4 circle 7/12 square 5/12 red blue circle 4/7 3/7 = / red blue square 2/5 3/5

slide-17
SLIDE 17

Divide by marginal going the other way

red blue circle 1/3 1/4 square 1/6 1/4 circle 7/12 square 5/12 red blue circle 4/7 3/7 = / red blue square 2/5 3/5

P(Shape, Color) P(Shape)

=

P(Color | Shape)

slide-18
SLIDE 18

Bayes' Rule!

red blue circle 1/3 1/4 square 1/6 1/4 circle 7/12 square 5/12 red blue circle 4/7 3/7 = / red blue square 2/5 3/5

= P(Color | Shape)

red blue 1/2 1/2 red cir cle 2/3 squ are 1/3 blue cir cle 1/2 squ are 1/2 *

P(Shape | Color) P(Color) P(Shape)

=

slide-19
SLIDE 19

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)

slide-20
SLIDE 20

What does it feel like to have a bug in code?

Strange things keep happening, but you will

  • fuen be able to "explain

away" results. At first. TRUST YOUR GUT. BE VIRTUOUS. BE PARANOID.