gaussian_contours.py 文件源码

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

项目:QuantEcon.lectures.code 作者: QuantEcon 项目源码 文件源码
def plot4():
    # Density 1
    Z = gen_gaussian_plot_vals(x_hat, ?)
    cs1 = ax.contour(X, Y, Z, 6, colors="black")
    ax.clabel(cs1, inline=1, fontsize=10)
    # Density 2
    M = ? * G.T * linalg.inv(G * ? * G.T + R)
    x_hat_F = x_hat + M * (y - G * x_hat)
    ?_F = ? - M * G * ?
    Z_F = gen_gaussian_plot_vals(x_hat_F, ?_F)
    cs2 = ax.contour(X, Y, Z_F, 6, colors="black")
    ax.clabel(cs2, inline=1, fontsize=10)
    # Density 3
    new_x_hat = A * x_hat_F
    new_? = A * ?_F * A.T + Q
    new_Z = gen_gaussian_plot_vals(new_x_hat, new_?)
    cs3 = ax.contour(X, Y, new_Z, 6, colors="black")
    ax.clabel(cs3, inline=1, fontsize=10)
    ax.contourf(X, Y, new_Z, 6, alpha=0.6, cmap=cm.jet)
    ax.text(float(y[0]), float(y[1]), r"$y$", fontsize=20, color="black")

# == Choose a plot to generate == #
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号