* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Notes
Survey
Document related concepts
Transcript
Probability
Read: 4.6
Next Class: 5.1
Introduction to Finite Probability
1
If some action can produce Y different outcomes and X of those
Y outcomes are of special interest, we may want to know how
likely it is that one of the X outcomes will occur.
For example, what are the chances of:
Getting “heads” when a coin is tossed?
• The probability of getting heads is “one out of two,” or 1/2.
Getting a 3 with a roll of a die?
• A six-sided die has six possible results. The 3 is exactly one of
these possibilities, so the probability of rolling a 3 is 1/6.
Drawing either the ace of clubs or the queen of diamonds
from a standard deck of cards?
• A standard card deck contains 52 cards, two of which are
successful results, so the probability is 2/52 or 1/26.
Section 3.5
Probability
1
Introduction to Finite Probability (cont’d)
The set of all possible outcomes of an action is called the
sample space S of the action.
Any subset of the sample space is called an event.
If S is a finite set of equally likely outcomes, then the
probability P(E) of event E is defined to be:
P(E)
E
S
Section 3.5
Probability
2
Introduction to Finite Probability (cont’d)
For example, the probability of flipping a coin twice and having
both come up as heads is:
P(E)
HH
E
1
S HH,HT,TH,TT 4
Probability involves finding the size of sets, either of the sample
space or of the event of interest.
Section 3.5
We may need to use the addition or multiplication principles,
the principle of inclusion and exclusion, or the formula for the
number of combinations of r things from n objects.
Probability
3
2
Introduction to Finite Probability (cont’d)
Using the definition of P(E) as seen in the previous slide, we
can make some observations for any events E1 and E2 from a
sample space S of equally likely outcomes:
Section 3.5
Probability
4
Probability Distributions
A way to look at problems where not all outcomes are equally
likely is to assign a probability distribution to the sample
space.
Consider each distinct outcome in the original sample space as
an event and assign it a probability.
If there are k different outcomes in the sample space and each
outcome xi is assigned a probability p(xi), the following rules
apply:
1. 0 p(xi) 1
Because any probability value must fall within this range.
k
2.
p(x ) 1
i
i 1
•
The union of all of these k disjoint outcomes is the sample
space S, and the probability of S is 1.
Section 3.5
Probability
5
3
Conditional Probability
Given events E1 and E2, the conditional probability of E2
given E1, P(E2E1), is:
P E 2 E1
Section 3.5
P E1 E 2
P E1
For example, in a drug study of a group of patients, 17%
positively to compound A, 34% responded positively
responded
to compound B, and 8% responded positively to both.
The probability that a patient responded positively to compound
B given that he or she responded positively to A is:
P(B|A) = P(A ∩ B) / P(A) = 0.08 / 0.17 @ 0.47
Probability
6
Conditional Probability
Section 3.5
If P(E2E1) = P(E2), then E2 is just as likely to happen whether
E1 happens or not. In this case, E1 and E2 are said to be
independent events.
Then P(E1 E2) = P(E1) * P(E2)
This can be extended to any finite number of independent events
and can also be used to test whether events are independent.
Probability
7
4
Expected Value
If the values in the sample space are not numerical, we may find
a function X: S R that associates a numerical value with each
element in the sample space. Such a function is called a random
variable.
Given a sample space S to which a random variable X and a
probability distribution p have been assigned, the expected
value, or weighted average, of the random variable is:
n
E X X(x i ) p(x i )
i1
Section 3.5
Probability
8
Expected Value: Example
A fair coin is tossed three times. The sample space is
S = {HHH, HHT, HTH, HTT, THH, THT, TTH, TTT}
Let the random variable X assign to each outcome in S the
number of head in that outcome. Because the coin is fair, each
outcome in S occurs with equal opportunity which is the
multiplication of probability of each toss (total 3 tosses), ie.
½ * ½ * ½ = 1/8.
xi
HHH
X(xi)
3
2
2
1
2
1
1
0
p(xi)
1/8
1/8
1/8
1/8
1/8
1/8
1/8
1/8
Section 3.5
HHT HTH HTT THH THT TTH TTT
Probability
9
5
Expected Value: Example (cont’d)
The expected value of X, that is, the expected number of heads
in three tosses, is:
8
E ( X ) X ( xi ) p( xi )
i 1
3(1 / 8) 2(1 / 8) 2(1 / 8) 1(1 / 8) 2(1 / 8) 1(1 / 8) 1(1 / 8) 0(1 / 8)
12(1 / 8) 1.5
Section 3.5
Probability
10
Average Case Analysis of Algorithms
Expected value may help give an average case analysis of an
algorithm, i.e., tell the expected “average” amount of work
performed by an algorithm.
Let the sample space S be the set of all possible inputs to the
algorithm.
We assume that S is finite.
Let the random variable X assign to each member of S the
number of work units required to execute the algorithm on that
input.
And let p be a probability distribution on S,
The expected number of work units is given as:
n
E X X(x i ) p(x i )
i1
Section 3.5
Probability
11
6
Class Exercise
A loaded die has the following probability distribution:
xi
1
2
3
4
5
6
p(xi)
0.2
0.05
0.1
0.2
0.3
0.15
When the die is rolled, let E1 be the event that the rolled
number is odd, let E2 be the event that the rolled number is 3 or
6, and let E3 be the event that the rolled number is 4 or more.
a. Find P(E1).
b. Find P(E2).
c. Find P(E3).
d. Find P(E2 ∩ E3 ).
e. Find P(E1 U E3 ).
Section 3.5
Probability
12
7