I have written the code for a regression tree in jupyter notebook, but this code alone dooes not display the output. I would have used graphviz, but all the ways to use graphviz also require qeds, which my machine refuses to install. Is there any way to display this tree without graphviz or qeds?
import seaborn as sns
from sklearn.model_selection import train_test_split
from sklearn.tree import DecisionTreeRegressor
from sklearn.metrics import r2_score,mean_squared_error
x = maindf["Graduate Degree"].values.reshape(-1, 1)
y = maindf["Democrats 2016"].values.reshape(-1, 1)
x_train, x_test, y_train, y_test = train_test_split(x, y, test_size=0.30, random_state=42)
DecisionTreeRegModel = DecisionTreeRegressor(max_depth=3)
DecisionTreeRegModel.fit(x_train,y_train)
y_pred = DecisionTreeRegModel.predict(x_test)
Can use scikit-learn's tree.plot_tree for visualizing the tree.
from sklearn import tree
_ = tree.plot_tree(DecisionTreeRegModel)