oldoc63 / learningDS

Learning DS with Codecademy and Books
0 stars 0 forks source link

Detecting Product Defects with Probability #447

Open oldoc63 opened 1 year ago

oldoc63 commented 1 year ago

You are in charge of monitoring the number of defective products from a specific factory. You've been told that the number of defects on a given day follows the Poisson distribution with the rate parameter (lambda) equal to 7. You remember that the Poisson distribution is special because the rate parameter represents the expected value of the distribution, so in this case, the expected value of the distribution Poisson(7) is 7 defects per day.

You will investigate certain attributes of the Poisson(7) distribution to get an intuition for how many defective objects you should expect to see in a given amount of time.

oldoc63 commented 1 year ago
  1. Create a variable called lam that represents the rate parameter of our distribution.
oldoc63 commented 1 year ago
  1. You know that the rate parameter of a Poisson distribution is equal to the expected value. So in our factory, the rate parameter would equal the expected number of defects on a given day. You are curios about how often we might observe the exact expected number of defects. Calculate and print the probability of observing exactly lam defects on a given day.
oldoc63 commented 1 year ago
  1. Our boss said that having 4 or fewer defects on a given day is an exceptionally good day. You are curious about how often that might happen. Calculate and print the probability of having one of those days.
oldoc63 commented 1 year ago
  1. On the other hand, our boss said that having more than 9 defects on a given day is considered a bad day. Calculate and print the probability of having one of those bad days.
oldoc63 commented 1 year ago
  1. You've familiarized yourself a little bit about how the Poisson distribution works in theory by calculating different probabilities. But let's look at what this might look like in practice.

    Create a variable called year_defects that has 365 random values from the Poisson distribution.

oldoc63 commented 1 year ago
  1. Let's take a look at our new dataset. Print the first 20 values in this dataset.
oldoc63 commented 1 year ago
  1. If we expect 7 defects on a given day, what is the total number of defects we would expect over 365 days? Calculate and print this value to the output terminal.
oldoc63 commented 1 year ago
  1. Calculate and print the total sum of the dataset year_defects. How does this compare to the total number of defects we expected over 365 days?
oldoc63 commented 1 year ago
  1. Calculate and print the average number of defects per day from our simulated dataset. How this compare to the expected average number of defects each day that we know from the given rate parameter of the Poisson distribution?
oldoc63 commented 1 year ago
  1. You're worried about what the highest amount of defects in a single day might be because that would be a hectic day. Print the maximun value of year_defects.