Files read by hash; fractional Weibull solved and fitted to convergence; recurrence reads its reference cohorts from the platform
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
"""CaMa recurrence (v1): the probability of breast cancer recurring by 12, 36 and 60 months,
|
||||
learned from two external reference cohorts, METABRIC and SCAN-B, read from their published
|
||||
files. Per cohort and horizon, a stepwise logistic regression and a Bayesian network (BDeu
|
||||
parents of the outcome) are fitted and validated (cohorts, modeling); a calculator gives the
|
||||
recurrence-free probability of clinical scenarios with bootstrap intervals and survival curves
|
||||
(calculator, curves); risk factors are rated by four criteria (factors); reports gives the
|
||||
tables and figures. The saved model is METABRIC's, refitted on each whole horizon cohort."""
|
||||
learned from two public reference cohorts, METABRIC and SCAN-B, as the platform loaded their
|
||||
published files (the `cama_reference` pipeline). Per cohort and horizon, a stepwise logistic
|
||||
regression and a Bayesian network (BDeu parents of the outcome) are fitted and validated
|
||||
(cohorts, modeling); a calculator gives the recurrence-free probability of clinical scenarios
|
||||
with bootstrap intervals and survival curves (calculator, curves); risk factors are rated by
|
||||
four criteria (factors); reports gives the tables and figures. The saved model is METABRIC's,
|
||||
refitted on each whole horizon cohort."""
|
||||
|
||||
from dataclasses import dataclass
|
||||
|
||||
@@ -19,14 +20,10 @@ HORIZONS = modeling.HORIZONS # months
|
||||
SAVED = "metabric"
|
||||
|
||||
|
||||
def cohort(source: str, raw: pd.DataFrame) -> pd.DataFrame:
|
||||
"""The source's cohort table: fixed columns, then its covariates as categories."""
|
||||
return cohorts.prepare(source, raw).frame
|
||||
|
||||
|
||||
def read(source: str, path) -> pd.DataFrame:
|
||||
"""The raw file as its publisher distributes it, as `cohort()` expects it."""
|
||||
return cohorts.read(source, path)
|
||||
def cohort(source: str, rows: pd.DataFrame) -> pd.DataFrame:
|
||||
"""The source's cohort table, from its dataset's rows: fixed columns, then its
|
||||
covariates as categories."""
|
||||
return cohorts.prepare(source, rows).frame
|
||||
|
||||
|
||||
@dataclass
|
||||
@@ -63,7 +60,8 @@ class Recurrence:
|
||||
|
||||
|
||||
def train(raws: dict[str, pd.DataFrame], bootstrap: bool = True) -> tuple[Recurrence, dict, dict]:
|
||||
"""Both cohorts' models, validation, calculator and risk factors, from their raw files.
|
||||
"""Both cohorts' models, validation, calculator and risk factors, from their datasets'
|
||||
rows.
|
||||
Without `bootstrap`, the AUC bootstrap is skipped (its metrics, and the risk factors'
|
||||
stability criterion, are then missing)."""
|
||||
found = {s: cohorts.prepare(s, raws[s]) for s in SOURCES}
|
||||
|
||||
Reference in New Issue
Block a user