I am using Leave-One-Out-Cross-Validation on a Linear Regression model. Having 8869 observations, as a result of the following:
reg = LinearRegression()
list_Rs = cross_val_score(reg, X_34_const, y_34,
cv = len(y_34),
scoring = 'r2')
I should obtain a numpy array of 8869 values included between 0 and 1, with 8 decimals. The problem is that, in producing the result, Python automatically rounds all such values to 0.0:
array([0., 0., 0., ..., 0., 0., 0.])
while instead, for instance, if I use a 2-fold-cross-validation (which implies list_Rs beinga a numpy array with 2 values), it prints the correctly not rounded values:
list_Rs = cross_val_score(reg, X_34_const, y_34,
cv = 2,
scoring = 'r2')
which, printed, is:
array([0.16496198, 0.18115719])
This is not simply a printing representation, problem, since, for instance:
print(list_Rs[3] == 0)
returns True. This is for me a major problem since, in my computations, I will then need to put the values of list_Rs at the denominator of a fraction!
How can I solve the problem so to not have automatically rounded values also in my 8869 dimensional array?
Many thanks and I look forward to hearing from you.