Issue in calculate variance,bias python using mlxtend

325 Views Asked by At

I am using mlxtend lib for bias,variance calculation. The code is,

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)

I received the following error,

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]"

I tried to use the Xy values as numpy values. That also create error.

Any suggestion on this?

0

There are 0 best solutions below