0

i am trying to find out the accuracy of my model using below code but facing error

X = df.iloc[:,-1].values.reshape(-1,1)
Y = df.iloc[:,0:2].values
X_train,X_test,Y_train,Y_test = train_test_split(X,Y,test_size = 20)
reg = LinearRegression()
model = reg.fit(X_train, Y_train)
pred = model.predict(X_test)
score = accuracy_score(pred,Y_test)
print(score)

error i am getting is below

ValueError: continuous-multioutput is not supported

Sample Data

R&D Spend,Administration,Marketing Spend,State,Profit
165349.2,136897.8,471784.1,New York,192261.83
162597.7,151377.59,443898.53,California,191792.06
153441.51,101145.55,407934.54,Florida,191050.39
144372.41,118671.85,383199.62,New York,182901.99
LUZO
  • 1,019
  • 4
  • 19
  • 42
  • @coldspeed I am not using GridSearchCV to avoid "recall". i guess question is not duplicate – LUZO Dec 19 '18 at 03:53
  • Please show your data and/or provide a [mcve] that helps us reproduce the issue and I'll reopen. – cs95 Dec 19 '18 at 03:54
  • @coldspeed updated the question with sample data – LUZO Dec 19 '18 at 03:57
  • Okay, how do you think the accuracy for real valued predictions should be calculated? – cs95 Dec 19 '18 at 04:11
  • @coldspeed I followed this https://stackoverflow.com/questions/42471082/how-to-find-out-the-accuracy – LUZO Dec 19 '18 at 06:25
  • That's for a classification problem. This is a regression problem? This is a really basic difference, and if you cannot tell then I strongly recommend doing a little reading up on the concepts. – cs95 Dec 19 '18 at 06:26
  • @coldspeed i am new to ML. can you suggest how to calculate accuracy for regression ? any default API like accuracy_score – LUZO Dec 19 '18 at 06:29
  • check out `mean_squared_error`. The the closer this value is to 0, the better your model* (* - your mileage may vary). – cs95 Dec 19 '18 at 06:35
  • @coldspeed its giving me greater value , so i used r2_score its giving me proper score. Thanks for your inputs – LUZO Dec 19 '18 at 06:50

0 Answers0