Efficient python code for running ridge regression with cross validation