开发者

Object of type 'StackingClassifier' has no len()

开发者 https://www.devze.com 2022-12-07 21:11 出处:网络
I tried to print accuracy score, confusion matrix and classification report for StackingClassifier(), but there is an error that said

I tried to print accuracy score, confusion matrix and classification report for StackingClassifier(), but there is an error that said

object of type 'StackingClassifier' has no len()

Here's the code

X_train, X_test, y_train, y_test = train_test_split(X_res, y_res, test_size=test, random_state=seed)

model5 = StackingClassifier(estimators=model)
model5.fit(X_train, y_train)
pr开发者_运维知识库edicted5 = model5.predict(X_train)
accuracy5 = accuracy_score(y_test, predicted5)
matrix5 = confusion_matrix(y_test, predicted5)
report5 = classification_report(y_test, predicted5, zero_division=0)

#print('Stacking')
#print(accuracy5)
#print(matrix5)
#print(report5)

The error comes from this line

---> 13 model5.fit(X_train, y_train)
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号