Algorithms For Dummies


Understanding distributions



Download 7,18 Mb.
Pdf ko'rish
bet531/651
Sana15.07.2021
Hajmi7,18 Mb.
#120357
1   ...   527   528   529   530   531   532   533   534   ...   651
Bog'liq
Algorithms

Understanding distributions

Probability distribution is another idea that is important for working out better 

algorithms. A distribution is a table of values or a mathematical function that links 

every possible value of an input to the probability that such values could occur. 

Probability distributions are usually (but not solely) represented in charts whose 

abscissa axis represents the possible values of an input and whose ordinal axis 

represents the probability of occurrence. Most statistical models rely on the nor-

mal distributions, a distribution which is symmetric and has a characteristic bell 

shape. Representing a normal distribution in Python (as shown in Figure 17-1) 

requires a few lines of code. (You can find this code in the 

A4D; 17; Probability.

ipynb


 file on the Dummies site as part of the downloadable code; see the Intro-

duction for details.)

import numpy as np

from numpy.random import normal, uniform

import matplotlib.pyplot as plt

%matplotlib inline

normal_distribution = normal(size=10000) * 25 

+ 100


weights = np.ones_like(normal_distribution

                      ) / len(normal_distribution)

plt.hist(normal_distribution, bins=20, weights=weights)

plt.xlabel("Value")

plt.ylabel("Probability")

plt.show()

The plotted distribution represents an input of 10,000 numbers whose average is 

about 100. Each bar in the histogram represents the probability that a certain 

range of values will appear in the input. If you sum all the bars, you obtain the 

value of 1, which comprises all the probabilities expressed by the distribution.




326


Download 7,18 Mb.

Do'stlaringiz bilan baham:
1   ...   527   528   529   530   531   532   533   534   ...   651




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2025
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish