from sklearn.datasets import load_boston data = load_boston() print data.keys() print data.data.shape print data.target.shape print data.DESCR %pylab inline plt.hist(data.target) plt.xlabel('price ($1000s)') plt.ylabel('count') from sklearn.linear_model import LinearRegression clf = LinearRegression() clf.fit(data.data, data.target) predicted = clf.predict(data.data) plt.scatter(data.target, predicted) plt.plot([0, 50], [0, 50], '--k') plt.axis('tight') plt.xlabel('True price ($1000s)') plt.ylabel('Predicted price ($1000s)') from sklearn.tree import DecisionTreeRegressor # Instantiate the model, fit the results, and scatter in vs. out