def viz():
# Prepare data
X = np.arange(0, 10, 0.1)
test_y = X * np.sin(X)
# e = np.random.normal(0, 1, size=len(X))
# train_y = test_y + e
train_y = test_y.copy()
X = X[:, None]
print("X's shape = %s, train_y's shape = %s, test_y's shape = %s"
% (X.shape, train_y.shape, test_y.shape))
# Visualize
fig, ax = plt.subplots(1, 1, sharex=True, sharey=True, figsize=[7, 7], facecolor='w')
ani = animation.FuncAnimation(fig, run_boosted_regression_tree, range(25),
fargs=(X, train_y, test_y, ax),
blit=False, interval=1000, repeat=True)
plt.show()
# ani.save('BoostedRegressor.gif', writer='imagemagick')
评论列表
文章目录