Neuron 101

Math foundations / Distributions and entropy

Türkçe

Plate11

Unit 1 · Topic 11 of 11

Distributions and entropy

Medium, 8 min, 7 steps

123456sum of the dice
Keyboard: left and right arrows change the step, space plays and pauses.

Step 1 of 7 One die

One die

On a single die each of the six faces comes up with probability 1/6. The bars are equal: a uniform distribution. The mean is 3.50.

Open in Colab
  1. import math
  2. from collections import Counter
  3. dagilim = Counter({0: 1.0})
  4. for _ in range(4):
  5. yeni = Counter()
  6. for t, olas in dagilim.items():
  7. for yuz in range(1, 7):
  8. yeni[t + yuz] += olas / 6
  9. dagilim = yeni
  10. p = 0.5
  11. H = -(p * math.log2(p)
  12. + (1 - p) * math.log2(1 - p))
k
1
ortalama
3.50
varyans
2.92
p
0.50
entropi
1