-
Notifications
You must be signed in to change notification settings - Fork 20
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
Enhancement/issue 822 #825
base: main
Are you sure you want to change the base?
Conversation
Thanks a lot @aGuyLearning, awesome! Comments as per review :) |
model = model_class() | ||
model.fit(T, event_observed=E) | ||
model.fit( |
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.
Add fit_left_censoring
call upon argument input left
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.
check if nelson-aalen gracefully crashes with meaningful error message
durations: Iterable, | ||
event_observed: Iterable | None = None, | ||
timeline: Iterable = None, | ||
entry: Iterable | None = None, |
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.
no kwargs, but full arguments listed :)
@@ -376,7 +385,9 @@ def log_logistic_aft(adata: AnnData, duration_col: str, event_col: str, entry_co | |||
) | |||
|
|||
|
|||
def _univariate_model(adata: AnnData, duration_col: str, event_col: str, model_class, accept_zero_duration=True): | |||
def _univariate_model( | |||
adata: AnnData, duration_col: str, event_col: str, model_class, accept_zero_duration=True, **kwargs |
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.
not kwargs but pass arguments, see above
alpha: float | None = None, | ||
ci_labels: tuple[str, str] = None, | ||
weights: Iterable | None = None, | ||
censoring: Literal["right", "left"] = None, |
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.
add comment that and "right" just calls fit and "left" calls fit_left_censoring
, maybe change default value to "right" instead of None
entry: Iterable | None = None, | ||
label: str | None = None, | ||
alpha: float | None = None, | ||
ci_labels: tuple[str, str] = None, |
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.
Add None to typehint to make clear its optional
@@ -116,15 +116,10 @@ def glm( | |||
|
|||
|
|||
def kmf( |
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.
one additional thing here; we'll also have to watch out for backwards compatibility.
Here, we could while still accepting the arguments raise a deprecation warning, where we briefly highlight the new behaviour.
Description of changes
closes #822
Changed the method signature of univariate models to allow the user to pass parameters to the lifeline. Now weilbull, neil_aalen and kmf look like
adata: AnnData, duration_col: str, event_col: str, **kwargs
and are passed on to the _univariate_model function
Technical details
this could be changed to explicitly have all parameters in each function and pass them on.
Additional context