ROC curve plotting and confusion matrix display issues
huhang14 opened this issue · 2 comments
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?
pycm version: 3.8
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()
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?
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.)
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.