Neuron 101

Classification / Binary cross-entropy

Türkçe

Plate34

Unit 4 · Topic 2 of 10

Binary cross-entropy

Medium, 8 min, 8 steps

81216202428323600.250.500.751temperature, degreeschance of selling out
Keyboard: left and right arrows change the step, space plays and pauses.

Step 1 of 8 Model

One curve, 16 days

A logistic regression curve is drawn with w = 0.30, b = −6.60. It gives a probability for every day. We want to measure with one number how good this curve is.

Open in Colab
  1. import math
  2. def capraz(p, y):
  3. p = min(max(p, 1e-12), 1 - 1e-12)
  4. if y == 1:
  5. return -math.log(p)
  6. return -math.log(1 - p)
  7. w, b = 0.3, -6.6
  8. p = [1 / (1 + math.exp(-(w * a + b)))
  9. for a in x]
  10. k = [capraz(q, c)
  11. for q, c in zip(p, s)]
  12. print(sum(k) / len(k))
w
0.30
b
−6.60
kayip
0.34