▶ Interactive Lab

Decision Boundary Visualizer

Logistic regression vs k-NN vs neural net (toy).

Advertisement
Linear models = straight boundary. k-NN = local, can be very irregular.

What you're seeing

Decision boundary: where the classifier flips its prediction. Linear models always produce a hyperplane. k-NN follows local majority — produces complex, non-linear boundaries.

Trade-off: linear models are simple/regularized/fast; k-NN/trees/NNs adapt to non-linear patterns at the cost of more data and risk of overfit.

★ KEY TAKEAWAY
Linear models: straight boundary. k-NN: local, complex. Same data, very different fits.
▶ WHAT TO TRY
  • Switch between Linear and k-NN.
  • Click Reset data for new clusters.
  • Linear underfits non-linear data; k-NN can overfit.