16 lines
519 B
Python
16 lines
519 B
Python
|
|
# Confusion Matrix
|
|
cm = confusion_matrix(y_test, y_pred)
|
|
plt.figure(figsize=(8, 6))
|
|
sns.heatmap(cm, annot=True, fmt='d', cmap='Blues', cbar=False,
|
|
xticklabels=['<=50K', '>50K'],
|
|
yticklabels=['<=50K', '>50K'])
|
|
plt.xlabel('Vorhergesagt')
|
|
plt.ylabel('Tatsächlich')
|
|
plt.title('Confusion Matrix')
|
|
plt.savefig('output/Confusions_Matrix.png', dpi=300)
|
|
plt.show()
|
|
|
|
# Klassifikationsbericht
|
|
print("\nKlassifikationsbericht:")
|
|
print(classification_report(y_test, y_pred, target_names=['<=50K', '>50K'])) |