<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 2A.ML101.4
Step1:  We can see that there are just over 500 data points.
The DESCR variable has a long description of the dataset
Step2:  It often helps to quickly visualize pieces of the data using histograms, scatter plots,
or other plot types.  Here we'll load pylab and show a histogram of the target values
Step3:  Let's have a quick look to see if some features are more relevant than others for our problem
Step4:  This is a manual version of a technique called feature selection.
Sometimes, in Machine Learning it is useful to use 
feature selection to decide which features are most useful for a
particular problem.  Automated methods exist which quantify this sort
of exercise of choosing the most informative features.
Predicting Home Prices
Step5:  The prediction at least correlates with the true price, though there
are clearly some biases.  We could imagine evaluating the performance
of the regressor by, say, computing the RMS residuals between the
true and predicted price.  There are some subtleties in this, however,
which we'll cover in a later section.
Exercise
Step6:  Solution
<ASSISTANT_TASK:>
Python Code:
from sklearn.datasets import load_boston
data = load_boston()
print(data.data.shape)
print(data.target.shape)
Explanation: 2A.ML101.4: Supervised Learning: Regression of Housing Data
Here we'll do a short example of a regression problem: learning a continuous value
from a set of features.
We'll use the simple Boston house prices set, available in scikit-learn.  This
records measurements of 13 attributes of housing markets around Boston, as well
as the median price.  The question is: can you predict the price of a new
market given its attributes?
Source: Course on machine learning with scikit-learn by Gaël Varoquaux
End of explanation
print(data.DESCR)
Explanation: We can see that there are just over 500 data points.
The DESCR variable has a long description of the dataset:
End of explanation
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
plt.hist(data.target)
plt.xlabel('price ($1000s)')
plt.ylabel('count');
Explanation: It often helps to quickly visualize pieces of the data using histograms, scatter plots,
or other plot types.  Here we'll load pylab and show a histogram of the target values:
the median price in each neighborhood.
End of explanation
for index, feature_name in enumerate(data.feature_names):
    plt.figure()
    plt.scatter(data.data[:, index], data.target)
    plt.ylabel('Price')
    plt.xlabel(feature_name)
Explanation: Let's have a quick look to see if some features are more relevant than others for our problem
End of explanation
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(data.data, data.target)
from sklearn.linear_model import LinearRegression
clf = LinearRegression()
clf.fit(X_train, y_train)
predicted = clf.predict(X_test)
expected = y_test
plt.scatter(expected, predicted)
plt.plot([0, 50], [0, 50], '--k')
plt.axis('tight')
plt.xlabel('True price ($1000s)')
plt.ylabel('Predicted price ($1000s)')
print("RMS:", np.sqrt(np.mean((predicted - expected) ** 2)))
Explanation: This is a manual version of a technique called feature selection.
Sometimes, in Machine Learning it is useful to use 
feature selection to decide which features are most useful for a
particular problem.  Automated methods exist which quantify this sort
of exercise of choosing the most informative features.
Predicting Home Prices: a Simple Linear Regression
Now we'll use scikit-learn to perform a simple linear regression
on the housing data.  There are many possibilities of regressors to
use. A particularly simple one is LinearRegression: this is
basically a wrapper around an ordinary least squares calculation.
We'll set it up like this:
End of explanation
from sklearn.ensemble import GradientBoostingRegressor
# Instantiate the model, fit the results, and scatter in vs. out
Explanation: The prediction at least correlates with the true price, though there
are clearly some biases.  We could imagine evaluating the performance
of the regressor by, say, computing the RMS residuals between the
true and predicted price.  There are some subtleties in this, however,
which we'll cover in a later section.
Exercise: Gradient Boosting Tree Regression
There are many other types of regressors available in scikit-learn:
we'll try a more powerful one here.
Use the GradientBoostingRegressor class to fit the housing data.
You can copy and paste some of the above code, replacing LinearRegression
with GradientBoostingRegressor.
End of explanation
from sklearn.ensemble import GradientBoostingRegressor
clf = GradientBoostingRegressor()
clf.fit(X_train, y_train)
predicted = clf.predict(X_test)
expected = y_test
plt.scatter(expected, predicted)
plt.plot([0, 50], [0, 50], '--k')
plt.axis('tight')
plt.xlabel('True price ($1000s)')
plt.ylabel('Predicted price ($1000s)')
print("RMS:", np.sqrt(np.mean((predicted - expected) ** 2)))
Explanation: Solution:
End of explanation
<END_TASK>