All the training tutorials that I see great a graph_viz export on the training data for some reason. I can get that to work and here is my code:
from sklearn.tree import DecisionTreeClassifier
DT = DecisionTreeClassifier(criterion = 'gini', max_depth = 5,
max_features='sqrt')
Decision_Tree = DT.fit(X_train, y)
Y_pred=Decision_Tree.predict(X_test)
from io import StringIO
dot_data = StringIO()
export_graphviz(Decision_Tree, out_file='tree.dot',
filled=True, rounded=True,
impurity=False,feature_names=X_test.columns,class_names=['Average','Won-
Booked'])
graph = pydotplus.graph_from_dot_data(dot_data.getvalue())
from subprocess import call
call(['dot', '-Tpng', 'tree.dot', '-o', 'tree.png', '-Gdpi=60'])
This all works and does not give me any error message however it creates a decision tree on training data, instead of test data. I think I need to adjust what I put into export_graphviz instead of my current "Decision_Tree" but I am not quiet sure what?