CSE 321 Discrete Structures
description
Transcript of CSE 321 Discrete Structures
![Page 1: CSE 321 Discrete Structures](https://reader035.fdocuments.us/reader035/viewer/2022062810/56815cbf550346895dcac333/html5/thumbnails/1.jpg)
CSE 321 Discrete Structures
Winter 2008Lecture 20
Probability: Bernoulli, Random Variables, Bayes’ Theorem
![Page 2: CSE 321 Discrete Structures](https://reader035.fdocuments.us/reader035/viewer/2022062810/56815cbf550346895dcac333/html5/thumbnails/2.jpg)
Announcements
• Readings – Probability Theory
• 6.1, 6.2 (5.1, 5.2) Probability Theory• 6.3 (New material!) Bayes’ Theorem• 6.4 (5.3) Expectation
– Advanced Counting Techniques – Ch 7.• Not covered
– Relations• Chapter 8 (Chapter 7)
![Page 3: CSE 321 Discrete Structures](https://reader035.fdocuments.us/reader035/viewer/2022062810/56815cbf550346895dcac333/html5/thumbnails/3.jpg)
Highlights from Lecture 19
• Conditional Probability• Independence
Let E and F be events with p(F) > 0. The conditional probability of E given F, defined by p(E | F), is defined as:
The events E and F are independent if and only if p(E F) = p(E)p(F)
![Page 4: CSE 321 Discrete Structures](https://reader035.fdocuments.us/reader035/viewer/2022062810/56815cbf550346895dcac333/html5/thumbnails/4.jpg)
Bernoulli Trials and Binomial Distribution
• Bernoulli Trial– Success probability p, failure probability q
The probability of exactly k successes in n independent Bernoulli trials is
![Page 5: CSE 321 Discrete Structures](https://reader035.fdocuments.us/reader035/viewer/2022062810/56815cbf550346895dcac333/html5/thumbnails/5.jpg)
Random Variables
A random variable is a function from a sample space to the real numbers
![Page 6: CSE 321 Discrete Structures](https://reader035.fdocuments.us/reader035/viewer/2022062810/56815cbf550346895dcac333/html5/thumbnails/6.jpg)
Bayes’ Theorem
Suppose that E and F are events from a sample space S such that p(E) > 0 and p(F) > 0. Then
![Page 7: CSE 321 Discrete Structures](https://reader035.fdocuments.us/reader035/viewer/2022062810/56815cbf550346895dcac333/html5/thumbnails/7.jpg)
False Positives, False Negatives
Let D be the event that a person has the disease
Let Y be the event that a person tests positive for the disease
![Page 8: CSE 321 Discrete Structures](https://reader035.fdocuments.us/reader035/viewer/2022062810/56815cbf550346895dcac333/html5/thumbnails/8.jpg)
Testing for disease
Disease is very rare: p(D) = 1/100,000
Testing is accurate:False negative: 1%False positive: 0.5%
Suppose you get a positive result, whatdo you conclude?
![Page 9: CSE 321 Discrete Structures](https://reader035.fdocuments.us/reader035/viewer/2022062810/56815cbf550346895dcac333/html5/thumbnails/9.jpg)
P(D|Y)
![Page 10: CSE 321 Discrete Structures](https://reader035.fdocuments.us/reader035/viewer/2022062810/56815cbf550346895dcac333/html5/thumbnails/10.jpg)
Spam Filtering
From: Zambia Nation Farmers Union [[email protected]]Subject: Letter of assistance for school installationTo: Richard Anderson
Dear Richard,I hope you are fine, Iam through talking to local headmen about the possible assistance of school installation. the idea is and will be welcome.I trust that you will do your best as i await for more from you.Once againThanking you very muchSebastian Mazuba.
![Page 11: CSE 321 Discrete Structures](https://reader035.fdocuments.us/reader035/viewer/2022062810/56815cbf550346895dcac333/html5/thumbnails/11.jpg)
Bayesian Spam filters
• Classification domain– Cost of false negative– Cost of false positive
• Criteria for spam– v1agra, ONE HUNDRED MILLION USD
• Basic question: given an email message, based on spam criteria, what is the probability it is spam
![Page 12: CSE 321 Discrete Structures](https://reader035.fdocuments.us/reader035/viewer/2022062810/56815cbf550346895dcac333/html5/thumbnails/12.jpg)
Email message with phrase “Account Review”
• 250 of 20000 messages known to be spam• 5 of 10000 messages known not to be spam• Assuming 50% of messages are spam, what
is the probability that a message with “Account Review” is spam
![Page 13: CSE 321 Discrete Structures](https://reader035.fdocuments.us/reader035/viewer/2022062810/56815cbf550346895dcac333/html5/thumbnails/13.jpg)
Proving Bayes’ Theorem
![Page 14: CSE 321 Discrete Structures](https://reader035.fdocuments.us/reader035/viewer/2022062810/56815cbf550346895dcac333/html5/thumbnails/14.jpg)
Expectation
The expected value of random variable X(s) on sample space S is:
![Page 15: CSE 321 Discrete Structures](https://reader035.fdocuments.us/reader035/viewer/2022062810/56815cbf550346895dcac333/html5/thumbnails/15.jpg)
Expectation examples
Number of heads when flipping a coin 3 times
Sum of two dice
Successes in n Bernoulli trials with success probability p