I looked at several examples and followed them but not able to print tree graphs.
R_forest = RandomForestRegressor(bootstrap=False,
max_depth=30,
max_features ='sqrt',
min_samples_leaf= 4,
min_samples_split=2,
n_estimators = 600)
model=R_forest.fit(X_train,y_train)
from sklearn.datasets import *
from sklearn import tree
from sklearn.tree import export_graphviz
import graphviz
import pydot
tree = R_forest.estimators_[5]
# Export the image to a dot file
export_graphviz(tree, out_file = 'tree.dot', feature_names = X_train.columns,
rounded = True, precision = 1)
# Use dot file to create a graph
(graph, ) = pydot.graph_from_dot_file('tree.dot')
# Write graph to a png file
graph.write_png('tree.png')
I get this error:
FileNotFoundError: [WinError 2] "dot.exe" not found in path.
I followed this solution but still getting same error.
Screenshot of my system.
Any help or advise appreciated