Data Science Asked by tamilini on June 27, 2021
I applied the random forest classifier to my csv file to classify the tweets as spam or not spam and after an accuracy of 93%, when I printed the confusion matrix I got
[[1068 105]
[ 65 1262]].
Now I would like to print the 65 false negative tweets and the 105 false positive tweets but I am unable to do that. I tried to print the y_test and y_predict but it is difficult to map the incorrectly identified tweets. Has anyone please got any advice on this?
RandomForest = RandomForestClassifier()
RandomForest.fit(x_train, y_train)
y_predict = RandomForest.predict(x_test)
print(confusion_matrix(y_test,y_predictRF))
Thank you
Assuming that you have a column called „target“ and „predicted“:
FN = df[(df[„predicted“]==0) & (df[„target“] == 1)]
and vice versa for FP.
Answered by Predicted Life on June 27, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP