import numpy as np
import matplotlib.pyplot as plt
from sklearn.ensemble import GradientBoostingRegressor
%matplotlib inline
np.random.seed(1)
#设置随机数生成的种子
def f(x):
"""The function to predict."""
return x * np.sin(x)
#对x取正弦
#----------------------------------------------------------------------
# First the noiseless case
X = np.atleast_2d(np.random.unifor ...
# Mesh the input space for evaluations of the real function, the prediction and
# its MSE
xx = np.atleast_2d(np.linspace(0, 10, 1000)).T
#np.linespace 产生从0到10,1000个等差数列中的数字