Predicting the probability of defects
Any situation with exactly two possible outcomes can be modeled with binomial random variables. For example, you could model if someone likes or dislikes a product, or if they voted or not.
Let's model whether or not a component from a supplier comes with a defect. From the thousands of components that we got from a supplier, we are going to take a sample of 50, selected randomly. The agreed and accepted defect rate is 2%.
We import the binom object from scipy.stats.
Recall that:
binom.pmf()calculates the probability of having exactlykheads out ofncoin flips.binom.cdf()calculates the probability of havingkheads or less out ofncoin flips.binom.sf()calculates the probability of having more thankheads out ofncoin flips.
Diese Übung ist Teil des Kurses
Foundations of Probability in Python
Interaktive Übung
In dieser interaktiven Übung kannst du die Theorie in die Praxis umsetzen.
Übung starten