_jgrid_r0.py 文件源码

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

项目:jamespy_py3 作者: jskDr 项目源码 文件源码
def cv_LinearRegression_ci_pred_It( xM, yV, n_folds = 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()
    yVp_ltype_l = list() # yVp_ltype is list type of yVp not matrix type
    for ni in range( N_it):
        cv_score_l, ci_l, yVp_ltype = cv_LinearRegression_ci_pred( xM, yV, n_folds = n_folds, scoring = scoring, disp = disp)
        cv_score_le.extend( cv_score_l)
        ci_le.extend( ci_l)
        yVp_ltype_l.append( yVp_ltype)

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

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

    return o_d
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号