1

Using sklearn, i've fitted a decision tree based on some input data.

regr = DecisionTreeRegressor(max_depth=4)
regr.fit(X,Y1) 
dot_data = tree.export_graphviz(regr_2, out_file=None,feature_names=legends,
                filled=True, rounded=True, special_characters=True) 

graph = graphviz.Source(dot_data)
graph.render("Y") 

Now i have a different Y2 that is correlated with Y1.

I want to use the same decision_path as found in regr and generate the same decision tree but for Y2. This tree may not be the optimal solution for X and Y2, but would be very useful for me.

Is it possible? Thanks.

guy eyal
  • 11
  • 1
  • This answer might be of some help : https://stackoverflow.com/questions/20224526/how-to-extract-the-decision-rules-from-scikit-learn-decision-tree – Gambit1614 Sep 14 '17 at 11:33
  • Can you please elaborate a bit more? Do you want to extract rules? Then what will you do at the leaf node when decision is done. It will be in form of Y1. – Vivek Kumar Sep 14 '17 at 13:24

0 Answers0