from sklearn.tree import DecisionTreeRegressor tree1 = DecisionTreeRegressor(max_depth=2) tree1.fit(X, y)
Fit first decision tree on (X, y)