Assignment No - 6-1
Assignment No - 6-1
In [4]: df = pd.read_csv('iris.csv')
df.head()
<matplotlib.image.AxesImage at 0x2496367c070>
Out[10]:
Confusion matrix
In [40]: from sklearn.metrics import confusion_matrix
from sklearn.metrics import classification_report
cm = confusion_matrix(Y_test, predictions)
print(f'''Confusion matrix :\n
| Positive Prediction\t| Negative Prediction
---------------+------------------------+----------------------
Positive Class | True Positive (TP) {cm[0, 0]}\t| False Negative (FN) {cm[0, 1]}
Loading [MathJax]/extensions/Safe.js
---------------+------------------------+----------------------
Negative Class | False Positive (FP) {cm[1, 0]}\t| True Negative (TN) {cm[1, 1]}\n''')
cm = classification_report(Y_test, predictions)
print('Classification report : \n', cm)
Confusion matrix :
Classification report :
precision recall f1-score support
accuracy 0.93 30
macro avg 0.93 0.93 0.93 30
weighted avg 0.93 0.93 0.93 30
In [ ]:
Loading [MathJax]/extensions/Safe.js