I've seen similar questions asked here but they all seem to be caused by a different problem. I've tried reshaping and making sure it's a 2d array but i keep getting this error. Here is my code:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.neighbors import KNeighborsClassifier
from sklearn.neighbors import KNeighborsRegressor
from io import StringIO
from sklearn.metrics import accuracy_score
from sklearn.model_selection import train_test_split
from sklearn import linear_model
d = pd.read_csv("http://www.stat.wisc.edu/~jgillett/451/data/mtcars.csv")
X = d[['cyl','disp','hp','drat','wt','qsec','vs','am','gear','carb']]
y=d[['mpg']].values
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.5, random_state=0)
model = linear_model.LinearRegression()
model.fit(X_train, y_train)
pred = model.predict(X_test).reshape(-1,1)
y_test=y_test.reshape(-1,1)
model.score(pred,y_test)
I'd appreciate any help!