def regress(y, x, test_x=[]): if len(test_x) == 0: test_x = x clf = DecisionTreeRegressor() clf.fit(x, y) y_p = clf.predict(test_x) plt.scatter(y, y_p)