Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ROC curve plotting and confusion matrix display issues #502

Open
huhang14 opened this issue Apr 29, 2023 · 2 comments
Open

ROC curve plotting and confusion matrix display issues #502

huhang14 opened this issue Apr 29, 2023 · 2 comments

Comments

@huhang14
Copy link

Description

Hello sepandhaghighi, thank you for writing such a convenient and useful library. I have two questions. can pycm plot ROC curves? I didn't find anything about it in the documentation. Also, I can display the confusion matrix normally under windows system, but it displays abnormally under linux system, do you know what causes it?
image

pycm version: 3.8

@sadrasabouri
Copy link
Collaborator

Description

Hello sepandhaghighi, thank you for writing such a convenient and useful library. I have two questions. can pycm plot ROC curves? I didn't find anything about it in the documentation.

Hi @huhang14, I hope you are doing well. We are happy you found Pycm useful for your work.
The ROC Curve has been added in version 3.7 and you can use it like the code below. You can also find more examples in Document.ipynb.

import numpy as np
from pycm import ROCCurve
import matplotlib.pyplot as plt

crv = ROCCurve(
    actual_vector=np.array([1, 1, 2, 2]),
    probs=np.array([[0.1, 0.9], [0.4, 0.6], [0.35, 0.65], [0.8, 0.2]]),
    classes=[2, 1])

crv.plot(classes=[2])
plt.show()

roc

You may be right about README.md document section. @sepandhaghighi should we add an example with a plotted curve in README.md, too?

Also, I can display the confusion matrix normally under windows system, but it displays abnormally under linux system, do you know what causes it? image

pycm version: 3.8

I don't know about this 😕
Would you please provide us with more details? (like your operating system version, the code you're running and etc.)

@huhang14
Copy link
Author

Thank you for your answer, it's very helpful for me!
I am using Ubuntu 18.04.1 LTS with the following code

cm.plot(cmap=plt.cm.Blues, number_label=True, plot_lib="matplotlib")

After testing, I can get a normal display with the same code on windows, but not on ubuntu.
Meanwhile, I ran other code for drawing confusion matrix on ubuntu

sns.heatmap(conf_matrix, annot=True, annot_kws={"size": 14}, cmap="Blues")

Sadly, this code also does not display the confusion matrix properly. So this probably has nothing to do with pycm, but is caused by something else. Thanks again for your answer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants