kgrid_r0.py 文件源码

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

项目:jamespy_py3 作者: jskDr 项目源码 文件源码
def cv_LinearRegression_ci_It( xM, yV, n_splits = 5, scoring = 'median_absolute_error', N_it = 10, disp = False, ldisp = False):
    """
    N_it times iteration is performed for cross_validation in order to make further average effect. 
    The flag of 'disp' is truned off so each iteration will not shown.  
    """
    cv_score_le = list()
    ci_le = list()
    for ni in range( N_it):
        cv_score_l, ci_l = cv_LinearRegression_ci( xM, yV, n_splits = n_splits, scoring = scoring, disp = disp)
        cv_score_le.extend( cv_score_l)
        ci_le.extend( ci_l)

    o_d = {'mean': np.mean( cv_score_le),
           'std': np.std( cv_score_le),
           'list': cv_score_le,
           'ci': ci_le}

    if disp or ldisp:
        print('{0}: mean(+/-std) --> {1}(+/-{2})'.format( scoring, o_d['mean'], o_d['std']))

    return o_d
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号