#Step-5: Calculate Accuracy, Precision ,Recall, and F1 Score
#Calculate accuracy
accuracy=accuracy_score(y_test, y_pred)
print("Accuracy :",accuracy)
#Calculate precision
precision= precision_score(y_test, y_pred)
print("Precision :",precision)
#Calculate recall
recall= recall_score(y_test, y_pred)
print("Recall :",recall)
#calculate the f1 score
f1= f1_score(y_test, y_pred)
print("F1 Score :",f1)
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter