Neuron 101

Classification / Naive Bayes

Türkçe

Plate36

Unit 4 · Topic 4 of 10

Naive Bayes

Medium, 8 min, 8 steps

812162024283236024681012temperature, degreessunny hours
Keyboard: left and right arrows change the step, space plays and pauses.

Step 1 of 8 Days

Two classes

The red circles are days when the ice cream sold out, the blue squares days when it did not. Naive Bayes will sum up each class on its own and then compare.

Open in Colab
  1. import math
  2. def yogunluk(v, m, s2):
  3. return math.exp(-(v - m) ** 2
  4. / (2 * s2)) / math.sqrt(
  5. 2 * math.pi * s2)
  6. def puan(c, x, y):
  7. o, mx, my, vx, vy = siniflar[c]
  8. return (o * yogunluk(x, mx, vx)
  9. * yogunluk(y, my, vy))
  10. a = puan(0, 26.0, 6.0)
  11. b = puan(1, 26.0, 6.0)
  12. print(b / (a + b))
p1
0.74
sinif
1