Code Decision Tree Algorithm


You are given a pair of data points \( (X,y) \), where \(X\) is a list of \( (N , K ) \) and \(y\) is a list of \(N\) elements. Write a python code to Train a decision tree model for a classification problem.

Inputs
  • \( X \) (independent variables): \((N , K )\) List
  • feature_name_list : list of feature names
  • \(y\) (dependent variable): List of \(n\) elements, \( y_i \in \{0,1\}\)
  • max_height : maximum allowed Tree height
  • Class definition of decision tree Node. (DecisionTreeNode)
Output
  • Root Node of the Trained Decision Tree model.



Code Output