Survival rates its scenarios' risk factors as Luis's code does; recurrence shares the factor code
This commit is contained in:
@@ -21,6 +21,7 @@ from sklearn.metrics import roc_auc_score
|
||||
from sklearn.model_selection import train_test_split
|
||||
|
||||
from models.cama.recurrence.cohorts import Cohort, at_horizon
|
||||
from models.factors import variable_of
|
||||
|
||||
HORIZONS = (12, 36, 60) # months
|
||||
SEED = 42
|
||||
@@ -203,12 +204,6 @@ def c_index(cohort: Cohort) -> float:
|
||||
return float(concordance_index(test["tiempo_meses"], -risk, test["evento"]))
|
||||
|
||||
|
||||
def variable_of(term: str, covariates: list[str]) -> str:
|
||||
"""The covariate a dummy belongs to (the longest name it starts with)."""
|
||||
found = [c for c in covariates if term.startswith(c + "_")]
|
||||
return max(found, key=len) if found else term
|
||||
|
||||
|
||||
@dataclass
|
||||
class Horizon:
|
||||
"""A horizon's cohort size, split fit and bootstrap (AUC pairs, and how often each
|
||||
|
||||
Reference in New Issue
Block a user