使用sklearn计算准确性时出现错误

时间:2018-12-19 03:36:45

标签: python machine-learning scikit-learn

我正尝试使用下面的代码找出模型的准确性,但面临错误

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)

我遇到的错误低于

  

ValueError:不支持连续多输出

样本数据

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

0 个答案:

没有答案