305e855a15
Stages 01-06 (depuration, MCA balancing and categorization, bootstrap indices, stepwise LR and hybrid Bayesian network, survival curves, risk factors), settings in model.toml, run.py writing each stage's files and pipeline.py as the runner that replaces ejecutar_pipeline.py. New extras seer-survival and seer-survival-dca; experiments/ excluded from the wheel.
323 lines
16 KiB
TOML
323 lines
16 KiB
TOML
# CaMa SEER survival pipeline: settings of each stage. Paths are never here: they enter the DAG as inputs.
|
||
|
||
[depuration]
|
||
exclude = ["Outcome_cat"] # never analysed or touched
|
||
auto_extra = ["Age_group", "Tumor_group"] # included when present
|
||
extra_cols = []
|
||
protected = [] # e.g. ["Estadio_cat"]: never dropped
|
||
prefer = ["Tumor_group", "Age_group"] # on a tie or duplicate, the one listed here wins (the project's own groupings)
|
||
drop_raw_sources = true # also drop the raw SEER column of a dropped variable
|
||
unknown_label = "Desconocido"
|
||
|
||
dup_u = 0.90 # step A
|
||
u_redund = 0.80 # step B
|
||
gvif_drop = 2.24 # step C: GVIF^(1/2df) (equals VIF 5)
|
||
max_iter_gvif = 20
|
||
|
||
# Calibration: independent of the data, only reports (thresholds_auto = true applies its suggestions)
|
||
thresholds_auto = false
|
||
n_max_cal = 300000 # more rows are calibrated on a reproducible subsample
|
||
null_perm = 100 # permutations for the chance floor of U
|
||
k_azar = 5 # U_REDUND must be >= k_azar x (max U by chance)
|
||
u_conventional = 0.80 # fallback when the data can't calibrate
|
||
u_gap_from = 0.70 # gaps whose upper edge is >= this U are searched
|
||
u_gap_min = 0.10 # minimum gap to count as "natural"
|
||
u_plausible = [0.60, 0.95] # limits of the suggested threshold
|
||
vif_cut = 5 # 5 (R2=0.80) or 10 (R2=0.90)
|
||
r_large = 0.5 # Cohen (1988): |phi| 0.1 small, 0.3 medium, 0.5 large
|
||
min_n_cat = 30 # categories with fewer patients are left out of the clustering
|
||
max_cat_cluster = 400 # cap of columns (categories) in the clustering matrix
|
||
cluster_dist = "signed" # "signed": d = 1-r | "abs": d = 1-|r|
|
||
cluster_method = "average"
|
||
seed = 0
|
||
gap_from_grid = [0.50, 0.60, 0.70, 0.80, 0.90]
|
||
gap_min_grid = [0.02, 0.05, 0.10, 0.15, 0.20, 0.30]
|
||
|
||
[balancing]
|
||
# The outcome is 18-month survival: "Sobrevive" (alive at the horizon), "Muerte" (dead before it), unknown otherwise.
|
||
outcome_mode = "censura_excluida" # "censura_excluida" (recommended: censored patients are unknown) | "original"
|
||
horizon_months = 18
|
||
# Diagnosis years with INCOMPLETE follow-up: when more than this % of a year's patients are censored (alive with
|
||
# < horizon), the whole year leaves the outcome. Avoids only early deaths "entering" in the cut-off years.
|
||
exclude_censored_years = true
|
||
censoring_max_pct = 10.0
|
||
age_keywords = ["age recode", "age at diagnosis", "age"]
|
||
n_components = 10
|
||
target_ratio = 1.0 # 1.0 = exact 50/50
|
||
distance_dims = 0 # 0 = all the fitted MCA dimensions
|
||
mca_variant = "con_edad" # "con_edad" | "sin_edad": the MCA that picks the majority patients kept
|
||
|
||
[categorization]
|
||
alpha = 1.0 # Dirichlet prior per category
|
||
kmax = 8 # most segments considered
|
||
threshold = 0.08 # least composition change for a boundary to count as real
|
||
min_count = 50 # categories with fewer patients are dropped from the counts
|
||
# Smallest segment, as a share of the BALANCED cohort (a fixed number would mean different things as the cohort shrinks)
|
||
min_n_pct = 0.05
|
||
min_n_floor = 50
|
||
bin_width_mm = 5 # tumor size: width of each ordinal level, analogous to the 5-year age bands
|
||
tumor_cap_mm = 100 # from here on, a single ">100 mm" level
|
||
k_quantiles = 4
|
||
clinical_age = [40, 50, 70] # years
|
||
clinical_tumor = [20, 50] # mm (T1 | T2 | T3+)
|
||
age_final = "Biología + tratamiento" # the configuration whose cuts become Age_group
|
||
tumor_final = "Outcome + biología" # the configuration whose cuts become Tumor_group
|
||
drop_after = ["Tamano_tumor_cat"] # replaced by Tumor_group in the final file: the same datum twice is collinear
|
||
biology = ["Estadio", "Grado_histologico", "Subtipo_molecular", "Receptor_estrogeno", "Receptor_progesterona",
|
||
"Metastasis", "Tamano_tumor", "Localizacion_mama", "Lateralidad", "Tipo_histologico"]
|
||
treatment = ["Tratamiento_quirurgico", "Radioterapia", "Quimioterapia"]
|
||
demographic = ["Estado_civil", "Race"]
|
||
|
||
# Keywords (in the lower-cased column label) that find the raw column of a covariate with no recoded `_cat` column.
|
||
[categorization.candidate_keywords]
|
||
Estadio = { include = ["stage"], exclude = [] }
|
||
Grado_histologico = { include = ["grade"], exclude = [] }
|
||
Subtipo_molecular = { include = ["subtype"], exclude = [] }
|
||
Receptor_estrogeno = { include = ["er status", "estrogen"], exclude = [] }
|
||
Receptor_progesterona = { include = ["pr status", "progesterone"], exclude = [] }
|
||
Tamano_tumor = { include = ["tumor size"], exclude = [] }
|
||
Metastasis = { include = ["eod mets", "mets recode"], exclude = [] }
|
||
Localizacion_mama = { include = ["primary site"], exclude = [] }
|
||
Lateralidad = { include = ["laterality"], exclude = [] }
|
||
Tipo_histologico = { include = ["histologic"], exclude = [] }
|
||
Tratamiento_quirurgico = { include = ["surg"], exclude = [] }
|
||
Radioterapia = { include = ["radiation"], exclude = [] }
|
||
Quimioterapia = { include = ["chemo"], exclude = [] }
|
||
Estado_civil = { include = ["marital"], exclude = [] }
|
||
Race = { include = ["race"], exclude = [] }
|
||
|
||
# Categorization proposals: how age and tumor size are grouped. A value is a configuration's name (the blocks joined
|
||
# by " + ": outcome, biología, tratamiento, demográfico, and edad for the tumor axis), "clinico" (fixed cuts) or
|
||
# "cuantiles" (K groups of equal frequency, without the outcome). The modelling stage runs every proposal.
|
||
[categorization.proposals.P1_actual]
|
||
age = "Biología + tratamiento"
|
||
tumor = "Outcome + biología"
|
||
[categorization.proposals.P2_solo_outcome]
|
||
age = "Solo outcome"
|
||
tumor = "Solo outcome"
|
||
[categorization.proposals.P3_outcome_biologia]
|
||
age = "Outcome + biología"
|
||
tumor = "Outcome + biología"
|
||
[categorization.proposals.P4_outcome_bio_trat]
|
||
age = "Outcome + biología + tratamiento"
|
||
tumor = "Outcome + biología + tratamiento"
|
||
[categorization.proposals.P5_todos_los_bloques]
|
||
age = "Outcome + biología + tratamiento + demográfico"
|
||
tumor = "Outcome + biología + tratamiento + demográfico + edad"
|
||
[categorization.proposals.P6_clinico_fijo]
|
||
age = "clinico"
|
||
tumor = "clinico"
|
||
[categorization.proposals.P7_cuantiles]
|
||
age = "cuantiles"
|
||
tumor = "cuantiles"
|
||
|
||
[bootstrap]
|
||
n_bootstrap = 200
|
||
random_state = 42
|
||
|
||
[survival]
|
||
# Survival curves of the whole cohort and of subgroups: Kaplan-Meier, the classic and the fractional Weibull, and the
|
||
# 6/12/18-month survival by LR, HBN and their stacked combination, with bootstrap intervals.
|
||
age_mode = "categorizada" # how age enters the LR: "categorizada" | "continua" | "continua_cuadratica"
|
||
include_age = true # adds the grouped age (Edad_cat) when no categorical age column exists
|
||
age_cuts = [45, 60, 75]
|
||
hbn_fixed_parents = ["Estadio", "Tipo_histologico", "Tratamiento_quirurgico", "Quimioterapia", "Radioterapia"] # found by keyword; empty = learn them (BDeu)
|
||
hbn_age_parent = true # adds the grouped age as a parent of the outcome (expert knowledge; stage 04 didn't choose it)
|
||
hbn_parents = "fijos" # "fijos": learned once and kept in the bootstrap | "reaprender": searched again per replica
|
||
covariates = [] # empty = every column ending in "_cat" but the outcome
|
||
horizons = [6, 12, 18] # months where the LR and HBN points are shown
|
||
censoring = "riesgo" # "riesgo": a model per interval using all the follow-up | "ipcw" | "excluir"
|
||
combine = true # one LR + HBN indicator (per-interval stacking weights); only with censoring = "riesgo"
|
||
show_individual = false # also draws LR and HBN apart from the combination
|
||
stack_folds = 5 # cross-validation folds that decide the weights
|
||
stack_shrink = 20 # shrink toward 50/50 with few deaths: lambda = shrink / (shrink + the interval's deaths)
|
||
n_boot = 100 # bootstrap replicas for the intervals
|
||
n_boot_sub = 100 # and in the subgroups
|
||
seed = 42
|
||
hbn_ess = 1000 # equivalent sample size of the BDeu prior
|
||
hbn_max_parents = 5
|
||
k_ident = "clasico" # the fractional Weibull's fixed k: "clasico" = the classic Weibull's | or a number
|
||
curves = "ajustada" # "ajustada": KM and Weibull standardized by the same covariates | "cruda": unadjusted
|
||
adjust_step = 3 # months per interval of the adjusted curve
|
||
show_raw_km = true
|
||
ylim_main = [] # e.g. [0.94, 1.0]; empty = automatic
|
||
inset_zoom = false
|
||
inset_months = 18
|
||
cap_months = 24 # follow-up is truncated here (later deaths and follow-up count as alive / censored); 0 = no cap
|
||
min_events_sub = 5 # least deaths to fit a subgroup
|
||
ks_max_seconds = 120 # time caps of the fractional fits (the whole cohort / a subgroup)
|
||
ks_sub_max_seconds = 180
|
||
xlim_sub = [] # e.g. [0, 72] to hide the extrapolation; empty = (0, extrapolation months)
|
||
|
||
[survival.ylim_sub] # manual zoom of the y axis per subgroup, e.g. "Estadio I" = [0.97, 1.0]
|
||
|
||
# Subgroups: every condition present must hold. her2 = "pos" | "neg"; triple_negative (HR-/HER2-); age_min (>=) and
|
||
# age_max (<) in years; stages (0..4); conservative (conservative surgery).
|
||
[[survival.subgroups]]
|
||
name = "HER2+ · ≥60 años · estadio III–IV (Alto)"
|
||
her2 = "pos"
|
||
age_min = 60
|
||
stages = [3, 4]
|
||
[[survival.subgroups]]
|
||
name = "HER2+ · <60 años · estadio 0–II (Bajo)"
|
||
her2 = "pos"
|
||
age_max = 60
|
||
stages = [0, 1, 2]
|
||
[[survival.subgroups]]
|
||
name = "Estadio IV"
|
||
stages = [4]
|
||
[[survival.subgroups]]
|
||
name = "Estadio I"
|
||
stages = [1]
|
||
[[survival.subgroups]]
|
||
name = "≥ 75 años"
|
||
age_min = 75
|
||
[[survival.subgroups]]
|
||
name = "< 45 años"
|
||
age_max = 45
|
||
[[survival.subgroups]]
|
||
name = "Jóvenes (<45) · HER2− · estadio 0–II · cirugía conservadora"
|
||
her2 = "neg"
|
||
age_max = 45
|
||
stages = [0, 1, 2]
|
||
conservative = true
|
||
[[survival.subgroups]]
|
||
name = "HER2− · estadio 0–II · cirugía conservadora"
|
||
her2 = "neg"
|
||
stages = [0, 1, 2]
|
||
conservative = true
|
||
[[survival.subgroups]]
|
||
name = "HER2+ · estadio 0–II · cirugía conservadora"
|
||
her2 = "pos"
|
||
stages = [0, 1, 2]
|
||
conservative = true
|
||
[[survival.subgroups]]
|
||
name = "Jóvenes (<45) · estadio 0–II"
|
||
age_max = 45
|
||
stages = [0, 1, 2]
|
||
[[survival.subgroups]]
|
||
name = "Jóvenes (<45) · HER2−"
|
||
her2 = "neg"
|
||
age_max = 45
|
||
[[survival.subgroups]]
|
||
name = "Triple negativo (HR−/HER2−) · estadio 0–II"
|
||
triple_negative = true
|
||
stages = [0, 1, 2]
|
||
[[survival.subgroups]]
|
||
name = "≥ 65 años · HER2− · estadio 0–II · cirugía conservadora"
|
||
her2 = "neg"
|
||
age_min = 65
|
||
stages = [0, 1, 2]
|
||
conservative = true
|
||
|
||
[risk_factors]
|
||
# A category is a risk factor from four criteria: c1 the multivariable OR in the natural population (95 % CI not
|
||
# crossing 1 and Benjamini-Hochberg p < alpha), c2 stability: the variable enters the LR stepwise in at least freq_min
|
||
# of the bootstrap replicas, c3 it is in the outcome's Markov blanket in the HBN, c4 the absolute survival difference at
|
||
# `horizon` months (Kaplan-Meier) against the reference category. Treatment variables are a clinical decision: they are
|
||
# not classified and don't enter c1's model; they are reported apart.
|
||
alpha = 0.05
|
||
freq_min = 0.80
|
||
horizon = 18
|
||
cap_months = 24
|
||
treatment = ["Tratamiento_quirurgico", "Radioterapia", "Quimioterapia"]
|
||
|
||
[risk_factors.canonical_map]
|
||
Age_group = "Edad"
|
||
Tumor_group = "Tamano_tumor"
|
||
Tamano_tumor_cat = "Tamano_tumor"
|
||
Estadio_cat = "Estadio"
|
||
Grado_histologico_cat = "Grado_histologico"
|
||
Subtipo_molecular_cat = "Subtipo_molecular"
|
||
Receptor_estrogeno_cat = "Receptor_estrogeno"
|
||
Receptor_progesterona_cat = "Receptor_progesterona"
|
||
Metastasis_cat = "Metastasis"
|
||
Localizacion_mama_cat = "Localizacion_mama"
|
||
Lateralidad_cat = "Lateralidad"
|
||
Tipo_histologico_cat = "Tipo_histologico"
|
||
Tratamiento_quirurgico_cat = "Tratamiento_quirurgico"
|
||
Radioterapia_cat = "Radioterapia"
|
||
Quimioterapia_cat = "Quimioterapia"
|
||
Estado_civil_cat = "Estado_civil"
|
||
Ganglios_positivos_cat = "Ganglios_positivos"
|
||
Invasion_linfovascular_cat = "Invasion_linfovascular"
|
||
Margenes_cat = "Margenes"
|
||
Densidad_BIRADS_cat = "Densidad_BIRADS"
|
||
Masa_espiculada_cat = "Masa_espiculada"
|
||
Microcalcificaciones_cat = "Microcalcificaciones"
|
||
Multifocalidad_cat = "Multifocalidad"
|
||
BRCA_cat = "BRCA"
|
||
HER2_IHQ_cat = "HER2_IHQ"
|
||
|
||
[modeling]
|
||
random_state = 42
|
||
test_size = 0.3
|
||
prefilter_alpha = 0.10 # univariate chi-square pre-filter of the dummy columns
|
||
alpha_in = 0.10 # stepwise: enters below this p
|
||
alpha_out = 0.15 # stepwise: leaves above this p
|
||
max_candidates = 40 # hard cap of columns the stepwise receives (by chi-square, strongest first)
|
||
max_search_rows = 8000 # the stepwise searches on a stratified subsample; the final fit uses the whole train
|
||
lr_maxiter = 200
|
||
# Hybrid Bayesian network (hill climbing with restarts, BDeu score, temporal tiers as forbidden arcs)
|
||
bdeu_ess = 1000 # equivalent sample size: pure K2 (= 1) penalized complexity too hard
|
||
n_restarts = 10
|
||
max_indegree = 4
|
||
max_outcome_parents = 10 # the greedy expansion of the outcome's parents
|
||
# The covariates that enter the models, by canonical name (Age/Tumor size carry the Age_group/Tumor_group categories)
|
||
categorical_order = ["Edad", "Tamano_tumor", "Estadio", "Grado_histologico", "Subtipo_molecular", "Receptor_estrogeno",
|
||
"Receptor_progesterona", "Metastasis", "Localizacion_mama", "Lateralidad", "Tipo_histologico",
|
||
"Tratamiento_quirurgico", "Radioterapia", "Quimioterapia", "Estado_civil", "Race",
|
||
"Ganglios_positivos", "Invasion_linfovascular", "Margenes", "Densidad_BIRADS", "Masa_espiculada",
|
||
"Microcalcificaciones", "Multifocalidad", "BRCA", "HER2_IHQ"]
|
||
treatment_vars = ["Tratamiento_quirurgico", "Radioterapia", "Quimioterapia"]
|
||
tier_demography = ["Edad", "Race", "Estado_civil", "BRCA", "Densidad_BIRADS"]
|
||
tier_tumor = ["Estadio", "Grado_histologico", "Tipo_histologico", "Subtipo_molecular", "Receptor_estrogeno",
|
||
"Receptor_progesterona", "Tamano_tumor", "Localizacion_mama", "Lateralidad", "Metastasis",
|
||
"CS_Lymph_Nodes", "Ganglios_positivos", "Invasion_linfovascular", "Masa_espiculada",
|
||
"Microcalcificaciones", "Multifocalidad", "HER2_IHQ"]
|
||
tier_treatment = ["Tratamiento_quirurgico", "Radioterapia", "Quimioterapia", "Margenes"]
|
||
# The natural population (every patient with a known outcome, before the undersampling)
|
||
run_lr_natural = true
|
||
natural_search_rows = 30000
|
||
natural_test_size = 0.30
|
||
natural_maxiter = 300
|
||
# Bootstrap of the whole pipeline (the indices come from stage 03)
|
||
n_bootstrap_run = 60 # max 200 (~27 s per replica with the HBN)
|
||
bootstrap_max_seconds = 2700 # safety cap: the loop stops by itself and uses what it has
|
||
bootstrap_include_hbn = true # false = LR only (much faster)
|
||
bootstrap_restarts = 3 # hill-climbing restarts PER REPLICA
|
||
# Comparison of the categorization proposals (stage 02b), on the same splits
|
||
n_splits_prop = 5
|
||
proposals_only = [] # empty = all of the file's proposals
|
||
proposals_include_hbn = true
|
||
proposals_max_seconds = 3600
|
||
|
||
# Column of the balanced file -> the canonical name the models use. Selected by the ORIGINAL name before renaming, so a
|
||
# raw SEER column that already has a canonical name is never carried along (a duplicate fails much later, inside pgmpy).
|
||
[modeling.canonical_map]
|
||
Age_group = "Edad"
|
||
Tumor_group = "Tamano_tumor"
|
||
Estadio_cat = "Estadio"
|
||
Grado_histologico_cat = "Grado_histologico"
|
||
Subtipo_molecular_cat = "Subtipo_molecular"
|
||
Receptor_estrogeno_cat = "Receptor_estrogeno"
|
||
Receptor_progesterona_cat = "Receptor_progesterona"
|
||
Metastasis_cat = "Metastasis"
|
||
Localizacion_mama_cat = "Localizacion_mama"
|
||
Lateralidad_cat = "Lateralidad"
|
||
Tipo_histologico_cat = "Tipo_histologico"
|
||
Tratamiento_quirurgico_cat = "Tratamiento_quirurgico"
|
||
Radioterapia_cat = "Radioterapia"
|
||
Quimioterapia_cat = "Quimioterapia"
|
||
Estado_civil_cat = "Estado_civil"
|
||
Outcome_cat = "Outcome_cat"
|
||
Ganglios_positivos_cat = "Ganglios_positivos"
|
||
Invasion_linfovascular_cat = "Invasion_linfovascular"
|
||
Margenes_cat = "Margenes"
|
||
Densidad_BIRADS_cat = "Densidad_BIRADS"
|
||
Masa_espiculada_cat = "Masa_espiculada"
|
||
Microcalcificaciones_cat = "Microcalcificaciones"
|
||
Multifocalidad_cat = "Multifocalidad"
|
||
BRCA_cat = "BRCA"
|
||
HER2_IHQ_cat = "HER2_IHQ"
|