# Logistic Distribution In NumPy

In this article, we will focus on the implementation of the logistic distribution in NumPy with examples.

This distribution has a symmetric bell-shaped curve and is defined by two parameters: the location parameter and the scale parameter.

## Numpy Random Logistic Distribution

To explain development in Numpy random logistic, we utilize logistic distribution.

Machine learning applications include logistic regression, neural networks, etc.

Three parameters are involved:

 Parameters Overview loc the mean, where the highest point is found. The default value is 0. scale an indicator of the level of a distribution, or standard deviation. The default setting is 1. size Provide the array shape.

Take four observations from a logistic distribution with a mean of 5 and a standard deviation of 8:

#### Example:

from numpy import random mrx = random.logistic(loc=5, scale=8, size=(4, 2)) print(mrx)

Change the mean and standard deviation values in the following example:

#### Example:

from numpy import random mrx = random.logistic(loc=3, scale=2, size=(2, 5)) print(mrx)

## Logistic Distribution Visualization

We can use Matplotlib to visualize the logistic distribution by plotting a histogram of the generated random numbers.

#### Example:

from numpy import random mrx = random.logistic(loc=5, scale=8, size=(4, 2)) print(mrx)

Display the histogram of the Logistic Distribution:

#### Example:

from numpy import random import matplotlib.pyplot as pt import seaborn as sbn sbn.distplot(random.logistic(size=10), hist=True) pt.show()

## Logistic vs Normal Distribution

Both distributions are close to symmetrical, but the logistic distribution has a greater area between the tails.

In other words, According to Numpy random logistic, it corresponds to a greater probability of an event happening far away from the mean.

Except for the highest point, normal and logistic distributions are close to symmetrical at higher scales (standard deviation).

Show the difference between Logistic and Normal Distribution in the following example:

#### Example:

from numpy import random import matplotlib.pyplot as pt import seaborn as sbn sbn.distplot(random.normal(scale=8, size=20), hist=False, label='normal') sbn.distplot(random.logistic(size=15), hist=False, label='logistic') pt.show()

Display the difference between both distributions only with a histogram:

#### Example:

from numpy import random import matplotlib.pyplot as pt import seaborn as sbn sbn.distplot(random.normal(scale=35, size=5), hist=True, kde = False, label='normal') sbn.distplot(random.logistic(size=2500), hist=True, kde = False, label='logistic') pt.show()

### Conclusion

We have explored the numpy random logistic distribution and how it can be used to generate random numbers and fit the distribution to data.

The logistic distribution is a useful probability distribution that can be used in various applications, such as in logistic regression and machine learning.

+1
0
+1
0
+1
0
+1
0
+1
0
+1
0
+1
0