The Third Experiment
It is time to move to the third experiment, which should be useful for we as for data scientist!
General formula:
In this experiment, we will work with the binom.cdf(k, n, p) function. This function helps calculate the probability of receiving k or less successes among n trials with the probability of success for each experiment p.
Real-life example:
Imagine that we are working for the bank, and last month the bank gained 200 customers; we know that the probability for clients to continue working with the bank is 60%. Calculate the probability that 70 or fewer customers will stay with we.
Code:
1234from scipy.stats import binom # Calculate the probability experiment = binom.cdf(k = 70, n = 200, p = 0.60) print(experiment)
Explanation:
from scipy.stats import binomimporting object fromscipy.stats.binom.cdf(k = 70, n = 200, p=0.60)the probability of getting70or less successes amoung200trials with the probability of success60 %
By the way, this function is one of the most commonly used. Indeed it is hard to get zero here because we need 70 or less(in this case), so 1 is a relevant result too! In comparison to the previous functions(experiments) where we would receive at least or exactly defined number of successes.
Swipe to start coding
Imagine that we work with real research.
Our task here is to calculate the probability that 10 or fewer residents in a specific town with a population of 500 will answer yes to our question, "Do you have your housing?". The probability that the answer will be positive is 40%.
- Import 
binomobject fromscipy.stats. - Calculate the probability that 
10or fewer people among500interviewees will answer "yes", the probability of receiving positive answer is40%. 
Løsning
Takk for tilbakemeldingene dine!
single
Spør AI
Spør AI
Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår
Oppsummer dette kapittelet
Explain code
Explain why doesn't solve task
Awesome!
Completion rate improved to 3.7
The Third Experiment
Sveip for å vise menyen
It is time to move to the third experiment, which should be useful for we as for data scientist!
General formula:
In this experiment, we will work with the binom.cdf(k, n, p) function. This function helps calculate the probability of receiving k or less successes among n trials with the probability of success for each experiment p.
Real-life example:
Imagine that we are working for the bank, and last month the bank gained 200 customers; we know that the probability for clients to continue working with the bank is 60%. Calculate the probability that 70 or fewer customers will stay with we.
Code:
1234from scipy.stats import binom # Calculate the probability experiment = binom.cdf(k = 70, n = 200, p = 0.60) print(experiment)
Explanation:
from scipy.stats import binomimporting object fromscipy.stats.binom.cdf(k = 70, n = 200, p=0.60)the probability of getting70or less successes amoung200trials with the probability of success60 %
By the way, this function is one of the most commonly used. Indeed it is hard to get zero here because we need 70 or less(in this case), so 1 is a relevant result too! In comparison to the previous functions(experiments) where we would receive at least or exactly defined number of successes.
Swipe to start coding
Imagine that we work with real research.
Our task here is to calculate the probability that 10 or fewer residents in a specific town with a population of 500 will answer yes to our question, "Do you have your housing?". The probability that the answer will be positive is 40%.
- Import 
binomobject fromscipy.stats. - Calculate the probability that 
10or fewer people among500interviewees will answer "yes", the probability of receiving positive answer is40%. 
Løsning
Takk for tilbakemeldingene dine!
single