Computer Science Foundations: More Probability Concepts

cmpu cmpu 145 foundations of computer science n.w
1 / 17
Embed
Share

Discover key probability concepts in computer science, including sample spaces, events, uniform distribution, the addition principle, and independent events. Explore examples involving student seating arrangements and prize drawings to deepen your understanding.

  • Computer Science
  • Probability
  • Foundations
  • Events
  • Examples

Uploaded on | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. CMPU CMPU- -145: Foundations of Computer Science 145: Foundations of Computer Science Spring, 2019 Spring, 2019 Chapter 6: More Probability. But you probably knew that already. CMPU 145 Foundations of Computer Science Peter Lemieszewski

  2. From Last Week (mostly) From Last Week (mostly) The Basics. . . 1. The sample space S is a set of outcomes (eg 3x coin flip) 2. An event is a one subset of S (eg cont: HHT) 3. Uniform distribution is when each outcome is equally likely Not always the case! (consider rolling a pair of dice) 4. Probability space = sample space S + probability function p If probability function is uniform, probability of event E, p(E) =|E|/|S| Probability of all events (subsets) in S is 1, i.e. p(S) = 1 5. Addition principle: Disjoint sets: |A B| = |A| + |B| Generally: |A B| = |A| + |B| |A B| 6. Two events, A and B are independent iff p(A B) = p(A) p(B) 4/12/2025 CMPU 145 Foundations of Computer Science 2

  3. One more example* I One more example* I Our class has 27 students with 6 students (usually) sitting in the first row . If I select all randomly What are the odds that all the students in the front row being selected before everyone else? Sample space: ...? Distribution: ? 4/12/2025 *similar to example 5 on p146 in Makinson 3

  4. One more example II One more example II Our class has 27 students with 6 students (usually) sitting in the first row . If I select all students randomly What are the odds that all the students in the front row being selected before everyone else? Sample space: the set of all permutations when selecting all students = P(27,27) = 27! Distribution: Uniform Cases for front row students selected first: P(6,6) * P(21,21) Prob. = P(6,6) * P(21,21) / P(27,27) = 6! * 21! / 27! ~ 3.4% 4/12/2025 CMPU 145 Foundations of Computer Science 4

  5. A Prize Drawing Example From Last Time A Prize Drawing Example From Last Time N contestants enter a prize drawing. N = 27 Three distinct winners are picked at random and in order(first,second,third) Sample space: ...? Distribution: ? 4/12/2025 CMPU 145 Foundations of Computer Science 5

  6. A Prize Drawing Example II A Prize Drawing Example II N contestants enter a prize drawing. N = 27 Three distinct winners are picked at random and in order(first,second,third) Sample space: The set of permutations of 3 winners from 27. P(27,3) = 27!/(27-3)! = 27!/24! = 27*26*25 Distribution: Uniform Probability of picking the 3 distinct winners: P(3dw) = 1/17550. 4/12/2025 CMPU 145 Foundations of Computer Science 6

  7. And Now The Monty Hall Problem. And Now The Monty Hall Problem. The Principles. Monty Hall: co-creator and host of the game show, Let s Make A Deal Marilyn Vos Savant: author of a weekly puzzle published in Parade Magazine. Marilyn vs Savant, from https://priceonomics.com/the-time- everyone-corrected-the-worlds-smartest/ Monty Hall, in a 1969 photo, hosts Let's Make A Deal. ABC Photo Archives/ABC via Getty Images 4/12/2025 7

  8. And Now The Monty Hall Problem. And Now The Monty Hall Problem. The Game. There are 3 Doors From: letsmakeadeal.com 4/12/2025 8

  9. And Now The Monty Hall Problem. And Now The Monty Hall Problem. The Grand Prize. One awesome prize behind one of the doors (a car) From: letsmakeadeal.com 4/12/2025 9

  10. And Now The Monty Hall Problem. And Now The Monty Hall Problem. Behind the other two doors Bupkes! (errr Zonk! not the grand prize) From: letsmakeadeal.com . The problem traditionally refers to a goat behind 2 doors. Note: Not actually a goat! 4/12/2025 10

  11. The Monty Hall Problem I The Monty Hall Problem I Your task: Select one door to win the awesome prize! However, after selecting a door, Monty Hall opens one of the other two doors to reveal a goat. (Everyone calls it a goat.) Then, you are asked, Do you want to switch your choice to the other (unopened) door? What should you do? 4/12/2025 CMPU 145 Foundations of Computer Science 11

  12. The Monty Hall Problem II The Monty Hall Problem II Your task: Select one door to win the awesome prize! Let s try some live simulations. We ll choose 3 people at random. 4/12/2025 CMPU 145 Foundations of Computer Science 12

  13. The Monty Hall Problem III The Monty Hall Problem III Behind The Doors. Probability of picking the grand prize car: p(C) = 1/3 Probability of picking the goat: p(G) = 2/3 Two scenarios: 1. You picked the grand prize door: Monty can choose either unopened door to reveal a goat. 2. You picked a goat: Monty has only one unopened door to reveal a goat. Monty s choice give you information about the door you didn t pick. 4/12/2025 CMPU 145 Foundations of Computer Science 13

  14. The Monty Hall Problem IV The Monty Hall Problem IV One way of looking at this: odds you picked the winning door: p(C) = 1/3 Odds the winning door is one you didn t pick p(!C) = 2/3 Odds are you didn t pick the winning door 4/12/2025 CMPU 145 Foundations of Computer Science 14

  15. The Monty Hall Problem V The Monty Hall Problem V One way of looking at this: odds you picked the winning door: p(C) = 1/3 Odds the winning door is one you didn t pick p(!C) = 2/3 Odds are you didn t pick the winning door The odds are still 2/3 but one door is eliminated, so switching improves your odds to p(C) = 2/3 4/12/2025 CMPU 145 Foundations of Computer Science 15

  16. Another view of the strategy Another view of the strategy Never switch: p(C) = 1/3 p(G) = 2/3 Always switch: p(C) = 2/3 p(G) = 1/3 Switching improves your odds. 4/12/2025 CMPU 145 Foundations of Computer Science 16

  17. For The Lab For The Lab We will build on our gen-and-test methodology and try out some Basic poker hands at least 4-of-a-kind. we ll need to simplify our card deck too. Let s look at some sample code. 4/12/2025 CMPU 145 Foundations of Computer Science 17

More Related Content