jutil.py 文件源码

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

项目:jamespy_py3 作者: jskDr 项目源码 文件源码
def mlr_show( clf, RMv, yEv, disp = True, graph = True):
    yEv_calc = clf.predict( RMv)

    if len( np.shape(yEv)) == 2 and len( np.shape(yEv_calc)) == 1:
        yEv_calc = np.mat( yEv_calc).T

    r_sqr, RMSE = jchem.estimate_accuracy( yEv, yEv_calc, disp = disp)
    if graph:
        plt.figure()
        ms_sz = max(min( 4000 / yEv.shape[0], 8), 1)
        plt.plot( yEv.tolist(), yEv_calc.tolist(), '.', ms = ms_sz)
        ax = plt.gca()
        lims = [
            np.min([ax.get_xlim(), ax.get_ylim()]),  # min of both axes
            np.max([ax.get_xlim(), ax.get_ylim()]),  # max of both axes
        ]
        # now plot both limits against eachother
        #ax.plot(lims, lims, 'k-', alpha=0.75, zorder=0)
        ax.plot(lims, lims, '-', color = 'pink')
        plt.xlabel('Experiment')
        plt.ylabel('Prediction')
        plt.title( '$r^2$ = {0:.2e}, RMSE = {1:.2e}'.format( r_sqr, RMSE))
        plt.show()

    return r_sqr, RMSE
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号