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)
精彩评论