Commit 3c05185a authored by Petra's avatar Petra

visualize regression tree

parent d4974f39
......@@ -31,7 +31,7 @@ print("data shape: ", df.shape)
# reg_tree = tree.DecisionTreeRegressor()
# knn = KNeighborsRegressor(n_neighbors=2)
#
# learner = knn
# learner = reg_tree
#
# """" Train and apply """
# learner.fit(X_train, y_train)
......@@ -46,3 +46,10 @@ print("data shape: ", df.shape)
# print("MSE \t{0:5.2f}".format( metrics.mean_squared_error(y_test,y_pred)))
# print("R2 \t{0:5.2f}".format( metrics.r2_score(y_test,y_pred)))
#
# # """ Visualize the tree """
# # treeFileName = 'reg_tree.dot'
# # tree.export_graphviz(learner, out_file='treeFileName.dot')
#
# # install GraphViz
# # $ dot -Tps reg_tree.dot -o tree.ps (PostScript format)
# # $ dot -Tpng reg_tree.dot -o tree.png (PNG format)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment