boosted_regressor_viz.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:VanillaML 作者: vinhkhuc 项目源码 文件源码
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')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号