mb

decision tree

a decision tree asks one question at a time: is x below this value, or y? it picks the question that makes the two sides purest, the one with the biggest information gain, then asks again on each side. it never looks ahead, so it can only cut straight across.

12 points

shaded: boxes that say circle. inked: the cuts. dashed: the selected node's box

arrow keys move the crosshair, shift for finer steps. tap to place. keys: arrows, enter, backspace to erase

2
depth
2
leaves
4
right
12/12

the full tree: 3 cuts

  • root: cut x < 0.00
  • yes, depth 1: cut y < 0.00
  • yes, depth 2: leaf, 3 circles, 0 squares
  • no, depth 2: leaf, 0 circles, 3 squares
  • no, depth 1: cut y < 0.00
  • yes, depth 2: leaf, 0 circles, 3 squares
  • no, depth 2: leaf, 3 circles, 0 squares

selected: 6 points, 3● 3□, gini 0.500

best cutsgain
y < 0.00 chosen0.500
y < -0.400.250
y < 0.400.250
y < -0.600.100
y < 0.600.100

gain: the parent's impurity minus its children's, weighted by size. gini is the chance two random points differ, entropy is in bits. equal gains go to the most even cut.

try this

  1. set max depth to 1. on xor every first cut has a gain of exactly 0, since each side is still half circles. go back to 2 and that useless cut makes two perfect ones possible.
  2. pick outliers and slide max depth up to 5. the tree cuts until each of the four strays sits in a box of its own: all 24 right, with cuts that only fit these points.
  3. pick separable. where the perceptron needs one slanted line, the tree builds a staircase of four cuts, and three of its boxes hold a single point.