I double-checked this. Here is a *reproducable example. *This is all with
the latest version of sklearn.

*>* reg = RidgeCV(store_cv_values=True, alphas=alphas, scoring = 'r2')
*>* reg.fit(X_n,y)
*>* reg.cv_values_.max()
3.0067997986940753

where:
*alphas* = np.linspace(0.1,20,100)
*y* = array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2,
2, 2,
       0, 0, 0, 0, 0, 0, 0])

*X* = array([[ -5.28428302e-16,   0.00000000e+00,  -2.19999064e-16,
          1.52830076e-16],
       [ -5.28428302e-16,   0.00000000e+00,  -2.19999064e-16,
          1.52830076e-16],
       [ -5.28428302e-16,   0.00000000e+00,  -2.19999064e-16,
          1.52830076e-16],
       [ -5.28428302e-16,   0.00000000e+00,  -2.19999064e-16,
          1.52830076e-16],
       [ -5.28428302e-16,   0.00000000e+00,  -2.19999064e-16,
          1.52830076e-16],
       [ -5.28428302e-16,   0.00000000e+00,  -2.19999064e-16,
          1.52830076e-16],
       [ -5.28428302e-16,   0.00000000e+00,  -2.19999064e-16,
          1.52830076e-16],
       [ -5.28428302e-16,   0.00000000e+00,  -2.19999064e-16,
          1.52830076e-16],
       [ -5.28428302e-16,   0.00000000e+00,  -2.19999064e-16,
          1.52830076e-16],
       [  4.10598836e+00,   4.10519473e+00,  -1.23831292e-01,
         -3.58120002e-01],
       [ -1.49634511e+00,  -1.48534737e+00,  -7.44699320e-01,
         -5.21707366e-01],
       [  1.15238944e+00,   1.15653816e+00,  -5.59086350e-01,
         -4.86962929e-01],
       [ -5.89277031e-01,  -5.67723140e-01,  -3.35773595e-01,
         -4.29154729e-01],
       [ -5.28428302e-16,   0.00000000e+00,  -2.19999064e-16,
          1.52830076e-16],
       [ -5.28428302e-16,   0.00000000e+00,  -2.19999064e-16,
          1.52830076e-16],
       [ -5.28428302e-16,   0.00000000e+00,  -2.19999064e-16,
          1.52830076e-16],
       [  1.04652371e+00,   1.01747313e+00,   2.16844517e+00,
          1.41636638e+00],
       [ -8.79087869e-01,  -8.73607733e-01,  -6.65173853e-01,
         -5.08300017e-01],
       [ -1.43915459e+00,  -1.42973630e+00,  -7.20168891e-01,
         -5.17808205e-01],
       [  6.81670404e-01,   6.83725707e-01,  -8.24766569e-01,
         -5.32966224e-01],
       [ -5.28428302e-16,   0.00000000e+00,  -2.19999064e-16,
          1.52830076e-16],
       [  5.98655889e-01,   6.00290477e-01,  -5.98869468e-01,
         -4.95426767e-01],
       [ -4.03737715e-01,  -4.00872898e-01,  -5.42426886e-01,
         -4.83253814e-01],
       [  7.93287490e-01,   7.94973434e-01,   1.04975483e+00,
          3.20241539e-01],
       [ -5.70823345e-01,  -5.67723140e-01,  -5.96597573e-01,
         -4.94958361e-01],
       [ -4.50036216e-01,  -4.28681436e-01,  -4.40120598e-01,
         -4.58342629e-01],
       [  2.87717055e-01,   2.94368277e-01,  -6.04020363e-01,
         -4.96482047e-01],
       [ -4.82383101e-01,  -4.84298372e-01,  -4.77444077e-01,
         -4.67855887e-01],
       [ -1.01300471e+00,  -1.01264293e+00,  -4.11780260e-01,
         -4.50792857e-01],
       [ -1.34238266e+00,  -1.40193059e+00,   4.42655910e+00,
          4.96552392e+00]])


Josh


On Thu, Oct 24, 2013 at 9:50 AM, Josh Wasserstein <[email protected]>wrote:

> I am getting R2 values above 1 (e.g.  1.063). I thought that R2 could not
> be higher than 1.  What is the highest value that R2 can take?
>
> The specific call I am making is:
>
>   alphas = np.linspace(0.1,20,100)
>   reg = RidgeCV(store_cv_values=True, alphas=alphas, scoring = 'r2')
>   reg.fit(X,y)
>
> where X is the result of calling:
>   scaler = preprocessing.StandardScaler().fit(X_original)
>   X = scaler.transform(X)
>
> on a real-valued X_original
>
> and y has values that range between [0 and 300]
>
> Thanks,
>
> Josh
>
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to