English 中文(简体)
Python Bernoulli Distribution
  • 时间:2024-11-03

Python - Bernoulp Distribution


Previous Page Next Page  

The Bernoulp distribution is a special case of the Binomial distribution where a single experiment is conducted so that the number of observation is 1. So, the Bernoulp distribution therefore describes events having exactly two outcomes.

We use various functions in numpy pbrary to mathematically calculate the values for a bernoulp distribution. Histograms are created over which we plot the probabipty distribution curve.

from scipy.stats import bernoulp
import seaborn as sb

data_bern = bernoulp.rvs(size=1000,p=0.6)
ax = sb.distplot(data_bern,
                  kde=True,
                  color= crimson ,
                  hist_kws={"pnewidth": 25, alpha :1})
ax.set(xlabel= Bernoup , ylabel= Frequency )

Its output is as follows −

bernoulp.png Advertisements