train_test_split: 值错误
train_test_split: ValueError
我目前正在尝试计算特定多项式回归模型的均方误差。但是,当我 运行 train_test_split
时,我收到一条错误消息:
ValueError:要解压的值太多(预期为 2 个)
这是我编写的代码:
def mse(X, y, degree, model):
X_train, y_train = train_test_split(X, y, test_size=0.6, random_state=10)
train_errors = []
for m in range(1, len(X_train)):
model.fit(X_train[:m], y_train[:m])
y_train_predict = model.predict(X_train[:m])
mse = train_errors.append(mean_squared_error(y_train[:m], y_train_predict))
return mse
我不确定为什么会收到此错误或我可以更改哪些内容以使代码正常工作!如有任何建议,我们将不胜感激!
train_test_split
也returns测试样本:
X_train, X_test, y_train, y_test = train_test_split(
X, y, test_size=0.6, random_state=10)
我目前正在尝试计算特定多项式回归模型的均方误差。但是,当我 运行 train_test_split
时,我收到一条错误消息:
ValueError:要解压的值太多(预期为 2 个)
这是我编写的代码:
def mse(X, y, degree, model):
X_train, y_train = train_test_split(X, y, test_size=0.6, random_state=10)
train_errors = []
for m in range(1, len(X_train)):
model.fit(X_train[:m], y_train[:m])
y_train_predict = model.predict(X_train[:m])
mse = train_errors.append(mean_squared_error(y_train[:m], y_train_predict))
return mse
我不确定为什么会收到此错误或我可以更改哪些内容以使代码正常工作!如有任何建议,我们将不胜感激!
train_test_split
也returns测试样本:
X_train, X_test, y_train, y_test = train_test_split(
X, y, test_size=0.6, random_state=10)