Introduction to Numpy Logistic Distribution

In This Article, You Will Learn About Numpy Logistic Distribution.

Numpy Logistic Distribution – Before moving ahead, let’s know a bit of Python Uniform Distribution

Logistic distribution is used to measure the growth of event occurred. 

It is mostly used in machine learning, logistic regression, neural network etc.

It includes three parameters –

loc – Default value is 0. Mean, where the point is.

scale - Default value is 1. SD, the flatness of distribution.

size - Returned array of the shape.

Example – A logistic distribution with the values of mean 3 and SD 4 is used to create an array of 3×3 samplers.

from numpy import random

x = random.logistic(loc=3, scale=4, size=(3, 3))

print(x)
Output - 

[[-2.87984602 13.74731143 9.33644187]
[ 0.4829171 -2.55972892 8.91609969]
[ 2.90160651 -2.84301353 6.00636078]]

As a result, it returned an array containing random numbers.

Visualization of Logistic Distribution

Example – Visualizing the Logistic Distribution graph without histogram.

from numpy import random
import matplotlib.pyplot as plt
import seaborn as kl

kl.distplot(random.logistic(size=2500), hist=False)

plt.show()
numpy-logistic-distribution

As shown clearly, it Visualized the Logistic Distribution graph.

Note: You will learn in detail later about Logistic Distribution Tutorial.

Example – Visualizing the Logistic Distribution graph with histogram.

from numpy import random
import matplotlib.pyplot as plt
import seaborn as kl

kl.distplot(random.logistic(size=2500))

plt.show()
numpy-logistic-distribution

As shown above, it Visualized the Logistic Distribution graph.

View to Logistic Distribution and Normal Distribution

Logistic and Normal Distributions are very same to each other but majorly Logistic Distribution has put more value than Normal distribution i.e., it shows the more possibility of occurrence of an event.

Higher scale values (standard deviation) require logistic distributions that are nearly identical to the normal, except for the peak.

Example –  Visualizing the Logistic Distribution graph

from numpy import random
import matplotlib.pyplot as plt
import seaborn as sns

sns.distplot(random.normal(scale=1, size=900), hist=False, label='normal')
sns.distplot(random.logistic(size=1000), hist=False, label='logistic')

plt.show()
numpy-logistic-distribution

As shown above, it Visualized the Logistic Distribution graph.

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

Like us on

1 thought on “Introduction to Numpy Logistic Distribution”

Leave a Comment

Stay in the loop

codingstreets