I'm using pandas command tree.DecisionTreeClassifier
to build a (binary) classification tree. Something along the lines of:
dcrG = tree.DecisionTreeClassifier(criterion='entropy',splitter='best',options_go_here)
dcrG.fit(train[features], train['G'])
Now that I have succesfully built my decision tree, I would like pandas to print me out the actual decision tree, so something along the lines of
if (var1>0.4)
if (var4>3.24)
if (var2<0.5)
return 1
else
return 0
else
return 1
else
if (var3>3.5)
if (var2<0.1)
return 0
else
return 1
else
if (var2>0.4)
return 1
else
return 0
so that I can export the resulting algorithm to other programming languages. How can I do this?