from sklearn import cross_validation, linear_model
import numpy as np
X_digits = np.array(x)
Y_digits = np.array(y)
loo = cross_validation.LeaveOneOut(len(Y_digits))
regr = linear_model.LinearRegression()
scores = cross_validation.cross_val_score(regr, X_digits, Y_digits, scoring
    ='mean_squared_error', cv=loo)
print(scores.mean())
Scikit-learn cross validation scoring for regression