![bernoulli](https://i-blog.csdnimg.cn/blog_migrate/3a69ff2b4dfbdb9e50792a2e19a2a4bb.png)
bernoulli
Python-Bernoulli发行 (Python - Bernoulli Distribution)
The Bernoulli 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 Bernoulli distribution therefore describes events having exactly two outcomes.
伯努利分布是二项分布的一种特例,在该二项分布中进行了一次实验,因此观察次数为1。因此,伯努利分布描述的事件恰好具有两个结果。
We use various functions in numpy library to mathematically calculate the values for a bernoulli distribution. Histograms are created over which we plot the probability distribution curve.
我们在numpy库中使用各种函数来数学计算bernoulli分布的值。 将创建直方图,在该直方图上绘制概率分布曲线。
from scipy.stats import bernoulli
import seaborn as sb
data_bern = bernoulli.rvs(size=1000,p=0.6)
ax = sb.distplot(data_bern,
kde=True,
color='crimson',
hist_kws={"linewidth": 25,'alpha':1})
ax.set(xlabel='Bernouli', ylabel='Frequency')
Its output is as follows −
其输出如下-
![bernoulli.png](https://i-blog.csdnimg.cn/blog_migrate/8e1f772fe1855c12210d2f3f34250b7a.png)
翻译自: https://www.tutorialspoint.com/python_data_science/python_bernoulli_distribution.htm
bernoulli