Binomial distribution

Binomial distribution, as the name suggests, has only two possible outcomes, success or failure. The outcomes do not need to be equally likely and each trial is independent of the other. 

Let's generate a binomial distribution graph using the scipy.stats module by the binom method:

from scipy.stats import binom

binomial_data = binom.rvs(n=10, p=0.8,size=10000)

axis = sns.distplot(binomial_data, kde=False, color='red', hist_kws={"linewidth": 15})
axis.set(xlabel='Binomial Distribution', ylabel='Frequency')

The output of the preceding code is given in the following diagram:

The binom.rvs() method from the scipy.stats module takes n as the number of trial arguments, and p as the probability of success as shape parameters to generate the graph. 

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.188.139.172