-
-
Notifications
You must be signed in to change notification settings - Fork 552
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
Fix scaling in cox ph prediction #295
Conversation
@@ -925,12 +927,79 @@ def test_hazard_works_as_intended_with_strata_against_R_output(self, rossi): | |||
npt.assert_almost_equal(cp.baseline_cumulative_hazard_[(0, 0, 0, 0)].ix[[14, 35, 37, 43, 52]].values, [0.076600555, 0.169748261, 0.272088807, 0.396562717, 0.396562717], decimal=2) | |||
npt.assert_almost_equal(cp.baseline_cumulative_hazard_[(0, 0, 0, 1)].ix[[27, 43, 48, 52]].values, [0.095499001, 0.204196905, 0.338393113, 0.338393113], decimal=2) | |||
|
|||
def test_baseline_survival_is_the_same_indp_of_location(self, regression_dataset): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these tests should convince you that the internal normalization is transparent to the user.
Hi, sorry for the late reply, I have been offline for a few days. I am happy to test this. Is the new code available in a release? Andrea. |
Hey, yes it should be as 0.10.1 |
Hi, things look a lot better now, thanks for the fix. I noticed, however, that the plot() function of the KM fitter is apparently broken. Any attempt to use it (kmf.plot(ax=my_ax)) results in a quite spectacular stack trace, but I think the culprit is in
Plotting by hand the survival function works, so I guess the problem is really in your plotting utility. Thanks for your help, Andrea. |
I investigated the plotting problem. If I manually specify a color, the error disappears. this is, however, annoying, since I want to plot several lines on the same axes and let matplotlib choose the different colors automatically... |
ah, strange, may be a matplotlib 2.x compatibility. Can you post your version of matplotlib here please? |
hi, I am using matplotlib 2.0.2 |
This kmf plot bug was fixed in 0.11.0 |
cc @disimone, can you try your code with this latest branch?
I chose to keep normalisation in the library, but it is all transparent to the user. The reason to keep it is for numeric stability.
Fixes #294