在Pandas中,評估分類模型的性能通常需要使用混淆矩陣和一些評估指標。
confusion_matrix = pd.crosstab(y_true, y_pred)
from sklearn.metrics import accuracy_score, recall_score, f1_score
accuracy = accuracy_score(y_true, y_pred)
recall = recall_score(y_true, y_pred)
f1 = f1_score(y_true, y_pred)
print("Accuracy: ", accuracy)
print("Recall: ", recall)
print("F1 score: ", f1)
from sklearn.metrics import classification_report
report = classification_report(y_true, y_pred)
print(report)
通過以上方法,可以在Pandas中評估分類模型的性能并獲取詳細的性能指標。