def gs_Lasso_norm( xM, yV, alphas_log = (-1, 1, 9)):
print(xM.shape, yV.shape)
clf = linear_model.Lasso( normalize = True)
#parmas = {'alpha': np.logspace(1, -1, 9)}
parmas = {'alpha': np.logspace( *alphas_log)}
kf5_c = model_selection.KFold( n_splits = 5, shuffle=True)
#kf5 = kf5_c.split( xM)
gs = model_selection.GridSearchCV( clf, parmas, scoring = 'r2', cv = kf5_c, n_jobs = -1)
gs.fit( xM, yV)
return gs
评论列表
文章目录