LA ILAHA ILLA HU
Allah, Your Lord There Is No Deity Except Him.
Python Data Science NumPy Random Pareto Data Distribution
Pareto Distribution: A distribution which follows Pareto's law i.e. The Pareto principle or "80-20 rule" stating that 80% of outcomes are due to 20% of causes was named in honour of Pareto.
Pareto's Law: Pareto created a mathematical formula in the early 20th century that described the
inequalities in wealth distribution that existed in his native country of Italy.
Pareto observed that 80% of the country’s wealth was concentrated in the hands of
only 20% of the population.
A distribution following Pareto's law i.e. 80-20 distribution (20% factors cause 80% outcome).
It has the following two parameters.
1. a - shape parameter.
2. size - The shape of the returned array.
Example 1: Draw out a sample for pareto distribution with shape of 2 with size 2x4.
Code
from numpy import random
x = random.pareto(a=2, size=(2, 4))
print(x)
the output will be
[[1.20162415e-03 3.41532724e-01 4.77248653e+00 2.67404461e-01]
[2.53190234e-01 3.50017605e-01 1.82569493e+00 2.34792348e-01]]
Note: Every time the code is run the output may vary because of random generation.
Visualization of Pareto Distribution
Example 2
Code
from numpy import random
import matplotlib.pyplot as plt
import seaborn as sns
sns.distplot(random.pareto(a=2, size=1000), kde=False)
plt.show()
the output will be