Hi. I'm trying to find the cross validation score using Linear regression model but am getting scores more than 1.

I have attached the data, code as well as the output. Kindly help if possible. Thanks :)

[

attachment=1061]

Please show what you have tried (code) so far.

(May-17-2021, 03:48 PM)Larz60+ Wrote: [ -> ]Please show what you have tried (code) so far.

Hi!Please find the code below. A big Thanks for your time! :)

import pandas as pd
data=pd.read_csv(r'C:\Users\Personal\Desktop\Sample.csv',nrows=30)
data
from sklearn.linear_model import LinearRegression
from sklearn.model_selection import cross_val_score
import numpy as np
lr=LinearRegression()
x,y=data.iloc[:,0:2],data.iloc[:,[2]]
lr=LinearRegression()
cross_val_score(lr, x, y,cv=5)

(May-16-2021, 02:45 PM)vasu2798 Wrote: [ -> ]Hi. I'm trying to find the cross validation score using Linear regression model but am getting scores more than 1.

I have attached the data, code as well as the output. Kindly help if possible. Thanks :)

sorry, but have You understood what cv does ???

how many scores You thought 5 folds cv would returns??

(May-20-2021, 08:08 PM)Caprone Wrote: [ -> ] (May-16-2021, 02:45 PM)vasu2798 Wrote: [ -> ]Hi. I'm trying to find the cross validation score using Linear regression model but am getting scores more than 1.

I have attached the data, code as well as the output. Kindly help if possible. Thanks :)

sorry, but have You understood what cv does ???

how many scores You thought 5 folds cv would returns??

Hey Sorry. I guess I didn't frame my question right. I'm getting cv score values more than 1. I thought they would be in the range between 0.0 to 1.0

(May-20-2021, 08:24 PM)vasu2798 Wrote: [ -> ] (May-20-2021, 08:08 PM)Caprone Wrote: [ -> ]sorry, but have You understood what cv does ???

how many scores You thought 5 folds cv would returns??

Hey Sorry. I guess I didn't frame my question right. I'm getting cv score values more than 1. I thought they would be in the range between 0.0 to 1.0

ok if your metric is R2 than a score greater than 1 does not make sense; this may be because your data sample is very small, then variance can be very high; try to post a reproducible code with representative data