课程: Probability Foundations for Data Science

Basic probability

- [Instructor] Let's start off by reviewing a few basic concepts of probability. First off, what is probability? Probability is a measure of the likelihood of an event occurring. This measure is expressed as a number between the values of zero and one. You can think of it as the ratio of the number of favorable outcomes divided by the total number of possible outcomes. This helps create a branch of mathematics concerning events and numerical descriptions of how likely they are to occur. Let's start off with an example. Let's say you have five total balls in a bag and two of the balls are red. Let's say you want to discover what the probability is of drawing a red ball. To do this, you would divide your favorite outcome of the red ball by the total number of outcomes, which is going to be the total number of balls in the bag. In this case, you would be dividing two, which is the number of red balls by five, which is the total number of balls in the bag to get a value of 2/5 or 0.4 for drawing a red ball. Typically, in probability, you conduct what is called experiments or trials. These are any procedure that can be infinitely repeated and have a well-defined set of possible outcomes. For example, an experiment or trial would be flipping a coin or rolling two dice. You'll frequently hear me reference an experiment or trial throughout this course, and I will often use these terms interchangeably. When you conduct experiments, you have what is called a sample space. A sample space is the set of all possible outcomes of an experiment. For example, if you roll a six-sided die, the sample space would contain the values of one, two, three, four, five, and six. When you have a sample space, you can gather events from it. An event is a subset of your sample space. This event represents one or more outcomes of the experiment you conducted, and it is often denoted as A with a corresponding probability of P of A. For example, if you want to look at an event for only rolling odd values on a six-sided die, then your event would contain the values of one, three, and five. Now that you gathered your sample space and your event for rolling your die, you can gather the probability. So the probability of event A occurring which is rolling an odd value on the die will be the three potential desired outcomes of the event, which is one, three, and five divided by the six total outcomes in the sample space, which if you remember is one, two, three, four, five, and six. Once you divide this all out, you'll get a probability of 1/2 or 0.50. Next, let's look at permutations and combinations. Permutations are the arrangement of items in a specific order. The number of permutations of n items taken p at a time is given by the following formula. So you have the number of permutations with n and p equal to n factorial divided by n minus p factorial. Let's look at an example. Let's say you want to find the number of ways to arrange three out of five colors. To do this, you'll use your formula that you had before, and so in this case, n is going to be equaling five, and p is going to equal three. So you'll have your permutations for five and three, and that is going to be equaling five factorial divided by five minus three factorial, which in this case is equal to two factorial. When you get this all multiplied by out, when you get this all multiplied out, you'll have five multiplied by four, multiplied by three, multiplied by two, multiplied by one, and divide that by two multiplied by one. This gets you a final value of 60. So for this scenario, the way you can arrange three out of five colors is in 60 different permutations. Next up are combinations. Combinations are a bit different than permutations because they deal with the arrangement of items, but this time they do not need to be in a specific order. So this time you have your combinations for n and p and that's going to be equal to n factorial divided by p factorial multiplied by n - p factorial. This makes sense because you should have either the same or less combinations than you would permutations. Let's use the previous example where you want to find the number of ways you can choose three out of five colors, but this time you do not care about the order of how they arrange, you simply want to choose these three colors. So using your equation, you have your combination with n equaling to five and p equaling to three again, and so you have five factorial divided by three factorial multiplied by five minus three factorial, which if you remember is just two factorial. So when you multiply this all up, you get five multiplied by four, multiplied by three, multiplied by two, multiplied by one, divided by three, multiplied by two, multiplied by one, and you're going to be multiplying that by two multiplied by one 'cause again, you have those two factorials on the bottom. Once you multiply and divide this all out, you'll get a value of 10, which means you can have 10 different combinations of these three colors. Let's wrap up by looking at a few different cases of dealing with the probability of two events. First, let's look at the case where the events are independent. Two events A and B are independent if the occurrence of one event does not affect the probability of the other event. The probability of both events occurring is represented by the following equation where you have the probability of A and B equal to the probability of A multiplied by the probability of B. So remember, this equation only works if these two events are independent. Let's look at an example where you toss a fair coin and roll a fair six-sided die. Let's say you want to find the probability of getting heads and rolling a four. So you want to define your two sample spaces, so you have heads or tails for your coin, and you have the values one through six for your six sided die. Then for your events, you're wanting to get heads and roll a four. Finally, you can get your probabilities using the equation where you have the probability of getting heads and rolling a four equal to the probability of heads multiplied by the probability of getting a four. So this is going to be 1/2 multiplied by 1/6 which gets you a final result of 1/12 Next step, let's look at when the two events are dependent on each other. Two events A and B are dependent if the occurrence of one event affects the probability of the other event. The probability of both events occurring is represented by the following equation where you have the probability of A and B equal to the probability of A multiplied by the probability of B given A. The second portion of this equation is simply denoting how the probability of B is going to be affected by that probability of A since that A occurs first and it is going to affect how B is going to be calculated. For example, let's say you draw two cards from a deck without replacement. Let's find the probability of drawing an ace first and then drawing a king second. So your sample space is going to be all those 52 cards. Your two events is going to be drawing the ace first and second drawing the king, and you can use the following equation to get your probability. So you'll have the probability of getting an ace then a king equal to the probability of getting an ace multiplied by the probability of getting a king after you draw an ace. Now, the probability of getting a king after you drew an ace, there's still going to be four king cards in that deck, but now you're only going to have 51 cards to pull from because you're one card less from the original 52 that you had. When you multiply this together, you get 16/2652, and if you simplify that, you get a probability of 4/663, which is approximately equal to 0.006. Finally, let's look at when the two events are mutually exclusive. Two events A and B are mutually exclusive if they cannot occur simultaneously. This means that however these events are conducted in these experiments, there's no way that they can occur together or hence affect each other in the process. The probability of either event occurring is represented by the following equation, so this time you'll notice it's the probability of A union B, also known as the probability of A or B, and this is equal to the probability of A plus the probability B. Again, remember, it is being added together now because these two events are mutually exclusive. For example, let's say you roll a die and you want to find the probability of getting either a two or a four. Knowing how rolling a die works, you cannot get a two or a four at the same time, so again, these events are mutually exclusive. For your sample space you have the values of one through six for your six face die, and then for your events, you have the event of rolling a two and the event of rolling a four. To get these results, you have the probability of two union four equal to the probability of two plus the probability of four, which is equal to 1/6 plus 1/6 that equals one third or 0.33 as your probability of rolling either of these two values. Now you should be refreshed and ready to go to begin diving deep into the various probability concepts that will be discussed in this course. If you still feel unsure about some of these more basic concepts that I just reviewed, then I highly recommend checking out Eddie Davila's LinkedIn Learning Course Statistics Foundations 2: Probability to get a more thorough refresher on these probability concepts. Are you ready to begin exploring the world of probability? Great. Then let's get started.

内容