Math is Boring Without Real Life Application!

Brief Summary

This video explains how probability and matrices, specifically Bayes' Theorem, are used by companies like car dealerships, insurance companies, and online marketplaces to predict customer behavior. It simplifies complex theories and advanced calculations to illustrate real-life applications, such as predicting whether a customer will buy a used car based on factors like age, income, and previous car ownership. The video uses examples with bags and balls and a dataset of customer information to explain Bayes' Theorem and its application in predictive modeling.

  • Bayes' Theorem helps update beliefs based on new evidence.
  • Companies use data to predict customer behavior.
  • Naive Bayes classifier predicts outcomes based on probabilities.

Introduction: Real-Life Applications of Math

The video addresses the common perception that math is too theoretical by demonstrating its real-life applications. It focuses on how probability and matrices are used by car dealerships, insurance companies, and online marketplaces like eBay. The explanation is simplified to avoid complex theories and advanced calculations, making it easier to understand.

Understanding the Data Set

The data set used in the example includes three features for each person: age group (0 for young, 1 for middle-aged, 2 for senior), income level (0 for low, 1 for medium, 2 for high), and previous car owner (0 for no, 1 for yes). The target column, "will buy used car," indicates whether the person bought a used car (1) or not (0). This data, collected for 10 people, is used to predict the likelihood of a new customer buying a used car based on their characteristics.

Bayes' Theorem Explained with Bags and Balls

Bayes' Theorem is explained using a scenario with two bags, one with three red balls and one blue ball (Bag A), and the other with one red ball and three blue balls (Bag B). If a red ball is randomly picked, the theorem helps determine the probability that it came from Bag A. The formula for Bayes' Theorem is P(X|Y) = P(Y|X) * P(X) / P(Y), where P(X|Y) is the probability of X given Y, P(Y|X) is the probability of Y given X, P(X) is the probability of X, and P(Y) is the probability of Y. Applying this to the bag example, the probability of the red ball coming from Bag A is calculated to be 75%.

Applying Bayes' Theorem to the Used Car Data Set

Bayes' Theorem is applied to the used car data set to predict whether a person will buy a used car based on their age group, income level, and previous car ownership. The goal is to calculate the probability of someone buying a used car (Y=1) or not (Y=0) given their features (X). The formula is adapted, and the prior probabilities P(Y=1) and P(Y=0) are calculated based on the data set.

Calculating Probabilities and Applying Laplace Smoothing

The probability of X given Y is calculated by assuming that all features are independent of each other when the outcome is known. Laplace smoothing is used to avoid zero probabilities, adding one to the numerator and a value based on the number of categories to the denominator. For example, the probability of a young person buying a used car is calculated as (3+1) / (7+3) = 4/10.

Final Calculation and Prediction

The final probabilities are calculated using Bayes' Theorem, and since the probability for Y=1 is greater than for Y=0, the Naive Bayes classifier predicts that a young person with high income and no previous car ownership is likely to buy a used car. The video concludes by emphasizing that this kind of math is used to make data-driven decisions in real-life businesses.

Summarize any YouTube video in seconds

Get summaries like this one for any video, in your language, with the free Summ app.

Download on the App Store
Get it on Google Play

Transcript

Full transcript of “Math is Boring Without Real Life Application!”. Click a timestamp to open the video at that moment. Need another video? Use the YouTube transcript generator.

0:00 The main reason people start hating math is that it's taught with too much theory and not enough real life application, making it feel pointless and frustrating. But let me try to change that for you. Today I will show you all a real life application of math. And trust me, it's something you see every day without even knowing it. Today we're going to talk about how probability and matrices are used by big companies like car dealerships, insurance companies, and even online marketplaces like eBay. But please keep in mind that since we want to make it simple to understand, we will use basic models and not get too deep into complex theories or advanced calculations. Imagine you work at a used

0:47 car dealership where your company provides you with valuable data about past customers who have bought used cars. This data includes information such as the customer's age, income level, and whether they've owned a car before. With this information, the company now wants to predict whether a new customer is likely to buy a used car. Before we start building models, can you observe that in real life, car dealerships might use similar data to predict which customers are most likely to buy a used car based on their age, income, and whether they've owned a car before. Then maybe insurance companies might also use this kind of data to estimate the likelihood of someone buying insurance. Then maybe online

1:34 marketplaces like eBay could use this data to predict which buyers are likely to purchase used goods based on their buying history, age, and other factors. Let me first explain to you the data set that we have in this table. For each person, we have three main details or features. The first feature is called age group. Instead of writing full age ranges, we use numbers to represent them. If age group is zero, it means the person is young, somewhere between 18 and 30 years old. If it is one, the person is middle-aged, which means between 31 and 50. If it is two, the person is considered a senior, meaning 51 or older. The second feature is

2:22 income level. Again, we use numbers here to keep things simple. If income level is zero, the person earns a low income. If it is one, they earn a medium income. If it is two, they have a high income. The third feature is previous car owner. This tells us whether the person has owned a car before. If previous car owner is zero, the person has never owned a car. If it is one, they have owned a car in the past. Finally, we have the target column called will buy used car. This is what we are trying to predict. If the value is zero, the person did not buy a used car. If it is

3:07 one, they did buy a used car. So, based on a person's age group, income level, and whether they owned a car before, we want to predict if they will buy a used car or not. We have this kind of information collected for 10 different people. Each row in our data set represents one person. For example, let's say the first row in our data looks like this. Age group is zero, income level is zero, previous car owner is zero, and will buy used car is one. So person A is young, has a low income, has never owned a car before, and still ended up buying a used car. Now before we start building our

3:53 model, let us first understand the core idea behind a well-known probability concept called B theorem, which will help us develop our model. Imagine you have two bags placed in front of you. Bag A has three red balls and one blue ball. Bag B has one red ball and three blue balls. Now suppose someone blindfolds you and randomly picks one of the two bags. So each bag has a 1 out of two chance or 50% chance of being selected. Next, from the selected bag, one ball is picked at random and it turns out to be red. You are told this result that the chosen ball is red, but you still don't know which bag it came

4:40 from. Now comes the big question. What is the probability that the red ball came from bag A? Let's walk through this carefully step by step. First, remember that both bags were equally likely to be picked in the beginning. So there's no bias and each bag had a 1 out of two chance. Now think about how likely it is to get a red ball from each bag. From bag A, the chance of getting a red ball is three out of four because it has three red and one blue ball. From bag B, the chance of getting a red ball is one out of four because it has only one red and three blue balls. So now we use this information to update our beliefs. Even

5:26 though both bags had an equal chance of being picked, the fact that we got a red ball makes it more likely that it came from the bag that has more red balls, that is bag A. So we are kind of reversing the question now. And instead of asking what's the chance of picking a red ball from bag A, we now ask given that a red ball was picked, what's the chance it came from bag A? That reverse thinking where we update our belief after seeing some result is exactly what B theorem is all about. And this formula in B theorem helps us find this exact thing. Probability of X given Y is equal to probability of Y given X multiplied

6:12 by probability of X divided by probability of Y. First the symbol P just stands for probability. The symbol given or the vertical bar that looks like a straight line is used to mean that some result has already happened and we are trying to figure out the chance of something else based on that. So when we say p of x given y we are asking what is the probability of x if we already know that y has happened. Thus the probability of y given x means what is the chance of getting y when x is true? P of X means what is the chance of X happening on its own before knowing anything else. P of Y means what is the

6:59 total chance of Y happening no matter how it happens. Now let's connect this to our bag and ball example. We want to know what is the probability that the ball came from bag A given that we picked a red ball. In this scenario, X is bag A and Y is the event of picking a red ball. So the probability of X given Y is the probability of selecting bag A given that we picked a red ball. To calculate this, we first consider the probability of picking a red ball from bag A or P of Y given X and multiply it by the initial probability of choosing bag A which is P of X. Then we divide

7:44 this by the total probability of picking a red ball from either bag. P of Y, which includes the probabilities of picking a red ball from both the bags. From the data, we know that bag A has three red balls out of four total balls. So P of Y given X is 3 / 4. P of X is the probability of choosing bag A before we even know anything about the ball picked. We have already discussed that since there are two bags and they have an equal chance of being chosen. So P of X is 1 divided by two. Now P of Y is the total probability of picking a red ball from either bag A or bag B regardless of

8:32 which bag was chosen. To calculate this, we consider the chances of getting a red ball from both bag A and bag B and then add those probabilities together. From bag A, we get 3 / 4, which is the probability of choosing a red ball from bag A multiplied by the chance of choosing bag A, which is 1 / 2. This gives 3 / 8. From bag B, we get 1 divided by four, which is the probability of choosing a red ball from bag B multiplied by the chance of choosing bag B, which is also 1 / 2. This gives 1 / 8. Adding these two

9:17 together gives the total probability of getting a red ball from either bag or P of Y, which is 4 / 8 or 1 / two. Now we can put these together into the B theorem formula to get this which is 3 / 4. At the beginning before we knew anything about the ball we picked we had an equal 50% chance of having chosen either bag A or bag B. This is because we had two bags and no reason to favor one over the other. However, after observing that we picked a red ball, our belief about the source of the ball changed. By applying BA theorem, we updated our probability. And now, based

10:05 on the new information, we calculated that the probability of the red ball coming from bag A increased to 3 / 4 or 75%. Now that we understand BA's theorem, let's apply it to our original data set about people deciding whether they will buy a used car or not. Just like the red ball helped us update our belief about which bag it came from, here we will try to update our belief about whether a person will buy a used car given certain details about them like their age group, income level, and whether they owned a car before. So our goal is this. We want to calculate the probability that a person will buy a used car based on some

10:51 known information about them. For example, let's say they are young, have high income, and have never owned a car before. In Baze theorem terms, this means y is the event will buy used car. So y = 1 will mean that the customer will buy the used car and y = 0 will mean that the customer will not buy the used car. X is the combined feature set young high income no previous car ownership. Also you might observe that in this formula for BA theorem I have swapped X and Y when compared with the bags and balls example. This is just to show you that this formula is not dependent upon the names of variables

11:37 but instead how we define those events. Like if I would have kept the same formula then it's just that we would have called this event as X and this as Y. First we calculate the prior probability which is P of Y. This tells us how likely it is that someone will buy a used car before considering any features. In our data set we have 10 people. Out of these seven people buy a used car. A B C E G H J and three do not. D F I. So P of Y = 1 is 7 / 10. Similarly, P of Y = 0 is 3 / 10. These

12:23 priors give us a starting point for our belief about whether someone will buy a used car. Next we want to calculate the probability of X given Y which means it will be P of age group then income level and previous owner given the value of the column will buy used car. Just note one thing that this algorithm works by assuming that all the features are independent of each other when we already know the outcome. In other words, P of X given Y becomes P of age group given will buy used car multiplied by P of income level given will buy used car multiplied by P of previous owner

13:08 given will buy used car. Now for our case replace this age with young then income with high income group and owner with no car. For people who did buy a used car Y equals 1. First we will calculate P of young given Y equals 1. In our data set out of seven people who buy a used car, three are young. Normally we'd say the probability is 3 / 7, right? But generally we use a trick called laplas smoothing which adds one to the number of young buyers that is one in the numerator and adds three to the total count of buyers or in the

13:54 denominator. We add three in the denominator because age group is classified into three categories which is 0 1 or two. So it becomes 3 + 1 / 7 + 3 which is 4 / 10. This ensures we don't get zero probabilities for any feature making our model more reliable. Then we check how many had high income. Only one out of the seven had high income. So we do 1 + 1 / 7 + 3 which is 2 over 10. Finally for people who had never owned a car before 4 out of 7 fall in that group and there are two options yes or no. So we get 4 + 1 / 7 + 2 which is 5 / 9. So

14:44 multiply all of them together to get 2 over 45. This will be the value of p of x given y = 1. Now we do the same for people who did not buy a used car. Y equals 0. None of the three were young. So we calculate 0 + 1 / 3 + 3 which is 16. One person had high income, so we do 1 + 1 / 3 + 3, which is 1/3. One person had never owned a car, so we do 1 + 1 / 3 + 2, which is 2 / 5. So multiply all of them together to get 1 over 45. This will be the value of P of X

15:30 given Y equals 0. Now we calculate the final value using B theorem. For y = 1 we get this times this over p of x or this over p of x. Then for y = z we get this times this over p of x or this over p of x. But hey we need to compare both of them and both has p of x as common in the denominator and thus we can remove it. Therefore, since the probability for y equals 1 is far greater than for y equals zero, the naive bay classifier predicts that a person with these characteristics like young, high income, and no previous car ownership is likely

16:17 to buy a used car. So, there you have it. Using BA theorem and probability, we've learned how companies can predict whether a customer is likely to buy a used car based on their personal features. It's not just theory. This kind of math is happening all around us every day, making datadriven decisions in real life businesses. Now, if this video gets 10,000 likes, then I will make another banger video like this one. Also, you can support my channel by joining our community and becoming a member. So good. [Music]

Share

More video summaries