e8c264e571
Every CaCu PIM scenario (cin2_pim, post-colposcopy, post-treatment) and the survival scenario now keep, per
combination of their covariates, the model against its empirical estimate, with the methods each used:
- PIM (models/cacu/cin2_pim/report.py): Turnbull's interval-censored estimate (prevalent = mass at 0, free in (l, r],
unknown baseline in [0, r]; ported from bayes-pim chapter 24) with a bootstrap band, against the mixture refitted on
every coded member with a delta-method band over the likelihood (inverse numerical Hessian, numerical gradient of
CR(t), log scale); E/O at each horizon with log(E/O) taken as normal.
- Survival (models/cacu/survival/report.py): Kaplan-Meier with Greenwood's band against the SEER pipeline's own
subgroup points and bootstrap interval (survival_curves.sv_sub_weights and sv_sub_points, called as they are).
A version keeps the record as analisis/subgrupos.json and a self-contained Plotly page as reportes/subgrupos.html
(TrainingRun.log_report; the saver publishes a dataflow's `reports`). The same drawing is a notebook in the code,
models/cacu/{cin2_pim,survival}/notebooks/reporte_subgrupos.ipynb: chart names and computed results only, a
`parameters` cell, `#| echo: false` cells. models.reports.templates lists those notebooks with the scenarios each serves
and reads one by id, for the WebApi's /governance/notebook-templates. The Jupyter renderer now drops the code of
`#| echo: false` cells, as Quarto does.
plotly>=5.18 joins the `survival-curves` extra (installed by the WebApi) and the dev group.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HmQxVJVNR5FYkPAregGEQ7
88 lines
2.8 KiB
TOML
88 lines
2.8 KiB
TOML
[project]
|
|
name = "models"
|
|
version = "0.1.0"
|
|
description = "train()/predict() interfaces for the CaCu, CaMa and TEA screening models."
|
|
requires-python = ">=3.12"
|
|
dependencies = [
|
|
"persistance",
|
|
"extraction",
|
|
"mlflow>=2.9",
|
|
# The model DAGs (`models/pipelines`): each function a node, each parameter an edge.
|
|
"apache-hamilton>=1.90",
|
|
# Cohort builds are Parquet files, read and written as frames.
|
|
"pandas>=2.0",
|
|
"pyarrow>=15",
|
|
"scikit-learn>=1.4",
|
|
# The values of the cohort and estimate files (`models.io.contracts`).
|
|
"pandera>=0.20",
|
|
"tea",
|
|
]
|
|
|
|
[project.optional-dependencies]
|
|
# Reading the EEG baselines' reference cohort from the cluster's S3 (`models.tea.eeg.train`).
|
|
eeg-reference = ["tea[s3]"]
|
|
# Running uploaded notebooks without Quarto (models.reports.rendering.JupyterRenderer, models.reports.experiment).
|
|
notebooks = [
|
|
"nbclient>=0.10",
|
|
"nbconvert>=7.16",
|
|
"ipykernel>=6.29",
|
|
]
|
|
|
|
# The SEER survival pipeline (`models.cama.seer_survival`): statsmodels for the logistic regressions, pgmpy for the
|
|
# Bayesian network, mpmath for the fractional Weibull's series, matplotlib for its figures. `dcurves` is optional: without
|
|
# it the decision-curve figure is skipped.
|
|
seer-survival = [
|
|
"scipy>=1.11",
|
|
"statsmodels>=0.14",
|
|
"pgmpy>=1.0",
|
|
"networkx>=3.0",
|
|
"mpmath>=1.3",
|
|
"matplotlib>=3.8",
|
|
"lifelines>=0.28", # the recurrence analysis' penalised Cox model (`models.cama.recurrence`)
|
|
]
|
|
# The population curves of a survival training run (`models.cama.survival.population`): the fractional Weibull's series;
|
|
# plotly for the CaCu survival scenario's subgroup page.
|
|
survival-curves = [
|
|
"scipy>=1.11",
|
|
"mpmath>=1.3",
|
|
"plotly>=5.18", # the CaCu survival scenario's subgroup report page (`models.cacu.survival.report`)
|
|
]
|
|
seer-survival-dca = ["dcurves>=1.1"]
|
|
|
|
[tool.uv.sources]
|
|
persistance = { path = "../Persistance", editable = true }
|
|
extraction = { path = "../Extraction", editable = true }
|
|
tea = { path = "libs/tea", editable = true }
|
|
|
|
[build-system]
|
|
requires = ["hatchling"]
|
|
build-backend = "hatchling.build"
|
|
|
|
[tool.hatch.build.targets.wheel]
|
|
packages = ["models"]
|
|
exclude = ["**/notebooks", "**/experiments"]
|
|
|
|
[dependency-groups]
|
|
dev = [
|
|
"pytest>=8.0.0",
|
|
"reportlab>=4.0",
|
|
# the SEER survival pipeline's tests (the `seer-survival` extra)
|
|
"scipy>=1.11",
|
|
"statsmodels>=0.14",
|
|
"pgmpy>=1.0",
|
|
"lifelines>=0.28",
|
|
"networkx>=3.0",
|
|
"mpmath>=1.3",
|
|
"matplotlib>=3.8",
|
|
"plotly>=5.18",
|
|
"nbclient>=0.10",
|
|
"nbconvert>=7.16",
|
|
"ipykernel>=6.29",
|
|
]
|
|
# The scenarios' notebooks (`<scenario>/notebooks/`): a Jupyter kernel and the drawing of the Hamilton DAGs.
|
|
# `graphviz` is only the Python side: drawing also needs Graphviz's `dot` program on the machine.
|
|
notebooks = [
|
|
"ipykernel>=6.29",
|
|
"graphviz>=0.20",
|
|
]
|