roc_comparison
roc_comparison copied to clipboard
Incorrect output
Thanks a lot for your code! It helped me a lot. In the implementation of this roc comparison, I ran into a problems:
You see, I calculated y_prob_xgboost and y_prob_simple from previous model. Those two are of probabilities between 0-1. The y_test represent the true result.
In the code below, I used the function you kindly provided in the compare_auc_delong_xu module:
delongcov=compare_auc_delong_xu.delong_roc_test(y_test,y_prob_xgboost,y_prob_simple) print(delongcov)
However, I get a result of
[[-15.40781058]]
It did not make sense since I read some of the functions. I believe the function of "calc_pvalue" is to calculate to p value, which mean it is >0 instead of a negative one. By the way, I did not run into any error information during run it. IT MEANS THAT MY PROBLEM MAY NOT BE THE ERROR YOU ASSERTED.
Would you please tell me how it may be caused? Thanks a lot!
Hello, Thank you for your code. I have the same error .... and get a -0.24844165 p_value. However reading the code ... the function returns Log_10(p_value), which may explain. Just take p_value_test = np.exp(np.log(10)*p_value_test) Hence the issue is closed. Kind regards,
Hello, Thank you for your code. I have the same error .... and get a -0.24844165 p_value. However reading the code ... the function returns Log_10(p_value), which may explain. Just take p_value_test = np.exp(np.log(10)*p_value_test) Hence the issue is closed. Kind regards,
Thanks a lot for addressing the question. Indeed, the result can be positive after np.exp the result. However, I am still confused at the result returned by the calc_value function. In the last line:
return np.log10(2) + scipy.stats.norm.logsf(z, loc=0, scale=1) / np.log(10)
It seems the calculate the logsf of z(z was derived from aucs, after reading some content of the original paper, I guess the z is a parameter calculated using matrix ) ,and divide it by log(10). How can I tell it, that the real pvalue is the result of np.exp(np.log(10)*p_value_test) instead of just np.log(10)*p_value_test?
Pardon me for my lack in math, it is just a little bit hard for me. Your help is already very useful.