1

我正在使用 mlxtend lib 进行偏差、方差计算。代码是,

y=df[target]
x=df.drop(target,axis=1)
x_train, x_test, y_train, y_test = train_test_split(X, y, test_size=0.33, random_state=1)
model = LinearRegression()
mse, bias, var = bias_variance_decomp(model, x_train, y_train, x_test, y_test, loss='mse', num_rounds=200, random_seed=1)

我收到以下错误,

raise KeyError(f"None of [{key}] are in the [{axis_name}]")

KeyError: "None of [Int64Index([ 37, 235,  72, 255, 203, 133, 144, 129,  71, 237,\n            ...\n            221, 244, 204, 105,  36, 112, 144, 158, 115, 106],\n           dtype='int64', length=292)] are in the [columns]"

我尝试将 Xy 值用作 numpy 值。这也会产生错误。

对此有何建议?

4

0 回答 0