Rajiv Shah /ML / AI ARCADETeaching ↗
STUDY / 02

Explore Classification

Learn boundaries between labeled classes.

Decision tree

1 tree
Cyan circle: class 0Coral square: class 1Darker shading: stronger prediction
99%training accuracy
95%test accuracy
0.065test log loss
Inspect the tree
y < 0.35?
Yes:
  Leaf: 100% coral (22 points)
No:
  y < 0.63?
  Yes:
    x < 0.27?
    Yes:
      Leaf: 100% coral (10 points)
    No:
      … more splits
  No:
    y < 0.67?
    Yes:
      Leaf: 67% coral (3 points)
    No:
      Leaf: 100% coral (19 points)

Each split chooses an axis and threshold to reduce class mixing.

Inspect held-out predictions
Test pointxyActual classP(coral)Correct?
10.4140.409Cyan circle0.000Yes
20.4990.150Coral square1.000Yes
30.4100.582Cyan circle0.000Yes
40.6250.190Coral square1.000Yes
50.3630.440Cyan circle0.000Yes
60.7160.771Coral square1.000Yes
70.6380.557Cyan circle0.000Yes
80.1580.468Coral square1.000Yes
90.6060.379Cyan circle0.000Yes
100.4090.812Coral square1.000Yes
110.6390.484Cyan circle0.000Yes
120.1600.427Coral square1.000Yes
130.3540.472Cyan circle0.000Yes
140.8010.649Coral square0.667Yes
150.5510.617Cyan circle0.000Yes
160.8060.316Coral square1.000Yes
170.4510.619Cyan circle0.000Yes
180.6940.793Coral square1.000Yes
190.5490.385Cyan circle0.000Yes
200.5870.146Coral square1.000Yes
210.4640.621Cyan circle0.000Yes
220.6430.789Coral square1.000Yes
230.5950.576Cyan circle0.000Yes
240.5740.162Coral square1.000Yes
250.6140.472Cyan circle0.000Yes
260.7500.260Coral square1.000Yes
270.5930.442Cyan circle0.000Yes
280.8280.339Coral square1.000Yes
290.5150.644Cyan circle0.667No
300.2780.220Coral square1.000Yes
310.6300.583Cyan circle0.000Yes
320.8620.543Coral square1.000Yes
330.3540.460Cyan circle0.000Yes
340.6540.212Coral square1.000Yes
350.3790.440Cyan circle0.000Yes
360.6970.221Coral square1.000Yes
370.4620.636Cyan circle0.667No
380.7850.330Coral square1.000Yes
390.3880.589Cyan circle0.000Yes
400.3730.836Coral square1.000Yes
A perfect fit can be a warning.

Compare linear SVM and RBF SVM on rings: a straight boundary cannot separate the inner and outer classes. The RBF kernel uses exp(−γ‖x−x′‖²). SVMs use a soft-margin C-SVC objective and a bounded SMO solver; margin contours are sampled on a display grid. For kNN, compare k = 1 and k = 15 with noisy labels. Logistic regression minimizes mean cross-entropy plus λ‖w‖²/2. All models use the same training split. SVM reference ↗ Add 20% label noise, then increase tree depth. Training accuracy can climb while test accuracy stays flat or falls. Compare the forest. For the neural network, start with two hidden neurons, then try eight and train again. This is a small, single-hidden-layer teaching model. Explore the full TensorFlow Playground ↗

Source / Andrej Karpathy