Skip to content

Commit

Permalink
Merge pull request #1453 from CamDavidsonPilon/v0.27.2
Browse files Browse the repository at this point in the history
0.27.2
  • Loading branch information
CamDavidsonPilon authored Sep 8, 2022
2 parents f156b7f + 3d9f269 commit cca5288
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 13 deletions.
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
## Changelog

#### 0.27.1 - 2022-03-15
#### 0.27.2 - 2022-09-07

##### Bug fixes
- Fixed issue in add_at_risk_table when there were very late entries.


#### 0.27.1 - 2022-06-25

##### New features
- all `fit_` methods now accept a `fit_options` dict that allows one to pass kwargs to the underlying fitting algorithm.
Expand All @@ -10,7 +16,7 @@
- `step_size` is removed from Cox models `fit`. See `fit_options` above.

##### Bug fixes
- fixed Cox models when "trival" matrix was passed in (one with no covariates)
- fixed Cox models when "trivial" matrix was passed in (one with no covariates)

#### 0.27.0 - 2022-03-15

Expand Down
4 changes: 1 addition & 3 deletions lifelines/fitters/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1278,9 +1278,7 @@ def _compute_central_values_of_raw_training_data(self, df, strata=None, name="ba
return v

else:
from distutils.version import LooseVersion

if LooseVersion(pd.__version__) >= "1.1.0":
if pd.__version__ >= "1.1.0":
# silence deprecation warning
describe_kwarg = {"datetime_is_numeric": True}
else:
Expand Down
2 changes: 1 addition & 1 deletion lifelines/fitters/coxph_fitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1621,7 +1621,7 @@ def _get_efron_values_single(
Calculates the first and second order vector differentials, with respect to beta.
Note that X, T, E are assumed to be sorted on T!
A good explanation for Efron. Consider three of five subjects who fail at the time.
A good explanation for Efron. Consider three of five subjects who fail at the same time.
As it is not known a priori that who is the first to fail, so one-third of
(φ1 + φ2 + φ3) is adjusted from sum_j^{5} φj after one fails. Similarly two-third
of (φ1 + φ2 + φ3) is adjusted after first two individuals fail, etc.
Expand Down
16 changes: 10 additions & 6 deletions lifelines/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,12 +504,16 @@ def add_at_risk_counts(
else:
event_table_slice = f.event_table.assign(at_risk=lambda x: x.at_risk - x.removed)

event_table_slice = (
event_table_slice.loc[:tick, ["at_risk", "censored", "observed"]]
.agg({"at_risk": lambda x: x.tail(1).values, "censored": "sum", "observed": "sum"}) # see #1385
.rename({"at_risk": "At risk", "censored": "Censored", "observed": "Events"})
)
counts.extend([int(c) for c in event_table_slice.loc[rows_to_show]])
if not event_table_slice.loc[:tick].empty:
event_table_slice = (
event_table_slice.loc[:tick, ["at_risk", "censored", "observed"]]
.agg({"at_risk": lambda x: x.tail(1).values, "censored": "sum", "observed": "sum"}) # see #1385
.rename({"at_risk": "At risk", "censored": "Censored", "observed": "Events"})
.fillna(0)
)
counts.extend([int(c) for c in event_table_slice.loc[rows_to_show]])
else:
counts.extend([0 for _ in range(n_rows)])

if n_rows > 1:
if tick == ax2.get_xticks()[0]:
Expand Down
2 changes: 1 addition & 1 deletion lifelines/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

__version__ = "0.27.1"
__version__ = "0.27.2"

0 comments on commit cca5288

Please sign in to comment.