Why logistic regression example code does not port to linear regression example?
I suspect that you are missing this mapping:

# Map predictions to outcomes (only possible outcomes are 1 and 0)
predictions[predictions &gt; .5] = 1
predictions[predictions &lt;=.5] = 0


Basically, what linear regression produces after a call to predict is a set of numbers (scores), then we need to manually map it back to class label. cross_validation.cross_val_score doesn't do the mapping for us, so what it ends up doing is comparing scores with class labels, which turns out to be bad.

On the other hand, predict of logistic regression gives us the class label (Reference)