Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lära Challenge: Solving Task Using Binomial Distribution | Commonly Used Discrete Distributions
Probability Theory Basics

book
Challenge: Solving Task Using Binomial Distribution

Let's consider a task about shooting at a target.
The probability of hitting the target in a single shot is 0.6. We want to calculate the probability of hitting the target 4 times in 10 shots.

We can't solve this task using the classic definition of probability because elementary events of this stochastic experiment have different probabilities of occurring. In addition, we are conducting not one stochastic experiment but ten, and we need to consider the results of all individual experiments.
This stochastic experiment is a Bernoulli trial: we have only two possible outcomes ( shoot and fail to shoot the target).
Shots are independent, so we have a Bernoulli process and can calculate probability using Binomial distribution.

Uppgift

Swipe to start coding

You have to calculate the probability of hitting the target 4 times in 10 shots.

Use .pmf() method and specify n and p parameters to calculate the corresponding probability.

Lösning

from scipy.stats import binom

# Define the parameters
n_trials = 10
proba = 0.6 # Probability of success (hitting the target)

# Calculate probability in the point 4
# You need to use variables here.
pmf = binom.pmf(4, n=n_trials, p=proba)
print(f'Probability of hitting the target exactly 4 times: {pmf:.4f}')

Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 3. Kapitel 2
single

single

from scipy.stats import binom

# Define the parameters
n_trials = 10
proba = 0.6 # Probability of success (hitting the target)

# Calculate probability in the point 4.
# You need to use variables here.
pmf = binom.___(4, n=___, p=___)
print(f'Probability of hitting the target exactly 4 times: {pmf:.4f}')

Fråga AI

expand

Fråga AI

ChatGPT

Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal

some-alt