Neuron 101

Classification / Kernel trick

Türkçe

Plate40

Unit 4 · Topic 8 of 10

Kernel trick

Hard, 8 min, 8 steps

81216202428323640050100150200250temperature, degreesz = (temperature − 24)²
Keyboard: left and right arrows change the step, space plays and pauses.

Step 1 of 8 Data

Mild days

One feature: temperature. On very cold days nobody buys ice cream, and on very hot days few go out. The ice cream sells out only on mild days: red circles in the middle, blue squares at both ends.

Open in Colab
  1. x = [10, 13, 16, 19, 21, 23,
  2. 25, 27, 29, 32, 35, 38]
  3. s = [0, 0, 0, 1, 1, 1,
  4. 1, 1, 1, 0, 0, 0]
  5. m = 24.0
  6. z = [(v - m) ** 2 for v in x]
  7. def kernel(a, b):
  8. return ((a - m) * (b - m)) ** 2
  9. # z eksenindeki eşik iki sıcaklık
  10. # eşiğine döner: m ± √eşik
m
24
esik
44.50
hata
0