I am using this dataset for the analysis (Generated using make_regression of sklearn library)
I was trying to learn the DecisionTreeRegression algorithm of sklearn library. I used the following code to fit the regressor.
from sklearn.tree import DecisionTreeRegressor as DTR regressor1 = DTR(max_depth=2) regressor1.fit(X,y) y_pred1 = regressor1.predict(X)
These are the leaf node values that I got,
It seems like, the decision tree first did a split on prop 2 at -1.0923644932716892 for the root node then on the right child of the root it again did another split on prop 2 at 0.0340153523120978.
But what I learnt about Decision Trees is that is a split is done at a property then in the same branch the property should not be used again. Then why the sklearn library is doing this thing?