Closed ricmarchao closed 3 years ago
Given a fitted instance...
reg = LinearTreeRegressor(base_estimator=LinearRegression())
reg.fit(X, y)
you can simply obtain a pydot.Dot object calling:
reg.model_to_dot()
you can simply display a tree structure in this way:
reg.plot_model()
as you can see from the examples in the notebook folder
ah alright thanks ! I didn't look at the examples
Hi
thanks for writing this great package!
I was trying to display the decision tree with graphviz I get this error
AttributeError: 'LinearTreeRegressor' object has no attribute 'nfeatures'
from lineartree import LinearTreeRegressor from sklearn.linear_model import LinearRegression
reg = LinearTreeRegressor(base_estimator=LinearRegression()) reg.fit(train[x_cols], train["y"])
from graphviz import Source from sklearn import tree
graph = Source( tree.export_graphviz(reg, out_file=None,feature_names=train.columns))