i am trying to classify certain articles as fake or real.by applying logistic regression i want to extract the percentage of veracity [on hold]
i am trying to classify certain articles as fake or real.by applying logistic regression i want to extract the percentage of veracity [on hold]
clf = LogisticRegression(random_state=0)
clf.fit(tidf_train, y_train)
pred = clf.predict(tfidf_test)
score = metrics.accuracy_score(y_test, pred)
print("accuracy: %0.3f" % score)
cm = metrics.confusion_matrix(y_test, pred, labels=['FAKE', 'REAL'])
plot_confusion_matrix(cm, classes=['FAKE', 'REAL'])
print(cm)
This code gives me no error but doesnt produce the confusion matrix.Kindly suggest what might be wrong
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
Hello,i am trying to classify certain articles as fake or real.by applying logistic regression i want to extract the percentage of veracity
– naransa
Jun 29 at 17:34
If you want to get answers to your question I'd suggest you edit your original question with more info. Please refer to How to Ask for info on how to write a good question that will get answers. Right now it's hard to tell what you are looking for.
– Sagasaki
Jun 29 at 17:36
Welcome to StackOverflow. Please read and follow the posting guidelines in the help documentation, as suggested when you created this account. Minimal, complete, verifiable example applies here. We cannot effectively help you until you post your MCVE code and accurately describe the problem. We should be able to paste your posted code into a text file and reproduce the problem you described. Your posted code fails to run at all, and you haven't shown what it does produce.
– Prune
Jun 29 at 17:43
1) when someone asks you for explanations or clarifications, repeating verbatim parts of the post (or the title) surely doesn't help 2) the command
metrics.confusion_matrix
produces indeed the confusion matrix, so it is unclear what exactly is your problem - please include the exact output of your print(cm)
command– desertnaut
Jun 29 at 19:47
metrics.confusion_matrix
print(cm)
Hi, welcome to stack overflow. It'd be much more helpful if you explained what you are trying to do with your code, and what you expect to get out of it. Without knowing more background it's hard to say what may or may not be wrong. Thanks!
– Sagasaki
Jun 29 at 17:24