  Introduction to Numpy Exponential Distribution

Numpy Exponential Distribution – Before moving ahead, let’s know a bit of Python Multinomial Distribution

Exponential Distribution describes the elapsed time between the events. In other words, it specifically measures time to complete an event.

E.g., the amount of time (beginning now) until an earthquake occurred, length, time etc.

It includes two parameters –

```scale - inverse of rate defaults to 1.0.

size - Returned array of the shape.```

### Example – Creating an array of random numbers of size 3×3 for exponential distribution.

`from numpy import randomz = random.exponential(scale=2, size=(3, 3))print(z)`
```Output -

[[0.33863399 0.05955026 1.92801771]
[0.1881709  1.17949181 0.75093524]
[2.35222711 0.31593134 3.58855626]]```

As shown above, it returned an array of shapes 3×3 containing random numbers.

Note: Later you will learn more in our Python Expenential Distribution Tutorial.

View to Poisson Distribution and Exponential Distribution

Poisson distribution tells the how many times an event has occurred in specific time whereas Exponential distribution tells how much time has been taken to complete these events.

Visualization of Exponential Distribution

Example – Visualizing the Exponential Distribution graph without histogram.

`from numpy import randomimport matplotlib.pyplot as pltimport seaborn as klkl.distplot(random.exponential(size=5000), hist=False)plt.show()`

As a result, it returned visualized the Exponential Distribution graph without histogram.

Example – Visualizing the Exponential Distribution graph with histogram.

`from numpy import randomimport matplotlib.pyplot as pltimport seaborn as klkl.distplot(random.exponential(size=5000))plt.show()`

As shown clearly, it returned visualized the Exponential Distribution graph with histogram.

If you find anything incorrect in the above-discussed topic and have any further questions, please comment below.

Like us on

Share on