def cv_train_test( xMa, yVa, tr, ts):
"""
Regression and test is performed for given data
with cross-validation streams
"""
xM = xMa[ tr, :]
yV = yVa[ tr, 0]
clf = linear_model.LinearRegression()
clf.fit( xM, yV)
# The testing information is extracted.
xM_test = xMa[ ts, :]
yV_test = yVa[ ts, 0]
return yV_test.A1, clf.predict( xM_test).ravel()
评论列表
文章目录