code.py 文件源码

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

项目:COMSW4721_MachineLearning_HomeWork 作者: aarshayj 项目源码 文件源码
def gp_partd(Xtrain,ytrain,Xtest,ytest):
    gp = gaussian_process(Xtrain[:,3],ytrain,Xtrain[:,3],ytrain)


    gp.init_kernel_matrices(b=5,var=2)
    gp.predict_test()

    x = np.asarray(Xtrain[:,3]).flatten()
    xsortind = np.argsort(x)
    y1 = np.asarray(ytrain).flatten()
    y2 = np.asarray(gp.test_predictions).flatten()
    plt.figure()
    plt.scatter(x[xsortind],y1[xsortind])
    plt.plot(x[xsortind],y2[xsortind],'b-')
    plt.xlabel('Car Weight (Dimension 4)')
    plt.ylabel('Outcome')
    plt.title('Visualizing model through single dimension')
    plt.savefig('hw3_gaussian_dim4_viz')
    plt.show()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号