API reference¶
Generated from the source, so it is always in step with the version you have installed. For task-oriented material, start from Guides or the model pages.
Everything in gen_surv¶
from gen_surv import ... gives you:
| Name | Kind | Page |
|---|---|---|
generate |
dispatcher over all twelve models | generate |
simulate, SimulationConfig, SimulationResult |
data with its configuration and ground truth | Simulation results |
gen_cphm |
Cox proportional hazards | Generators |
gen_aft_log_normal, gen_aft_weibull, gen_aft_log_logistic |
AFT models | Generators |
gen_piecewise_exponential |
piecewise constant hazard | Generators |
gen_competing_risks, gen_competing_risks_weibull |
competing risks | Generators |
gen_mixture_cure, cure_fraction_estimate |
cure models | Generators |
gen_cmm |
illness-death, intervals | Generators |
gen_thmm |
illness-death, panel | Generators |
gen_tdcm |
time-dependent covariates | Generators |
gen_recurrent_events |
recurrent events (Andersen-Gill, PWP) | Generators |
gen_multistate, Transition |
the engine behind cmm and thmm; any transition graph | Generators |
BaselineHazard, ExponentialBaseline, WeibullBaseline, GompertzBaseline, LogLogisticBaseline, PiecewiseConstantBaseline |
baseline hazard families | Baseline hazards |
runifcens, rexpocens, rweibcens, rlognormcens, rgammacens |
censoring samplers | Censoring |
WeibullCensoring, LogNormalCensoring, GammaCensoring, CensoringModel |
class-based censoring | Censoring |
sample_bivariate_distribution |
correlated draws | Censoring |
describe_survival, plot_survival_curve, plot_hazard_comparison, plot_covariate_effect |
summaries and plots | Analysis |
export_dataset |
write to disk | Interoperability |
to_sksurv, from_sksurv |
scikit-survival conversion — needs the optional dependency | Interoperability |
GenSurvDataGenerator |
scikit-learn estimator | Interoperability |
__version__ |
the installed version | — |
Not exported at the top level¶
These live one level down and are imported from their module:
| Import | Purpose |
|---|---|
from gen_surv.summary import summarize_survival_dataset, check_survival_data_quality, compare_survival_datasets |
dataset summaries and quality checks — Analysis |
from gen_surv.validation import ValidationError, ... |
the exception hierarchy — Validation |
from gen_surv.cli import app |
the Typer application — Command line |
Conventions across the package¶
Every generator returns a DataFrame. Never a numpy array, never a tuple.
Shapes differ by model — see Output schemas.
seed is always last and always optional. It accepts an int, a
numpy.random.Generator, or None. See
Reproducibility.
Validation happens before any sampling. An invalid argument raises a
subclass of ValidationError — itself a ValueError — with the offending
argument, the value received, and what was expected.
Optional dependencies degrade quietly. to_sksurv and from_sksurv are
simply absent when scikit-survival is not installed; importing gen_surv still
works.