1 / 22

Probability for Computer Scientists

Probability for Computer Scientists. CS109. Cynthia Lee. Today’s Topics. Last time: Combinations Permutations TODAY: Probability! Sample Spaces and Set Theory Axioms of Probability Next week: Conditional Probability Independence Discrete Random Variables. Society of Black

Télécharger la présentation

Probability for Computer Scientists

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Probability for Computer Scientists CS109 Cynthia Lee

  2. Today’s Topics • Last time: • Combinations • Permutations • TODAY: Probability! • Sample Spaces and Set Theory • Axioms of Probability • Next week: • Conditional Probability • Independence • Discrete Random Variables

  3. Society of Black Scientists and Engineers American Indian Science and Engineering Society Looking for a diverse community within engineering and science at Stanford? Join one of Stanford’s engineering diversity societies! Society of Latino Engineers Society of Women Engineers Meetings: Tuesdays 12:00PM at BCSC Meetings: Mondays 12:00PM at NACC Meetings: Fridays 12:00PM at BCSC Meetings: Wednesdays 12:00PM at MERL, Building 660, 2nd floor

  4. Computer Science-specific club: Women in CS http://wics.stanford.edu

  5. Warm-up review of last lecture: Karel Goes 3-D! • Beloved Karel the robot moves around in its 2-D grid. It can only move up/down/left/right (not diagonally), one square at a time. • Imagine Karel goes 3-D and wants to move from one corner at coordinate (0,0,0) to the opposite corner at coordinate (x,y,z), and will only move in a positive direction in any dimension: • How many different sequences of steps are there to get there?

  6. Warm-up review of last lecture: Karel Goes 3-D! • Beloved Karel the robot moves around in its 2-D grid. It can only move up/down/left/right (not diagonally), one square at a time. • Imagine Karel goes 3-D and wants to move from one corner at coordinate (0,0,0) to the opposite corner at coordinate (x,y,z), and will only move in a positive direction in any dimension: • How many different sequences of steps are there to get there? • First decide which tool to use: • Permutations • Combinations • Multinomial • Divider-method multinomial • GIVE ME A HINT, PLS.

  7. Warm-up review of last lecture: Karel Goes 3-D! • HINT: • Must eventually go a steps in x dir • …and b steps in y dir • …and c steps in z dir • The question is, how can we permute the order of these (but ignore duplicates) • Which problem we saw last time most resembles this? • iPhone 4-smudge codes • Choosing 2 Hunger Games tributes • moo/Mississippi • Police officers in precincts

  8. Warm-up review of last lecture: Karel Goes 3-D! • Beloved Karel the robot moves around in its 2-D grid. It can only move up/down/left/right (not diagonally), one square at a time. • Imagine Karel goes 3-D and wants to move from one corner at coordinate (0,0,0) to the opposite corner at coordinate (x,y,z), and will only move in a positive direction in any dimension: • How many different sequences of steps are there to get there? • First decide which tool to use: • Permutations • Combinations • Multinomial • Divider-method multinomial

  9. Warm-up review of last lecture: Karel Goes 3-D! • Imagine Karel goes 3-D and wants to move from one corner at coordinate (0,0,0) to the opposite corner at coordinate (a,b,c), and will only move in a positive direction in any dimension: • How many different sequences of steps are there to get there? • Intuition: • Must eventually go a steps in x dir • …and b steps in y dir • …and c steps in z dir • The question is, how can we permute these (but ignore duplicates) • moo/Mississippi problem is the same! • MULTINOMIAL:

  10. Last lecture “cheat sheet” on picking a method:

  11. Sample Spaces and Set Theory

  12. Sample Spaces • Setsthat represent ALL possible outcomes of an experiment • Can be sets of numbers, things, people… • Can be enumerated: • Toss of a coin: • Roll of a dice: • Or specified with set builder notation: • # of emails in a day: • # of hours spent watching YouTube in a day:

  13. Events • Setsthat are subsets of the sample space • The outcome of an experiment • Coin comes up heads: • At least one head on two flips: • Die roll less than 3: • # of emails in a day is less than 20: • Wasted day: • Note about Ross textbook: • For subset that can include the entire set (i.e., not strict subset), Ross uses: • You might be more used to seeing:

  14. Venn Diagrams! • : Hey! That’s unfair that gets a shorthand and doesn’t! You’re right, that’s unfair.

  15. Which is the correct picture for ?

  16. DeMorgan’s Laws ♥ ♥ • What does that mean?

  17. Axioms of Probability • Axiom 3, more generally: • For any mutually exclusive events E1, E2, …

  18. Ok…so what does that mean? Why do we care? • A few of the implications of the Axioms: • Makes it easy to calculate the probability of the complement of an event: • We can compare probabilities of events that are subsets of each other:

  19. Easy (and common) case: Equally likely events in S • Some sample spaces are comprised of outcomes that are all equally likely • We can compare probabilities of events that are subsets of each other: • Coin flip • Die roll • There are special rules for this:

  20. Example Time!

  21. Manufacturing Quality Assurance • You manufacture computer chips • In one day, you manufacture n chips • On a certain day, it happens that 1 of them is defective • You pull out k for testing • What are the chances that you find the defective one in your test? • We’re going to do this the long/thorough way! • We use the “equally likely” rule: • P(defective one is found in k tests) =

  22. What happens in Vegas stays in Vegas …your money also stays in Vegas. • Consider 5-card poker hands • “straight” is 5 consecutive rank cards of any suit • “straight flush” is give consecutive rank cards of same suit • What is P(straight, but not straight flush)? • |S| = • “Of 52 cards, choose 5 of them” • What is P(straight, but not straight flush)?

More Related