title: How is cv_values_ computed in sklearn.linear::RidgeCV?
body: <p>The reproducible example to fix the discussion:</p>
  
  <pre><code>from sklearn.linear_model import RidgeCV
  from sklearn.datasets import load_boston
  from sklearn.preprocessing import scale 
  
  boston = scale(load_boston().data)
  target = load_boston().target
  
  import numpy as np
  alphas = np.linspace(1.0,200.0, 5)
  fit0 = RidgeCV(alphas=alphas, store_cv_values = True, gcv_mode='eigen').fit(boston, target)
  fit0.alpha_
  fit0.cv_values_[:,0]
  </code></pre>
  
  <p>The question: what formula is used to compute <code>fit0.cv_values_</code>?</p>
  
  <h1>Edit:</h1>
  
  <p>@Abhinav Arora answer below seems to suggests that <code>fit0.cv_values_[:,0][0]</code>, the first entry of <code>fit0.cv_values_[:,0]</code> would be </p>
  
  <pre><code>(fit1.predict(boston[0,].reshape(1, -1)) - target[0])**2
  </code></pre>
  
  <p>where <code>fit1</code> is a ridge regression with alpha = 1.0, fitted to the data-set from which observation <code>0</code> was removed.</p>
  
  <p>Let's see:</p>
  
  <p>1) create new dataset with first row of original dataset removed:</p>
  
  <pre><code>from sklearn.linear_model import Ridge
  boston1 = np.delete(boston, (0), axis=0)
  target1 = np.delete(target, (0), axis=0)
  </code></pre>
  
  <p>2) fit a ridge model with alpha = 1.0 on this truncated dataset:</p>
  
  <pre><code>fit1 = Ridge(alpha=1.0).fit(boston1, target1)
  </code></pre>
  
  <p>3) check the MSE of that model on the first data-point: </p>
  
  <pre><code>(fit1.predict(boston[0,].reshape(1, -1)) - target[0])**2
  </code></pre>
  
  <p>it is <code>array([ 37.64650853])</code> which is not the same as what is produced by the <code>fit0.cv_values_[:,0]</code>, ergo:</p>
  
  <pre><code>fit0.cv_values_[:,0][0]
  </code></pre>
  
  <p>which is <code>37.495629960571137</code></p>
  
  <p>What gives?</p>