plot_helpers_deux.py 文件源码

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

项目:Bayesian-Optimisation 作者: hyperc54 项目源码 文件源码
def update_interface_2D(ax,ax2,ax3,solver,bbox,history):
    x = np.linspace(0, 1, 200)
    y = np.linspace(0, 1, 200)
    x,y=np.meshgrid(x, y)
    xx=x.ravel()
    yy=y.ravel()
    #z=map(lambda x:bbox.queryAt(x),[np.array(i) for i in zip(xx,yy)])
    points_pred= np.array(map(lambda s:np.array(s),zip(xx,yy)))
    z_pred, sigma2_pred = solver.gp.predict(points_pred, eval_MSE=True)
    #target=min(map(lambda x:bbox.queryAt(x),[np.array(i) for i in history]))
    target=min(list(np.array(history)[:,1]))
    u=(target-z_pred)/np.sqrt(sigma2_pred)
    ax.clear()
    ax2.clear()
    #c1=ax.contourf(x,y,np.array(z).reshape(-1,len(x[0])))
    tt=np.array(map(np.asarray,np.array(history).reshape(-1,2)[:,0]))
    ax.scatter(tt[:,0],tt[:,1])

    c2=ax2.contourf(x,y,np.array(z_pred).reshape(-1,len(x[0])))
    c3=ax3.contourf(x,y,np.array(np.sqrt(sigma2_pred)*(u*norm.cdf(u)+norm.pdf(u))).reshape(-1,len(x[0])))
    ax2.scatter(tt[:,0],tt[:,1])
    ax3.scatter(tt[:,0],tt[:,1])
    #c1.set_clim(min(z),max(z))
    #c2.set_clim(min(z),max(z))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号