# Detecting Product Defects with Probability

Hi there!

I’ve just finished this assignment and starting to check my code with the solution. And have some questions.

1. Seems like here is a typo in solution code of Task 5:
Create a variable called `year_defects` that has 365 random values from the Poisson distribution.
``````### Task Group 2 ###
year_defects = stats.poisson.rvs(lam, size = 356)
``````
1. Task 11. Calculate and print the probability of observing that maximum value or more from the Poisson(7) distribution

Why in the solution here is no subtract 1 from `stats.poisson.cdf(year_defects.max()` while in hint and in theory before there were explanation that if we want to find ‘value or more’ we should to include the maximum value in our probability?

``````## Task 11:
1 - stats.poisson.cdf(year_defects.max(), lam)
``````
1. What is the difference between use `year_defects.mean()` and `np.mean(year_defects)`? And also all other functions like `year_defects.max()` vs. `max(year_defects)`?

Thank you!

Not an answer, as such, but does the above match your intentions?

1 Like

I’m sorry, I think I don’t understand your question =/

Should the size be 365?

statistically - possibly not =) but task says that there should be 365 random values

Which is why I question `size = 356’. Is that a typo?

yes, because it does not fulfill the conditions of the task

I haven’t done this lesson, and I’m not familiar with that probability distribution or the project.

But, to answer your 3rd question, they’re the same thing: you’re using the same statistical method to get the mean of that array/column `year_defects` except that one is Pandas and the other is numPy (and the number of parameters each accepts are different).
See the docs here:
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.mean.html

https://numpy.org/doc/stable/reference/generated/numpy.mean.html

1 Like