Recently, I have noticed that there is a method
sklearn.tree.export_graphviz documented here.
However, I do not know how I can apply it to a
I have tried the following naive code but it does not work, and I do not know how I can get one of the trees from a
print('Training...') forest = RandomForestClassifier(n_estimators=100) forest = forest.fit( train_data[0::,1::], train_data[0::,0] ) print('Predicting...') output = forest.predict(test_data).astype(int) if sys.version_info >= (3,0,0): predictions_file = open("myfirstforest.csv", 'w', newline='') else: predictions_file = open("myfirstforest.csv", 'wb') tree.export_graphviz(forest, out_file='tree.dot')