Decision Tree - Hunt’s algorithm

(code by Claude, guidance by Georgios Evangelidis)

Grow a decision tree from training records. At every node the algorithm either stops with a leaf or picks the attribute test with the lowest weighted Gini index, then repeats the procedure on each child.

Training records

The algorithm

  1. Hunt(Dt):
  2. if every record in Dt has class y: leaf labeled y
  3. else if Dt is empty: leaf labeled with the parent’s majority class
  4. else if no test can split Dt (or a limit is hit): leaf labeled with the majority class
  5. else for each attribute A: find A’s split with the lowest weighted Gini
  6. pick the test with the lowest weighted Gini (largest gain)
  7. partition Dt into one child per outcome of the test
  8. for each child Di: Hunt(Di)

Gini(t) = 1 − Σj p(j | t)², and for a split into k children, Ginisplit = Σi (ni / n) × Gini(i).

The tree so far

Scroll or pinch to zoom, drag to pan, select a node to jump to its step.
100%

Classify a new record

Uses the finished tree and highlights the path the record follows.

Use your own data

Paste CSV (comma, semicolon or tab separated). The first row holds column names. If the first column is called ID, Tid, Day or Record it is used as the record identifier. The last column is the class. Columns where every value is a number are treated as continuous.