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
评论列表
文章目录