mlsurv 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mlsurv-0.1.0/CHANGELOG.md +74 -0
- mlsurv-0.1.0/LICENSE +9 -0
- mlsurv-0.1.0/MANIFEST.in +1 -0
- mlsurv-0.1.0/PKG-INFO +297 -0
- mlsurv-0.1.0/README.md +248 -0
- mlsurv-0.1.0/mlsurv/__init__.py +215 -0
- mlsurv-0.1.0/mlsurv/_calibration_thresholds.py +25 -0
- mlsurv-0.1.0/mlsurv/_iter_warn.py +396 -0
- mlsurv-0.1.0/mlsurv/_loky_patch.py +34 -0
- mlsurv-0.1.0/mlsurv/_patient_select.py +109 -0
- mlsurv-0.1.0/mlsurv/_shared.py +585 -0
- mlsurv-0.1.0/mlsurv/_warnings.py +280 -0
- mlsurv-0.1.0/mlsurv/cli/__init__.py +173 -0
- mlsurv-0.1.0/mlsurv/cli/__main__.py +4 -0
- mlsurv-0.1.0/mlsurv/cli/_artifacts.py +471 -0
- mlsurv-0.1.0/mlsurv/cli/_commands.py +1891 -0
- mlsurv-0.1.0/mlsurv/cli/_data.py +450 -0
- mlsurv-0.1.0/mlsurv/cli/_exit_codes.py +16 -0
- mlsurv-0.1.0/mlsurv/cli/_helpers.py +143 -0
- mlsurv-0.1.0/mlsurv/cli/_output.py +69 -0
- mlsurv-0.1.0/mlsurv/cli/_parsers.py +1368 -0
- mlsurv-0.1.0/mlsurv/cli/_plot.py +879 -0
- mlsurv-0.1.0/mlsurv/constants.py +317 -0
- mlsurv-0.1.0/mlsurv/evaluation/__init__.py +92 -0
- mlsurv-0.1.0/mlsurv/evaluation/_bootstrap_iteration.py +971 -0
- mlsurv-0.1.0/mlsurv/evaluation/_bootstrap_workers.py +240 -0
- mlsurv-0.1.0/mlsurv/evaluation/_calibrators.py +482 -0
- mlsurv-0.1.0/mlsurv/evaluation/_coefficients.py +257 -0
- mlsurv-0.1.0/mlsurv/evaluation/_concordance.py +533 -0
- mlsurv-0.1.0/mlsurv/evaluation/_config.py +113 -0
- mlsurv-0.1.0/mlsurv/evaluation/_ctd.py +113 -0
- mlsurv-0.1.0/mlsurv/evaluation/_diagnostics.py +335 -0
- mlsurv-0.1.0/mlsurv/evaluation/_explain.py +168 -0
- mlsurv-0.1.0/mlsurv/evaluation/_feature_summary.py +388 -0
- mlsurv-0.1.0/mlsurv/evaluation/_incremental.py +437 -0
- mlsurv-0.1.0/mlsurv/evaluation/_interactions.py +1501 -0
- mlsurv-0.1.0/mlsurv/evaluation/_paired_comparison.py +706 -0
- mlsurv-0.1.0/mlsurv/evaluation/_prediction_bootstrap.py +660 -0
- mlsurv-0.1.0/mlsurv/evaluation/_prediction_helpers.py +482 -0
- mlsurv-0.1.0/mlsurv/evaluation/_recalibration.py +499 -0
- mlsurv-0.1.0/mlsurv/evaluation/_shap.py +389 -0
- mlsurv-0.1.0/mlsurv/evaluation/_subpopulation.py +807 -0
- mlsurv-0.1.0/mlsurv/evaluation/_univariate_cox.py +101 -0
- mlsurv-0.1.0/mlsurv/evaluation/bootstrap.py +1266 -0
- mlsurv-0.1.0/mlsurv/evaluation/evaluate.py +2177 -0
- mlsurv-0.1.0/mlsurv/evaluation/helpers.py +108 -0
- mlsurv-0.1.0/mlsurv/evaluation/importance.py +871 -0
- mlsurv-0.1.0/mlsurv/evaluation/metrics.py +2882 -0
- mlsurv-0.1.0/mlsurv/exceptions.py +54 -0
- mlsurv-0.1.0/mlsurv/guidance.py +865 -0
- mlsurv-0.1.0/mlsurv/learner/__init__.py +19 -0
- mlsurv-0.1.0/mlsurv/learner/_benchmarking.py +970 -0
- mlsurv-0.1.0/mlsurv/learner/_config.py +76 -0
- mlsurv-0.1.0/mlsurv/learner/_core.py +1384 -0
- mlsurv-0.1.0/mlsurv/learner/_cv_training.py +706 -0
- mlsurv-0.1.0/mlsurv/learner/_eval_context.py +64 -0
- mlsurv-0.1.0/mlsurv/learner/_eval_times.py +119 -0
- mlsurv-0.1.0/mlsurv/learner/_evaluation.py +71 -0
- mlsurv-0.1.0/mlsurv/learner/_evaluation_bootstrap.py +424 -0
- mlsurv-0.1.0/mlsurv/learner/_evaluation_core.py +1143 -0
- mlsurv-0.1.0/mlsurv/learner/_evaluation_helpers.py +932 -0
- mlsurv-0.1.0/mlsurv/learner/_evaluation_interactions.py +1642 -0
- mlsurv-0.1.0/mlsurv/learner/_explain.py +144 -0
- mlsurv-0.1.0/mlsurv/learner/_export.py +399 -0
- mlsurv-0.1.0/mlsurv/learner/_format.py +275 -0
- mlsurv-0.1.0/mlsurv/learner/_patient_report.py +510 -0
- mlsurv-0.1.0/mlsurv/learner/_patient_report_html.py +587 -0
- mlsurv-0.1.0/mlsurv/learner/_patient_report_template.py +385 -0
- mlsurv-0.1.0/mlsurv/learner/_patient_resolve.py +91 -0
- mlsurv-0.1.0/mlsurv/learner/_persistence.py +457 -0
- mlsurv-0.1.0/mlsurv/learner/_prediction.py +590 -0
- mlsurv-0.1.0/mlsurv/learner/_recalibration.py +290 -0
- mlsurv-0.1.0/mlsurv/learner/_references.py +193 -0
- mlsurv-0.1.0/mlsurv/learner/_reports.py +237 -0
- mlsurv-0.1.0/mlsurv/learner/_setup.py +2133 -0
- mlsurv-0.1.0/mlsurv/learner/_state.py +253 -0
- mlsurv-0.1.0/mlsurv/learner/_studies.py +235 -0
- mlsurv-0.1.0/mlsurv/learner/_sweep.py +568 -0
- mlsurv-0.1.0/mlsurv/learner/_training.py +1453 -0
- mlsurv-0.1.0/mlsurv/learner/_tuning.py +1134 -0
- mlsurv-0.1.0/mlsurv/learner/_views.py +453 -0
- mlsurv-0.1.0/mlsurv/learner/_visualization.py +1337 -0
- mlsurv-0.1.0/mlsurv/logging_utils.py +254 -0
- mlsurv-0.1.0/mlsurv/models/__init__.py +445 -0
- mlsurv-0.1.0/mlsurv/models/_auto_defaults.py +369 -0
- mlsurv-0.1.0/mlsurv/models/_metadata.py +35 -0
- mlsurv-0.1.0/mlsurv/models/_overflow.py +250 -0
- mlsurv-0.1.0/mlsurv/models/_reference_adapter.py +127 -0
- mlsurv-0.1.0/mlsurv/models/base.py +763 -0
- mlsurv-0.1.0/mlsurv/models/coxnet.py +470 -0
- mlsurv-0.1.0/mlsurv/models/coxph.py +442 -0
- mlsurv-0.1.0/mlsurv/models/deephit.py +459 -0
- mlsurv-0.1.0/mlsurv/models/deepsurv.py +624 -0
- mlsurv-0.1.0/mlsurv/models/fssvm.py +412 -0
- mlsurv-0.1.0/mlsurv/models/gbsa.py +181 -0
- mlsurv-0.1.0/mlsurv/models/rsf.py +170 -0
- mlsurv-0.1.0/mlsurv/models/weibull_aft.py +342 -0
- mlsurv-0.1.0/mlsurv/models/xgbaft.py +770 -0
- mlsurv-0.1.0/mlsurv/models/xgbcox.py +339 -0
- mlsurv-0.1.0/mlsurv/preprocessing/__init__.py +46 -0
- mlsurv-0.1.0/mlsurv/preprocessing/_cox_fit.py +285 -0
- mlsurv-0.1.0/mlsurv/preprocessing/indicators.py +64 -0
- mlsurv-0.1.0/mlsurv/preprocessing/pipelines.py +281 -0
- mlsurv-0.1.0/mlsurv/preprocessing/selection.py +1201 -0
- mlsurv-0.1.0/mlsurv/preprocessing/utils.py +221 -0
- mlsurv-0.1.0/mlsurv/py.typed +0 -0
- mlsurv-0.1.0/mlsurv/reports/__init__.py +7 -0
- mlsurv-0.1.0/mlsurv/reports/_constants.py +90 -0
- mlsurv-0.1.0/mlsurv/reports/_figure_export.py +103 -0
- mlsurv-0.1.0/mlsurv/reports/_helpers.py +213 -0
- mlsurv-0.1.0/mlsurv/reports/_text.py +38 -0
- mlsurv-0.1.0/mlsurv/reports/generator.py +697 -0
- mlsurv-0.1.0/mlsurv/reports/renderers/__init__.py +11 -0
- mlsurv-0.1.0/mlsurv/reports/renderers/_figures.py +415 -0
- mlsurv-0.1.0/mlsurv/reports/renderers/_scripts.py +488 -0
- mlsurv-0.1.0/mlsurv/reports/renderers/_styles.py +800 -0
- mlsurv-0.1.0/mlsurv/reports/renderers/html.py +537 -0
- mlsurv-0.1.0/mlsurv/reports/renderers/manuscript.py +345 -0
- mlsurv-0.1.0/mlsurv/reports/renderers/markdown.py +388 -0
- mlsurv-0.1.0/mlsurv/reports/sections/__init__.py +50 -0
- mlsurv-0.1.0/mlsurv/reports/sections/_metric_glossary.py +70 -0
- mlsurv-0.1.0/mlsurv/reports/sections/_subsection_base.py +48 -0
- mlsurv-0.1.0/mlsurv/reports/sections/_trained_details.py +314 -0
- mlsurv-0.1.0/mlsurv/reports/sections/base.py +565 -0
- mlsurv-0.1.0/mlsurv/reports/sections/benchmarking.py +987 -0
- mlsurv-0.1.0/mlsurv/reports/sections/data_preprocessing.py +1918 -0
- mlsurv-0.1.0/mlsurv/reports/sections/environment.py +469 -0
- mlsurv-0.1.0/mlsurv/reports/sections/evaluation/__init__.py +10 -0
- mlsurv-0.1.0/mlsurv/reports/sections/evaluation/_base.py +35 -0
- mlsurv-0.1.0/mlsurv/reports/sections/evaluation/_calibration.py +413 -0
- mlsurv-0.1.0/mlsurv/reports/sections/evaluation/_discrimination.py +162 -0
- mlsurv-0.1.0/mlsurv/reports/sections/evaluation/_helpers.py +99 -0
- mlsurv-0.1.0/mlsurv/reports/sections/evaluation/_methodology.py +64 -0
- mlsurv-0.1.0/mlsurv/reports/sections/evaluation/_paired_comparison.py +196 -0
- mlsurv-0.1.0/mlsurv/reports/sections/evaluation/_performance.py +468 -0
- mlsurv-0.1.0/mlsurv/reports/sections/evaluation/_roc.py +224 -0
- mlsurv-0.1.0/mlsurv/reports/sections/evaluation/_section.py +233 -0
- mlsurv-0.1.0/mlsurv/reports/sections/evaluation/_stratification.py +678 -0
- mlsurv-0.1.0/mlsurv/reports/sections/feature_analysis/__init__.py +20 -0
- mlsurv-0.1.0/mlsurv/reports/sections/feature_analysis/_audit.py +255 -0
- mlsurv-0.1.0/mlsurv/reports/sections/feature_analysis/_coefficient_analysis.py +100 -0
- mlsurv-0.1.0/mlsurv/reports/sections/feature_analysis/_coefficients.py +140 -0
- mlsurv-0.1.0/mlsurv/reports/sections/feature_analysis/_correlation.py +251 -0
- mlsurv-0.1.0/mlsurv/reports/sections/feature_analysis/_hazard_ratios.py +198 -0
- mlsurv-0.1.0/mlsurv/reports/sections/feature_analysis/_helpers.py +128 -0
- mlsurv-0.1.0/mlsurv/reports/sections/feature_analysis/_importance.py +445 -0
- mlsurv-0.1.0/mlsurv/reports/sections/feature_analysis/_interactions.py +253 -0
- mlsurv-0.1.0/mlsurv/reports/sections/feature_analysis/_interactive_table.py +353 -0
- mlsurv-0.1.0/mlsurv/reports/sections/feature_analysis/_section.py +858 -0
- mlsurv-0.1.0/mlsurv/reports/sections/feature_analysis/_shap.py +102 -0
- mlsurv-0.1.0/mlsurv/reports/sections/limitations.py +1027 -0
- mlsurv-0.1.0/mlsurv/reports/sections/model_development.py +851 -0
- mlsurv-0.1.0/mlsurv/reports/sections/references.py +863 -0
- mlsurv-0.1.0/mlsurv/reports/sections/subpopulation_analysis.py +288 -0
- mlsurv-0.1.0/mlsurv/reports/sections/summary.py +1114 -0
- mlsurv-0.1.0/mlsurv/reports/sections/tripod_checklist.py +474 -0
- mlsurv-0.1.0/mlsurv/reports/sections/validation/__init__.py +10 -0
- mlsurv-0.1.0/mlsurv/reports/sections/validation/_base.py +41 -0
- mlsurv-0.1.0/mlsurv/reports/sections/validation/_bootstrap.py +200 -0
- mlsurv-0.1.0/mlsurv/reports/sections/validation/_calibration.py +323 -0
- mlsurv-0.1.0/mlsurv/reports/sections/validation/_discrimination.py +120 -0
- mlsurv-0.1.0/mlsurv/reports/sections/validation/_helpers.py +179 -0
- mlsurv-0.1.0/mlsurv/reports/sections/validation/_performance_drop.py +150 -0
- mlsurv-0.1.0/mlsurv/reports/sections/validation/_section.py +496 -0
- mlsurv-0.1.0/mlsurv/reports/sections/validation/_stratification.py +377 -0
- mlsurv-0.1.0/mlsurv/reports/sections/validation/_table1.py +351 -0
- mlsurv-0.1.0/mlsurv/results/__init__.py +65 -0
- mlsurv-0.1.0/mlsurv/results/_containers_extraction.py +321 -0
- mlsurv-0.1.0/mlsurv/results/_containers_helpers.py +410 -0
- mlsurv-0.1.0/mlsurv/results/_containers_printing.py +343 -0
- mlsurv-0.1.0/mlsurv/results/_explanation.py +46 -0
- mlsurv-0.1.0/mlsurv/results/_prediction.py +733 -0
- mlsurv-0.1.0/mlsurv/results/containers.py +1662 -0
- mlsurv-0.1.0/mlsurv/results/printing.py +1599 -0
- mlsurv-0.1.0/mlsurv/results/tables.py +396 -0
- mlsurv-0.1.0/mlsurv/tuning/__init__.py +72 -0
- mlsurv-0.1.0/mlsurv/tuning/base.py +1528 -0
- mlsurv-0.1.0/mlsurv/tuning/exceptions.py +24 -0
- mlsurv-0.1.0/mlsurv/tuning/optuna_tuner.py +89 -0
- mlsurv-0.1.0/mlsurv/tuning/search_spaces.py +592 -0
- mlsurv-0.1.0/mlsurv/tuning/storage.py +108 -0
- mlsurv-0.1.0/mlsurv/tuning/studies.py +389 -0
- mlsurv-0.1.0/mlsurv/tuning/tuners/__init__.py +72 -0
- mlsurv-0.1.0/mlsurv/tuning/tuners/coxnet.py +50 -0
- mlsurv-0.1.0/mlsurv/tuning/tuners/coxph.py +46 -0
- mlsurv-0.1.0/mlsurv/tuning/tuners/custom.py +55 -0
- mlsurv-0.1.0/mlsurv/tuning/tuners/deephit.py +57 -0
- mlsurv-0.1.0/mlsurv/tuning/tuners/deepsurv.py +56 -0
- mlsurv-0.1.0/mlsurv/tuning/tuners/fssvm.py +78 -0
- mlsurv-0.1.0/mlsurv/tuning/tuners/gbsa.py +29 -0
- mlsurv-0.1.0/mlsurv/tuning/tuners/rsf.py +30 -0
- mlsurv-0.1.0/mlsurv/tuning/tuners/weibull_aft.py +27 -0
- mlsurv-0.1.0/mlsurv/tuning/tuners/xgbaft.py +44 -0
- mlsurv-0.1.0/mlsurv/tuning/tuners/xgbcox.py +35 -0
- mlsurv-0.1.0/mlsurv/utils.py +1730 -0
- mlsurv-0.1.0/mlsurv/viz/__init__.py +179 -0
- mlsurv-0.1.0/mlsurv/viz/_context.py +348 -0
- mlsurv-0.1.0/mlsurv/viz/_data.py +1323 -0
- mlsurv-0.1.0/mlsurv/viz/_data_metrics.py +1295 -0
- mlsurv-0.1.0/mlsurv/viz/_features_coefficients.py +795 -0
- mlsurv-0.1.0/mlsurv/viz/_features_correlation.py +286 -0
- mlsurv-0.1.0/mlsurv/viz/_features_hazard_ratios.py +966 -0
- mlsurv-0.1.0/mlsurv/viz/_features_helpers.py +144 -0
- mlsurv-0.1.0/mlsurv/viz/_features_importance.py +623 -0
- mlsurv-0.1.0/mlsurv/viz/_features_importance_multi.py +840 -0
- mlsurv-0.1.0/mlsurv/viz/_metrics_helpers.py +846 -0
- mlsurv-0.1.0/mlsurv/viz/_metrics_multi.py +527 -0
- mlsurv-0.1.0/mlsurv/viz/_metrics_renderers.py +603 -0
- mlsurv-0.1.0/mlsurv/viz/_metrics_roc.py +884 -0
- mlsurv-0.1.0/mlsurv/viz/_metrics_time.py +1214 -0
- mlsurv-0.1.0/mlsurv/viz/_palettes.py +1055 -0
- mlsurv-0.1.0/mlsurv/viz/_plot_impl.py +84 -0
- mlsurv-0.1.0/mlsurv/viz/_plot_impl_calibration.py +726 -0
- mlsurv-0.1.0/mlsurv/viz/_plot_impl_importance.py +69 -0
- mlsurv-0.1.0/mlsurv/viz/_plot_impl_metric.py +513 -0
- mlsurv-0.1.0/mlsurv/viz/_plot_impl_metric_time.py +821 -0
- mlsurv-0.1.0/mlsurv/viz/_plot_impl_roc.py +804 -0
- mlsurv-0.1.0/mlsurv/viz/_plot_impl_secondary.py +840 -0
- mlsurv-0.1.0/mlsurv/viz/_plot_impl_shared.py +494 -0
- mlsurv-0.1.0/mlsurv/viz/_plot_impl_survival.py +400 -0
- mlsurv-0.1.0/mlsurv/viz/_plotly_helpers.py +106 -0
- mlsurv-0.1.0/mlsurv/viz/_resolve.py +489 -0
- mlsurv-0.1.0/mlsurv/viz/_survival_figure.py +203 -0
- mlsurv-0.1.0/mlsurv/viz/_survival_helpers.py +376 -0
- mlsurv-0.1.0/mlsurv/viz/_survival_logrank.py +192 -0
- mlsurv-0.1.0/mlsurv/viz/_survival_maxstat.py +458 -0
- mlsurv-0.1.0/mlsurv/viz/_survival_renderers.py +692 -0
- mlsurv-0.1.0/mlsurv/viz/_theme.py +401 -0
- mlsurv-0.1.0/mlsurv/viz/_time_format.py +50 -0
- mlsurv-0.1.0/mlsurv/viz/_validation.py +45 -0
- mlsurv-0.1.0/mlsurv/viz/benchmarking_scatter.py +274 -0
- mlsurv-0.1.0/mlsurv/viz/calibration.py +1333 -0
- mlsurv-0.1.0/mlsurv/viz/diagnostics.py +713 -0
- mlsurv-0.1.0/mlsurv/viz/distributions.py +372 -0
- mlsurv-0.1.0/mlsurv/viz/explain.py +278 -0
- mlsurv-0.1.0/mlsurv/viz/export.py +337 -0
- mlsurv-0.1.0/mlsurv/viz/features.py +420 -0
- mlsurv-0.1.0/mlsurv/viz/flowchart.py +252 -0
- mlsurv-0.1.0/mlsurv/viz/interactions.py +1080 -0
- mlsurv-0.1.0/mlsurv/viz/metrics.py +911 -0
- mlsurv-0.1.0/mlsurv/viz/missing.py +145 -0
- mlsurv-0.1.0/mlsurv/viz/shap.py +637 -0
- mlsurv-0.1.0/mlsurv/viz/survival.py +509 -0
- mlsurv-0.1.0/mlsurv/viz/sweep.py +160 -0
- mlsurv-0.1.0/mlsurv.egg-info/PKG-INFO +297 -0
- mlsurv-0.1.0/mlsurv.egg-info/SOURCES.txt +450 -0
- mlsurv-0.1.0/mlsurv.egg-info/dependency_links.txt +1 -0
- mlsurv-0.1.0/mlsurv.egg-info/entry_points.txt +2 -0
- mlsurv-0.1.0/mlsurv.egg-info/requires.txt +31 -0
- mlsurv-0.1.0/mlsurv.egg-info/top_level.txt +1 -0
- mlsurv-0.1.0/pyproject.toml +139 -0
- mlsurv-0.1.0/setup.cfg +4 -0
- mlsurv-0.1.0/tests/test_add_eval_times.py +453 -0
- mlsurv-0.1.0/tests/test_base_subsection.py +139 -0
- mlsurv-0.1.0/tests/test_benchmark_scatter.py +238 -0
- mlsurv-0.1.0/tests/test_benchmarking.py +2637 -0
- mlsurv-0.1.0/tests/test_benchmarking_roc_nan_refs.py +321 -0
- mlsurv-0.1.0/tests/test_bootstrap_coalesce_followup.py +381 -0
- mlsurv-0.1.0/tests/test_bootstrap_correctness.py +347 -0
- mlsurv-0.1.0/tests/test_cal_cache_thread_safety.py +231 -0
- mlsurv-0.1.0/tests/test_cal_precompute.py +125 -0
- mlsurv-0.1.0/tests/test_calibration_coalesce.py +251 -0
- mlsurv-0.1.0/tests/test_calibration_helpers.py +286 -0
- mlsurv-0.1.0/tests/test_calibration_labels.py +469 -0
- mlsurv-0.1.0/tests/test_calibration_metrics.py +949 -0
- mlsurv-0.1.0/tests/test_categorical_groups.py +541 -0
- mlsurv-0.1.0/tests/test_cli_calibrate.py +287 -0
- mlsurv-0.1.0/tests/test_cli_patient_report.py +423 -0
- mlsurv-0.1.0/tests/test_cli_plot.py +1379 -0
- mlsurv-0.1.0/tests/test_coalesced_calibration_nan.py +402 -0
- mlsurv-0.1.0/tests/test_coalesced_incremental_nan.py +431 -0
- mlsurv-0.1.0/tests/test_config_persistence.py +785 -0
- mlsurv-0.1.0/tests/test_constants.py +126 -0
- mlsurv-0.1.0/tests/test_containers.py +2787 -0
- mlsurv-0.1.0/tests/test_core_resolve.py +102 -0
- mlsurv-0.1.0/tests/test_covariance_selectors.py +567 -0
- mlsurv-0.1.0/tests/test_coxph_alpha_tuning.py +164 -0
- mlsurv-0.1.0/tests/test_ctd.py +414 -0
- mlsurv-0.1.0/tests/test_custom_model_tuning.py +557 -0
- mlsurv-0.1.0/tests/test_cv_training.py +67 -0
- mlsurv-0.1.0/tests/test_data_leakage.py +578 -0
- mlsurv-0.1.0/tests/test_demos.py +73 -0
- mlsurv-0.1.0/tests/test_dense_ibs.py +442 -0
- mlsurv-0.1.0/tests/test_device_param.py +221 -0
- mlsurv-0.1.0/tests/test_diagnostics_consolidation.py +284 -0
- mlsurv-0.1.0/tests/test_edge_cases.py +855 -0
- mlsurv-0.1.0/tests/test_encoding_warning.py +101 -0
- mlsurv-0.1.0/tests/test_epv_dedup.py +86 -0
- mlsurv-0.1.0/tests/test_eval_time_clipping.py +468 -0
- mlsurv-0.1.0/tests/test_eval_times_resolver.py +375 -0
- mlsurv-0.1.0/tests/test_evaluation_helpers.py +641 -0
- mlsurv-0.1.0/tests/test_explain.py +636 -0
- mlsurv-0.1.0/tests/test_export_results.py +1155 -0
- mlsurv-0.1.0/tests/test_export_study.py +771 -0
- mlsurv-0.1.0/tests/test_feature_groups_report.py +242 -0
- mlsurv-0.1.0/tests/test_feature_importance_enhancements.py +706 -0
- mlsurv-0.1.0/tests/test_feature_summary.py +617 -0
- mlsurv-0.1.0/tests/test_filter_numeric_for_corr.py +74 -0
- mlsurv-0.1.0/tests/test_format_helpers.py +33 -0
- mlsurv-0.1.0/tests/test_format_helpers_import_discipline.py +109 -0
- mlsurv-0.1.0/tests/test_friendly_errors.py +1010 -0
- mlsurv-0.1.0/tests/test_fssvm_validation.py +748 -0
- mlsurv-0.1.0/tests/test_get_metric_vignettes.py +83 -0
- mlsurv-0.1.0/tests/test_gnd_n_bins.py +275 -0
- mlsurv-0.1.0/tests/test_gnd_sample_size_coalesce.py +414 -0
- mlsurv-0.1.0/tests/test_guidance.py +1167 -0
- mlsurv-0.1.0/tests/test_heavy_censoring_warning.py +240 -0
- mlsurv-0.1.0/tests/test_helpers_factory.py +142 -0
- mlsurv-0.1.0/tests/test_hr_dynamic_ticks.py +357 -0
- mlsurv-0.1.0/tests/test_hr_validity_gating.py +184 -0
- mlsurv-0.1.0/tests/test_import_discipline.py +211 -0
- mlsurv-0.1.0/tests/test_importance_method.py +153 -0
- mlsurv-0.1.0/tests/test_importance_test_invalidation.py +229 -0
- mlsurv-0.1.0/tests/test_inf_risk_scores.py +296 -0
- mlsurv-0.1.0/tests/test_integration.py +1479 -0
- mlsurv-0.1.0/tests/test_interactions.py +3450 -0
- mlsurv-0.1.0/tests/test_interactions_regression.py +250 -0
- mlsurv-0.1.0/tests/test_ipcw_support_flag.py +833 -0
- mlsurv-0.1.0/tests/test_ipcw_truncation_messaging.py +542 -0
- mlsurv-0.1.0/tests/test_iter_warn.py +482 -0
- mlsurv-0.1.0/tests/test_kwarg_forwarding.py +189 -0
- mlsurv-0.1.0/tests/test_learner_plot_wrappers.py +744 -0
- mlsurv-0.1.0/tests/test_learner_views.py +1701 -0
- mlsurv-0.1.0/tests/test_lifecycle_integration.py +202 -0
- mlsurv-0.1.0/tests/test_lifelines_warning_filter.py +88 -0
- mlsurv-0.1.0/tests/test_limitations.py +1429 -0
- mlsurv-0.1.0/tests/test_linearity_metrics.py +801 -0
- mlsurv-0.1.0/tests/test_list_model_selection.py +142 -0
- mlsurv-0.1.0/tests/test_logging_utils.py +379 -0
- mlsurv-0.1.0/tests/test_manuscript_renderer.py +796 -0
- mlsurv-0.1.0/tests/test_metric_param_unification.py +193 -0
- mlsurv-0.1.0/tests/test_metrics_roc_assembly.py +169 -0
- mlsurv-0.1.0/tests/test_missing_indicators.py +70 -0
- mlsurv-0.1.0/tests/test_missingness_leakage.py +263 -0
- mlsurv-0.1.0/tests/test_mixin_layout.py +103 -0
- mlsurv-0.1.0/tests/test_model_assumptions.py +37 -0
- mlsurv-0.1.0/tests/test_model_recommendations_property.py +154 -0
- mlsurv-0.1.0/tests/test_multi_model_low_coverage_coalesce.py +522 -0
- mlsurv-0.1.0/tests/test_multi_model_methods.py +563 -0
- mlsurv-0.1.0/tests/test_new_models.py +865 -0
- mlsurv-0.1.0/tests/test_njobs_audit.py +773 -0
- mlsurv-0.1.0/tests/test_paired_comparison.py +704 -0
- mlsurv-0.1.0/tests/test_paired_comparison_printing.py +717 -0
- mlsurv-0.1.0/tests/test_parallel.py +1452 -0
- mlsurv-0.1.0/tests/test_parameter_sweep.py +533 -0
- mlsurv-0.1.0/tests/test_patient_report.py +538 -0
- mlsurv-0.1.0/tests/test_patient_resolve.py +187 -0
- mlsurv-0.1.0/tests/test_patient_select.py +112 -0
- mlsurv-0.1.0/tests/test_penalized_cox_selectors.py +632 -0
- mlsurv-0.1.0/tests/test_per_model_preprocessing.py +368 -0
- mlsurv-0.1.0/tests/test_permutation_importance_method.py +218 -0
- mlsurv-0.1.0/tests/test_persist_stat_tests.py +519 -0
- mlsurv-0.1.0/tests/test_ph_linearity_result_properties.py +172 -0
- mlsurv-0.1.0/tests/test_ph_test_overflow_suppression.py +168 -0
- mlsurv-0.1.0/tests/test_phase1_imports.py +135 -0
- mlsurv-0.1.0/tests/test_phase1_utils.py +1687 -0
- mlsurv-0.1.0/tests/test_phase2_feature_selection.py +1055 -0
- mlsurv-0.1.0/tests/test_phase2_models.py +2590 -0
- mlsurv-0.1.0/tests/test_phase3_evaluation.py +3673 -0
- mlsurv-0.1.0/tests/test_phase3_learner.py +2789 -0
- mlsurv-0.1.0/tests/test_phase3_tuning.py +1174 -0
- mlsurv-0.1.0/tests/test_phase4_cli.py +7774 -0
- mlsurv-0.1.0/tests/test_phase4_tables.py +179 -0
- mlsurv-0.1.0/tests/test_phase4_viz.py +4952 -0
- mlsurv-0.1.0/tests/test_pimp.py +527 -0
- mlsurv-0.1.0/tests/test_pipeline_unwrap.py +107 -0
- mlsurv-0.1.0/tests/test_plot_impl_stacklevels.py +221 -0
- mlsurv-0.1.0/tests/test_plot_models_best_sentinel.py +440 -0
- mlsurv-0.1.0/tests/test_plot_roc_nan_refs_followup.py +110 -0
- mlsurv-0.1.0/tests/test_plot_validation_heatmap.py +180 -0
- mlsurv-0.1.0/tests/test_plotly_helpers.py +87 -0
- mlsurv-0.1.0/tests/test_post_train_result_props.py +244 -0
- mlsurv-0.1.0/tests/test_prediction.py +1606 -0
- mlsurv-0.1.0/tests/test_preprocessing_tuning.py +434 -0
- mlsurv-0.1.0/tests/test_preprocessing_utils.py +115 -0
- mlsurv-0.1.0/tests/test_printing.py +1772 -0
- mlsurv-0.1.0/tests/test_printing_cv_order.py +72 -0
- mlsurv-0.1.0/tests/test_r_consumer_contract.py +162 -0
- mlsurv-0.1.0/tests/test_reference_overlap_warning_dedup.py +223 -0
- mlsurv-0.1.0/tests/test_report_dev.py +124 -0
- mlsurv-0.1.0/tests/test_report_environment_section.py +493 -0
- mlsurv-0.1.0/tests/test_report_eval_times.py +396 -0
- mlsurv-0.1.0/tests/test_report_exception_guards.py +619 -0
- mlsurv-0.1.0/tests/test_report_interpretation.py +365 -0
- mlsurv-0.1.0/tests/test_report_linearity_section.py +243 -0
- mlsurv-0.1.0/tests/test_report_pvalue_format.py +132 -0
- mlsurv-0.1.0/tests/test_report_references_section.py +553 -0
- mlsurv-0.1.0/tests/test_report_section_error_handling.py +137 -0
- mlsurv-0.1.0/tests/test_report_text_helpers.py +45 -0
- mlsurv-0.1.0/tests/test_reports.py +7392 -0
- mlsurv-0.1.0/tests/test_reports_programmatic_access.py +603 -0
- mlsurv-0.1.0/tests/test_reproducibility.py +438 -0
- mlsurv-0.1.0/tests/test_resolve_model_results.py +258 -0
- mlsurv-0.1.0/tests/test_results_architecture.py +783 -0
- mlsurv-0.1.0/tests/test_roc_subsection.py +249 -0
- mlsurv-0.1.0/tests/test_run_model_params_n_trials_zero.py +187 -0
- mlsurv-0.1.0/tests/test_run_resume.py +166 -0
- mlsurv-0.1.0/tests/test_save_learner.py +504 -0
- mlsurv-0.1.0/tests/test_search_spaces.py +1055 -0
- mlsurv-0.1.0/tests/test_sections_state_access_discipline.py +254 -0
- mlsurv-0.1.0/tests/test_setup_linearity_diagnostic.py +348 -0
- mlsurv-0.1.0/tests/test_setup_ph_diagnostic.py +590 -0
- mlsurv-0.1.0/tests/test_setup_small_subpop_warning.py +460 -0
- mlsurv-0.1.0/tests/test_setup_timeseries_order_warning.py +210 -0
- mlsurv-0.1.0/tests/test_shap_background.py +223 -0
- mlsurv-0.1.0/tests/test_shap_bool_dummy_masker.py +141 -0
- mlsurv-0.1.0/tests/test_shap_demotion.py +194 -0
- mlsurv-0.1.0/tests/test_shap_feature_names.py +117 -0
- mlsurv-0.1.0/tests/test_shap_method.py +129 -0
- mlsurv-0.1.0/tests/test_shared_utils.py +269 -0
- mlsurv-0.1.0/tests/test_show_ci_tristate.py +399 -0
- mlsurv-0.1.0/tests/test_silent_auc_nan_fallback.py +786 -0
- mlsurv-0.1.0/tests/test_small_sample_tuning_warning.py +243 -0
- mlsurv-0.1.0/tests/test_subpopulation_analysis.py +2105 -0
- mlsurv-0.1.0/tests/test_subpopulation_labels.py +111 -0
- mlsurv-0.1.0/tests/test_summary_best_model_direction.py +63 -0
- mlsurv-0.1.0/tests/test_summary_extended_lines.py +353 -0
- mlsurv-0.1.0/tests/test_tables_extended.py +362 -0
- mlsurv-0.1.0/tests/test_train_calibrate.py +994 -0
- mlsurv-0.1.0/tests/test_train_metrics.py +162 -0
- mlsurv-0.1.0/tests/test_training_setup_hardening.py +796 -0
- mlsurv-0.1.0/tests/test_tuned_key_lifecycle.py +103 -0
- mlsurv-0.1.0/tests/test_tuner_classes.py +2121 -0
- mlsurv-0.1.0/tests/test_tuning_contract.py +713 -0
- mlsurv-0.1.0/tests/test_tuning_enhancements.py +772 -0
- mlsurv-0.1.0/tests/test_validate_delta.py +99 -0
- mlsurv-0.1.0/tests/test_validate_references.py +352 -0
- mlsurv-0.1.0/tests/test_vignette_03_sksurv_targets.py +80 -0
- mlsurv-0.1.0/tests/test_vignette_smoke.py +260 -0
- mlsurv-0.1.0/tests/test_vignettes.py +215 -0
- mlsurv-0.1.0/tests/test_viz_adaptive_sizing.py +335 -0
- mlsurv-0.1.0/tests/test_viz_band_labels.py +197 -0
- mlsurv-0.1.0/tests/test_viz_context.py +262 -0
- mlsurv-0.1.0/tests/test_viz_diagnostics.py +788 -0
- mlsurv-0.1.0/tests/test_viz_distributions.py +273 -0
- mlsurv-0.1.0/tests/test_viz_export.py +391 -0
- mlsurv-0.1.0/tests/test_viz_feature_groups.py +1243 -0
- mlsurv-0.1.0/tests/test_viz_importance.py +193 -0
- mlsurv-0.1.0/tests/test_viz_metrics_helpers.py +511 -0
- mlsurv-0.1.0/tests/test_viz_missing.py +207 -0
- mlsurv-0.1.0/tests/test_viz_palettes.py +496 -0
- mlsurv-0.1.0/tests/test_viz_resolver_tuned.py +118 -0
- mlsurv-0.1.0/tests/test_viz_return_data.py +1471 -0
- mlsurv-0.1.0/tests/test_viz_return_data_lowlevel.py +235 -0
- mlsurv-0.1.0/tests/test_viz_roc.py +895 -0
- mlsurv-0.1.0/tests/test_viz_shap.py +56 -0
- mlsurv-0.1.0/tests/test_viz_subpop_facet.py +306 -0
- mlsurv-0.1.0/tests/test_warn_eval_times_failure.py +135 -0
- mlsurv-0.1.0/tests/test_warning_emission_followups.py +389 -0
- mlsurv-0.1.0/tests/test_warning_quality.py +953 -0
- mlsurv-0.1.0/tests/test_xgb_early_stopping.py +216 -0
- mlsurv-0.1.0/tests/test_xgbaft.py +543 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to mlsurv are documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.1.0] - 2026-06-25
|
|
9
|
+
|
|
10
|
+
Initial public release of mlsurv, a low-code machine learning package for
|
|
11
|
+
survival analysis. mlsurv unifies modeling, tuning, evaluation, validation,
|
|
12
|
+
and reporting into a single API.
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
- **Low-code survival analysis workflow** — a typical analysis runs `setup()`
|
|
17
|
+
(configure preprocessing and cross-validation) → `run()` (train, tune,
|
|
18
|
+
evaluate, and bootstrap every model in one call, or call `train()`, `tune()`,
|
|
19
|
+
`evaluate()`, and `bootstrap()` individually) → `generate_report()`
|
|
20
|
+
(publication-ready HTML or markdown). Additional steps slot in as needed:
|
|
21
|
+
`predict()` for new patients, `validate()` on an external cohort,
|
|
22
|
+
`train(calibrate=...)` for post-hoc `S(t|x)` calibration, `explain()` for
|
|
23
|
+
SHAP, `benchmark()` against reference biomarkers, and `parameter_sweep()`.
|
|
24
|
+
- **Results access, export, and persistence** — every result is stored on the
|
|
25
|
+
learner and reachable through read-only accessors (`models`, `best_model`,
|
|
26
|
+
`evaluation_result`, `bootstrap_result`), so you never need to capture what
|
|
27
|
+
`run()` returns. `export_results()` writes all tables to an Excel workbook or
|
|
28
|
+
CSVs, and `save_learner()` / `load_learner()` round-trip the whole session with
|
|
29
|
+
results intact.
|
|
30
|
+
- **10 survival models** across four families with a unified interface:
|
|
31
|
+
CoxPH, CoxNet, and Weibull AFT (linear/parametric); Random Survival Forest,
|
|
32
|
+
Gradient Boosting Survival Analysis, XGBoost-Cox, and XGBoost-AFT
|
|
33
|
+
(tree ensembles); Fast Survival SVM (kernel); DeepSurv and DeepHit (neural,
|
|
34
|
+
optional via the `deep` extra).
|
|
35
|
+
- **Configurable preprocessing pipeline** with leak-free cross-validation:
|
|
36
|
+
imputation (median, mean, KNN, iterative), scaling (standard, robust, minmax,
|
|
37
|
+
PCA), and five feature selectors (`topk`, `vif`, `correlation`, `coxlasso`,
|
|
38
|
+
`coxnet`).
|
|
39
|
+
- **Automated setup checks**: events-per-variable warnings, leakage detection,
|
|
40
|
+
proportional-hazards and linearity testing, and model recommendations.
|
|
41
|
+
- **Hyperparameter tuning** via Optuna with EPV-aware search spaces, automatic
|
|
42
|
+
trial sizing, convergence detection, and study persistence.
|
|
43
|
+
- **Multi-metric evaluation**: Harrell, IPCW, and Antolini C-index; Brier score
|
|
44
|
+
and integrated Brier score; time-dependent AUC(t); calibration
|
|
45
|
+
slope/intercept; and the Greenwood-Nam-D'Agostino test. `add_eval_times()`
|
|
46
|
+
registers additive report horizons (e.g. 12- and 60-month) that flow into the
|
|
47
|
+
time-dependent metrics without replacing the default grid.
|
|
48
|
+
- **External validation and benchmarking** on independent cohorts, including
|
|
49
|
+
delta-C, NRI, and IDI incremental metrics against reference biomarkers.
|
|
50
|
+
- **Post-hoc `S(t|x)` calibration**: opt-in via `train(calibrate=...)`, with
|
|
51
|
+
leakage-free out-of-fold fitting and a choice of methods (isotonic, low
|
|
52
|
+
degrees of freedom, Breslow-slope refit). The calibrator is applied wherever
|
|
53
|
+
the model produces survival probabilities, including cohort and patient
|
|
54
|
+
reports and the `validate()` transferability panel.
|
|
55
|
+
- **Feature explanation**: permutation importance, SHAP values and
|
|
56
|
+
interactions, and single-patient explanations with a SHAP waterfall and
|
|
57
|
+
cohort context.
|
|
58
|
+
- **Statistical tests**: proportional-hazards (Schoenfeld), log-rank, RMST, and
|
|
59
|
+
permutation-importance significance (PIMP).
|
|
60
|
+
- **Automated reporting**: interactive single-file HTML reports and plain-text
|
|
61
|
+
markdown reports (figures as PNGs), with a TRIPOD+AI compliance checklist and
|
|
62
|
+
13 automatically detected limitation flags.
|
|
63
|
+
- **Command-line interface** with 26 subcommands for scripting and HPC
|
|
64
|
+
pipelines, covering the full workflow (run, train, tune, evaluate, bootstrap,
|
|
65
|
+
validate, predict, calibrate, explain, benchmark, sweep, plot), statistical
|
|
66
|
+
tests (including feature interactions), patient reports, full result export,
|
|
67
|
+
Optuna study management, artifact inspection/upgrade, and model listing.
|
|
68
|
+
- **Parallel execution**: one-line `n_jobs=-1` setup with smart auto-disable
|
|
69
|
+
and oversubscription guards.
|
|
70
|
+
- **Reproducible by default**: a single `random_state` seeds scikit-learn,
|
|
71
|
+
XGBoost, and PyTorch; bit-exact runs require `n_jobs=1`.
|
|
72
|
+
- **Inline type annotations** shipped with a `py.typed` marker (PEP 561).
|
|
73
|
+
|
|
74
|
+
[0.1.0]: https://github.com/goeckslab/mlsurv/releases/tag/v0.1.0
|
mlsurv-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Alyssa Pybus
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
mlsurv-0.1.0/MANIFEST.in
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
include CHANGELOG.md
|
mlsurv-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mlsurv
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Low-code machine learning package for survival analysis
|
|
5
|
+
Author-email: Alyssa Pybus <alyssa.pybus@moffitt.org>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/goeckslab/mlsurv
|
|
8
|
+
Project-URL: Bug Tracker, https://github.com/goeckslab/mlsurv/issues
|
|
9
|
+
Keywords: survival analysis,machine learning,cox regression,random survival forest
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Intended Audience :: Science/Research
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
|
|
18
|
+
Requires-Python: >=3.11
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
Requires-Dist: numpy>=1.21.0
|
|
22
|
+
Requires-Dist: pandas>=1.3.0
|
|
23
|
+
Requires-Dist: scikit-learn>=1.2.0
|
|
24
|
+
Requires-Dist: scikit-survival>=0.22.0
|
|
25
|
+
Requires-Dist: lifelines>=0.27.0
|
|
26
|
+
Requires-Dist: optuna>=3.3.0
|
|
27
|
+
Requires-Dist: plotly>=5.18.0
|
|
28
|
+
Requires-Dist: mistune>=3.0.0
|
|
29
|
+
Requires-Dist: kaleido>=0.2.1
|
|
30
|
+
Requires-Dist: tabulate>=0.9.0
|
|
31
|
+
Requires-Dist: xgboost>=1.6.0
|
|
32
|
+
Requires-Dist: openpyxl>=3.0.0
|
|
33
|
+
Requires-Dist: shap>=0.42.0
|
|
34
|
+
Requires-Dist: jupyter>=1.0.0
|
|
35
|
+
Requires-Dist: ipykernel>=6.0.0
|
|
36
|
+
Provides-Extra: deep
|
|
37
|
+
Requires-Dist: torch>=1.9.0; extra == "deep"
|
|
38
|
+
Requires-Dist: pycox>=0.2.0; extra == "deep"
|
|
39
|
+
Provides-Extra: postgres
|
|
40
|
+
Requires-Dist: psycopg2-binary>=2.9.0; extra == "postgres"
|
|
41
|
+
Provides-Extra: completion
|
|
42
|
+
Requires-Dist: argcomplete>=2.0.0; extra == "completion"
|
|
43
|
+
Provides-Extra: dev
|
|
44
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
45
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
46
|
+
Requires-Dist: pytest-timeout>=2.1.0; extra == "dev"
|
|
47
|
+
Requires-Dist: argcomplete>=2.0.0; extra == "dev"
|
|
48
|
+
Dynamic: license-file
|
|
49
|
+
|
|
50
|
+
<p align="center">
|
|
51
|
+
<img src="https://raw.githubusercontent.com/goeckslab/mlsurv/main/docs/logo/mlsurv_icon.png" alt="mlsurv logo" width="120">
|
|
52
|
+
</p>
|
|
53
|
+
|
|
54
|
+
<h1 align="center">mlsurv</h1>
|
|
55
|
+
|
|
56
|
+
<p align="center">
|
|
57
|
+
<em>Low-code machine learning package for survival analysis</em>
|
|
58
|
+
</p>
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Intro to mlsurv
|
|
63
|
+
|
|
64
|
+
Survival analysis in clinical research typically requires stitching together various software tools for modeling, visualization, tuning, validation, and reporting. mlsurv unifies these processes into a single package: train, tune, and validate 10 survival models, generate publication-ready reports, and test on independent cohorts — all in under 10 lines of code.
|
|
65
|
+
|
|
66
|
+
<p align="center">
|
|
67
|
+
<img src="https://raw.githubusercontent.com/goeckslab/mlsurv/main/docs/overview.png" alt="mlsurv overview" width="600">
|
|
68
|
+
</p>
|
|
69
|
+
|
|
70
|
+
## Quick Start
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
from mlsurv import SurvivalLearner
|
|
74
|
+
from mlsurv.utils import load_survival_data
|
|
75
|
+
|
|
76
|
+
# Load data (pandas DataFrame + structured array with 'event' and 'time' fields)
|
|
77
|
+
X, y = load_survival_data('data.csv', time_col='OS_MONTHS', event_col='OS_STATUS')
|
|
78
|
+
|
|
79
|
+
# Train, tune, evaluate, and bootstrap all models
|
|
80
|
+
learner = SurvivalLearner(X, y)
|
|
81
|
+
learner.setup(random_state=42)
|
|
82
|
+
learner.run()
|
|
83
|
+
|
|
84
|
+
# Generate a publication-ready interactive HTML report
|
|
85
|
+
learner.generate_report('report.html')
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
See [Vignette 01](https://github.com/goeckslab/mlsurv/blob/main/examples/vignette_01_quickstart.ipynb) for a complete walkthrough.
|
|
89
|
+
|
|
90
|
+
### Accessing results and saving your analysis
|
|
91
|
+
|
|
92
|
+
The learner stores every result internally, so you don't need to capture what
|
|
93
|
+
`run()` returns. Reach any result through these read-only accessors at any time,
|
|
94
|
+
including after a reload:
|
|
95
|
+
|
|
96
|
+
```python
|
|
97
|
+
result = learner.models['coxph'] # ModelResult: .evaluation, .bootstrap, .model, .coefficients
|
|
98
|
+
best = learner.best_model # winning ModelResult
|
|
99
|
+
eval_all = learner.evaluation_result # combined EvaluationResult (None before evaluate())
|
|
100
|
+
boot_all = learner.bootstrap_result # combined BootstrapResult (None before bootstrap())
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Export the result tables, or save and reload the whole session:
|
|
104
|
+
|
|
105
|
+
```python
|
|
106
|
+
# Export all result tables to a single Excel workbook (or CSVs with format='csv')
|
|
107
|
+
learner.export_results('results.xlsx')
|
|
108
|
+
|
|
109
|
+
# Save the whole session and reload it later; results survive the round-trip
|
|
110
|
+
learner.save_learner('analysis.learner')
|
|
111
|
+
from mlsurv import load_learner
|
|
112
|
+
learner = load_learner('analysis.learner')
|
|
113
|
+
learner.models['coxph'] # still here after reload
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Command-Line Interface
|
|
117
|
+
|
|
118
|
+
mlsurv also provides a CLI for scripting, HPC pipelines, and quick one-off analyses:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
# Full pipeline in one command
|
|
122
|
+
mlsurv run data.csv --time-col OS_MONTHS --event-col OS_STATUS --output report.html
|
|
123
|
+
|
|
124
|
+
# List available models
|
|
125
|
+
mlsurv models
|
|
126
|
+
|
|
127
|
+
# Train and tune a specific model
|
|
128
|
+
mlsurv tune data.csv --time-col OS_MONTHS --event-col OS_STATUS --model rsf --n-trials 50
|
|
129
|
+
|
|
130
|
+
# Validate on an external cohort
|
|
131
|
+
mlsurv validate data.csv --time-col OS_MONTHS --event-col OS_STATUS \
|
|
132
|
+
--model coxph --validation-data external.csv \
|
|
133
|
+
--val-time-col OS_MONTHS --val-event-col OS_STATUS
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Run `mlsurv --help` for the full list of 26 subcommands, or see the
|
|
137
|
+
[CLI Guide](https://github.com/goeckslab/mlsurv/blob/main/docs/CLI.md) for detailed documentation and workflows.
|
|
138
|
+
|
|
139
|
+
## Data Format
|
|
140
|
+
|
|
141
|
+
mlsurv expects a feature matrix `X` (pandas DataFrame) and a structured survival array `y` with `event` (bool) and `time` (float) fields.
|
|
142
|
+
|
|
143
|
+
**From CSV** (recommended):
|
|
144
|
+
|
|
145
|
+
```python
|
|
146
|
+
from mlsurv.utils import load_survival_data
|
|
147
|
+
|
|
148
|
+
X, y = load_survival_data('data.csv', time_col='OS_MONTHS', event_col='OS_STATUS')
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
`load_survival_data` automatically drops the time/event columns from `X` and converts events to boolean and times to float, following scikit-survival conventions.
|
|
152
|
+
|
|
153
|
+
**From existing DataFrame**:
|
|
154
|
+
|
|
155
|
+
```python
|
|
156
|
+
from mlsurv.utils import to_structured_array
|
|
157
|
+
|
|
158
|
+
y = to_structured_array(times=df['OS_MONTHS'], events=df['OS_STATUS'])
|
|
159
|
+
X = df.drop(columns=['OS_MONTHS', 'OS_STATUS'])
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
**From date columns** (when your data has diagnosis/follow-up dates instead of pre-computed times):
|
|
163
|
+
|
|
164
|
+
```python
|
|
165
|
+
from mlsurv.utils import compute_survival_time
|
|
166
|
+
|
|
167
|
+
X, y = compute_survival_time(
|
|
168
|
+
df, start_col='diagnosis_date', end_col='last_followup_date',
|
|
169
|
+
event_col='vital_status', time_unit='months',
|
|
170
|
+
event_values=['deceased'],
|
|
171
|
+
)
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Missing values are handled automatically via median imputation during preprocessing (configurable via `setup(imputer=...)`).
|
|
175
|
+
|
|
176
|
+
## Installation
|
|
177
|
+
|
|
178
|
+
Install from PyPI:
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
pip install mlsurv
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
With deep learning support (PyTorch, pycox) for DeepSurv / DeepHit:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
pip install "mlsurv[deep]"
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
**macOS note:** the XGBoost models (`xgbaft`, `xgbcox`) need the OpenMP runtime,
|
|
191
|
+
which macOS does not ship by default. If you see an error about `libomp.dylib`
|
|
192
|
+
failing to load, install it once with Homebrew:
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
brew install libomp
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
To install the latest unreleased version from GitHub:
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
pip install git+https://github.com/goeckslab/mlsurv.git
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
For development:
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
git clone https://github.com/goeckslab/mlsurv.git
|
|
208
|
+
cd mlsurv
|
|
209
|
+
pip install -e ".[dev]"
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
See [CONTRIBUTING.md](https://github.com/goeckslab/mlsurv/blob/main/CONTRIBUTING.md) for the
|
|
213
|
+
architecture overview, coding rules, and test conventions.
|
|
214
|
+
|
|
215
|
+
## Features
|
|
216
|
+
|
|
217
|
+
- **Low-code interface**: `setup()` / `run()` / `predict()` / `generate_report()` for a full analysis in under 10 lines of code ([Architecture](https://github.com/goeckslab/mlsurv/blob/main/docs/architecture.md))
|
|
218
|
+
- **10 survival models** across 4 families (linear, ensemble, kernel, neural) with unified interface ([Models](https://github.com/goeckslab/mlsurv/blob/main/docs/architecture.md#model-inventory))
|
|
219
|
+
- **Configurable preprocessing**: Imputation, scaling, and 5 feature selectors with leak-free CV pipelines ([Pipeline](https://github.com/goeckslab/mlsurv/blob/main/docs/pipeline.md))
|
|
220
|
+
- **Automated checks**: EPV warnings, leakage detection, PH and linearity testing, model recommendations ([Pipeline](https://github.com/goeckslab/mlsurv/blob/main/docs/pipeline.md#automated-setup-checks))
|
|
221
|
+
- **Optuna tuning**: EPV-aware search spaces, auto-trial sizing, convergence detection, study persistence ([Evaluation](https://github.com/goeckslab/mlsurv/blob/main/docs/evaluation.md#hyperparameter-tuning))
|
|
222
|
+
- **Multi-metric evaluation**: Harrell/IPCW/Antolini C-index, Brier/IBS, AUC(t), calibration slope/intercept, GND test ([Metrics](https://github.com/goeckslab/mlsurv/blob/main/docs/evaluation.md#evaluation-metrics))
|
|
223
|
+
- **Multi-scale evaluation**: Subpopulation analysis, prospective patient prediction, and single-patient HTML reports with SHAP waterfall + cohort context ([Evaluation](https://github.com/goeckslab/mlsurv/blob/main/docs/evaluation.md)); feature importance, SHAP, interactions, and individual patient explanations ([Feature Analysis](https://github.com/goeckslab/mlsurv/blob/main/docs/feature-analysis.md))
|
|
224
|
+
- **External validation & benchmarking**: Independent cohort validation, delta-C/NRI/IDI incremental metrics ([Validation](https://github.com/goeckslab/mlsurv/blob/main/docs/validation.md))
|
|
225
|
+
- **S(t|x) calibration**: Opt-in per-model calibration via `train(calibrate=...)` (isotonic / lowdof / breslow_slope) fit on leakage-free OOF predictions and applied automatically across evaluate / predict / validate, with a calibration banner in reports ([Calibration](https://github.com/goeckslab/mlsurv/blob/main/docs/evaluation.md#stx-calibration))
|
|
226
|
+
- **Automated reporting**: 12-section interactive HTML report, 14 limitation flags, TRIPOD+AI compliance checklist ([Reporting](https://github.com/goeckslab/mlsurv/blob/main/docs/reporting.md))
|
|
227
|
+
- **Parallel computing**: One-line `n_jobs=-1` setup with smart auto-disable and no oversubscription
|
|
228
|
+
- **26 CLI subcommands** for scripting and HPC pipelines ([CLI Guide](https://github.com/goeckslab/mlsurv/blob/main/docs/CLI.md))
|
|
229
|
+
- **Reproducible by default**: Single `random_state` seeds all frameworks (scikit-learn, XGBoost, PyTorch). Bit-exact reproducibility requires `n_jobs=1`; see [Reproducibility](https://github.com/goeckslab/mlsurv/blob/main/docs/evaluation.md#reproducibility)
|
|
230
|
+
|
|
231
|
+
## Documentation
|
|
232
|
+
|
|
233
|
+
| Guide | Description |
|
|
234
|
+
|-------|-------------|
|
|
235
|
+
| [Architecture & Models](https://github.com/goeckslab/mlsurv/blob/main/docs/architecture.md) | Four-stage workflow, 10 survival models, complexity tiers, unified interface |
|
|
236
|
+
| [Pipeline Configuration](https://github.com/goeckslab/mlsurv/blob/main/docs/pipeline.md) | Data loading, `setup()`, cross-validation, preprocessing, automated checks |
|
|
237
|
+
| [Model Development & Evaluation](https://github.com/goeckslab/mlsurv/blob/main/docs/evaluation.md) | Training, tuning, metrics, bootstrap CIs, model comparison, subpopulation analysis, patient prediction |
|
|
238
|
+
| [Feature Analysis](https://github.com/goeckslab/mlsurv/blob/main/docs/feature-analysis.md) | Feature importance, SHAP, interactions, individual patient explanations |
|
|
239
|
+
| [Validation & Benchmarking](https://github.com/goeckslab/mlsurv/blob/main/docs/validation.md) | External cohort validation, incremental benchmarking metrics |
|
|
240
|
+
| [Reporting & Compliance](https://github.com/goeckslab/mlsurv/blob/main/docs/reporting.md) | Limitation flags, HTML reports, TRIPOD+AI checklist, data export |
|
|
241
|
+
| [CLI Guide](https://github.com/goeckslab/mlsurv/blob/main/docs/CLI.md) | 26 command-line subcommands for scripting and HPC |
|
|
242
|
+
| [Tutorial Vignettes](https://github.com/goeckslab/mlsurv/tree/main/examples) | 7 Jupyter notebooks from quickstart to immunotherapy case study |
|
|
243
|
+
|
|
244
|
+
## Supported Models
|
|
245
|
+
|
|
246
|
+
mlsurv includes 10 survival models across 4 categories:
|
|
247
|
+
|
|
248
|
+
**Linear/Parametric (3)**
|
|
249
|
+
| Model | Description |
|
|
250
|
+
|-------|-------------|
|
|
251
|
+
| CoxPH | Cox Proportional Hazards |
|
|
252
|
+
| CoxNet | Elastic Net penalized Cox |
|
|
253
|
+
| Weibull AFT | Parametric Weibull Accelerated Failure Time model |
|
|
254
|
+
|
|
255
|
+
**Tree-Based Ensemble (4)**
|
|
256
|
+
| Model | Description |
|
|
257
|
+
|-------|-------------|
|
|
258
|
+
| RSF | Random Survival Forest |
|
|
259
|
+
| GBSA | Gradient Boosting Survival Analysis |
|
|
260
|
+
| XGBoost-Cox | XGBoost with survival:cox objective |
|
|
261
|
+
| XGBoost AFT | XGBoost with Accelerated Failure Time objective |
|
|
262
|
+
|
|
263
|
+
**Support Vector Machine (1)**
|
|
264
|
+
| Model | Description |
|
|
265
|
+
|-------|-------------|
|
|
266
|
+
| FSSVM | Fast Survival SVM |
|
|
267
|
+
|
|
268
|
+
**Neural Networks (2)**
|
|
269
|
+
| Model | Description |
|
|
270
|
+
|-------|-------------|
|
|
271
|
+
| DeepSurv | Continuous-time Cox neural network |
|
|
272
|
+
| DeepHit | Discrete-time neural network (DeepHitSingle) |
|
|
273
|
+
|
|
274
|
+
> **Note**: All 10 models assume a single event type. See [Limitations](#limitations) for clinical implications.
|
|
275
|
+
|
|
276
|
+
## Limitations
|
|
277
|
+
|
|
278
|
+
- Single-event right-censored outcomes only (no competing risks, no time-varying covariates)
|
|
279
|
+
- See [Reporting & Compliance](https://github.com/goeckslab/mlsurv/blob/main/docs/reporting.md#limitation-flags) for the full list of 14 automatically detected limitation flags
|
|
280
|
+
|
|
281
|
+
## Citation
|
|
282
|
+
|
|
283
|
+
If you use mlsurv in published work, please cite:
|
|
284
|
+
|
|
285
|
+
> mlsurv: Low-code machine learning for survival analysis. Goecks Lab, Moffitt Cancer Center. https://github.com/goeckslab/mlsurv
|
|
286
|
+
|
|
287
|
+
## Changelog
|
|
288
|
+
|
|
289
|
+
See [CHANGELOG.md](https://github.com/goeckslab/mlsurv/blob/main/CHANGELOG.md) for the release history.
|
|
290
|
+
|
|
291
|
+
## License
|
|
292
|
+
|
|
293
|
+
MIT License - see [LICENSE](https://github.com/goeckslab/mlsurv/blob/main/LICENSE)
|
|
294
|
+
|
|
295
|
+
## Acknowledgments
|
|
296
|
+
|
|
297
|
+
mlsurv was built in part with [Claude Code](https://claude.com/claude-code), Anthropic's agentic coding tool.
|
mlsurv-0.1.0/README.md
ADDED
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/goeckslab/mlsurv/main/docs/logo/mlsurv_icon.png" alt="mlsurv logo" width="120">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">mlsurv</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<em>Low-code machine learning package for survival analysis</em>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Intro to mlsurv
|
|
14
|
+
|
|
15
|
+
Survival analysis in clinical research typically requires stitching together various software tools for modeling, visualization, tuning, validation, and reporting. mlsurv unifies these processes into a single package: train, tune, and validate 10 survival models, generate publication-ready reports, and test on independent cohorts — all in under 10 lines of code.
|
|
16
|
+
|
|
17
|
+
<p align="center">
|
|
18
|
+
<img src="https://raw.githubusercontent.com/goeckslab/mlsurv/main/docs/overview.png" alt="mlsurv overview" width="600">
|
|
19
|
+
</p>
|
|
20
|
+
|
|
21
|
+
## Quick Start
|
|
22
|
+
|
|
23
|
+
```python
|
|
24
|
+
from mlsurv import SurvivalLearner
|
|
25
|
+
from mlsurv.utils import load_survival_data
|
|
26
|
+
|
|
27
|
+
# Load data (pandas DataFrame + structured array with 'event' and 'time' fields)
|
|
28
|
+
X, y = load_survival_data('data.csv', time_col='OS_MONTHS', event_col='OS_STATUS')
|
|
29
|
+
|
|
30
|
+
# Train, tune, evaluate, and bootstrap all models
|
|
31
|
+
learner = SurvivalLearner(X, y)
|
|
32
|
+
learner.setup(random_state=42)
|
|
33
|
+
learner.run()
|
|
34
|
+
|
|
35
|
+
# Generate a publication-ready interactive HTML report
|
|
36
|
+
learner.generate_report('report.html')
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
See [Vignette 01](https://github.com/goeckslab/mlsurv/blob/main/examples/vignette_01_quickstart.ipynb) for a complete walkthrough.
|
|
40
|
+
|
|
41
|
+
### Accessing results and saving your analysis
|
|
42
|
+
|
|
43
|
+
The learner stores every result internally, so you don't need to capture what
|
|
44
|
+
`run()` returns. Reach any result through these read-only accessors at any time,
|
|
45
|
+
including after a reload:
|
|
46
|
+
|
|
47
|
+
```python
|
|
48
|
+
result = learner.models['coxph'] # ModelResult: .evaluation, .bootstrap, .model, .coefficients
|
|
49
|
+
best = learner.best_model # winning ModelResult
|
|
50
|
+
eval_all = learner.evaluation_result # combined EvaluationResult (None before evaluate())
|
|
51
|
+
boot_all = learner.bootstrap_result # combined BootstrapResult (None before bootstrap())
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Export the result tables, or save and reload the whole session:
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
# Export all result tables to a single Excel workbook (or CSVs with format='csv')
|
|
58
|
+
learner.export_results('results.xlsx')
|
|
59
|
+
|
|
60
|
+
# Save the whole session and reload it later; results survive the round-trip
|
|
61
|
+
learner.save_learner('analysis.learner')
|
|
62
|
+
from mlsurv import load_learner
|
|
63
|
+
learner = load_learner('analysis.learner')
|
|
64
|
+
learner.models['coxph'] # still here after reload
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Command-Line Interface
|
|
68
|
+
|
|
69
|
+
mlsurv also provides a CLI for scripting, HPC pipelines, and quick one-off analyses:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
# Full pipeline in one command
|
|
73
|
+
mlsurv run data.csv --time-col OS_MONTHS --event-col OS_STATUS --output report.html
|
|
74
|
+
|
|
75
|
+
# List available models
|
|
76
|
+
mlsurv models
|
|
77
|
+
|
|
78
|
+
# Train and tune a specific model
|
|
79
|
+
mlsurv tune data.csv --time-col OS_MONTHS --event-col OS_STATUS --model rsf --n-trials 50
|
|
80
|
+
|
|
81
|
+
# Validate on an external cohort
|
|
82
|
+
mlsurv validate data.csv --time-col OS_MONTHS --event-col OS_STATUS \
|
|
83
|
+
--model coxph --validation-data external.csv \
|
|
84
|
+
--val-time-col OS_MONTHS --val-event-col OS_STATUS
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Run `mlsurv --help` for the full list of 26 subcommands, or see the
|
|
88
|
+
[CLI Guide](https://github.com/goeckslab/mlsurv/blob/main/docs/CLI.md) for detailed documentation and workflows.
|
|
89
|
+
|
|
90
|
+
## Data Format
|
|
91
|
+
|
|
92
|
+
mlsurv expects a feature matrix `X` (pandas DataFrame) and a structured survival array `y` with `event` (bool) and `time` (float) fields.
|
|
93
|
+
|
|
94
|
+
**From CSV** (recommended):
|
|
95
|
+
|
|
96
|
+
```python
|
|
97
|
+
from mlsurv.utils import load_survival_data
|
|
98
|
+
|
|
99
|
+
X, y = load_survival_data('data.csv', time_col='OS_MONTHS', event_col='OS_STATUS')
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
`load_survival_data` automatically drops the time/event columns from `X` and converts events to boolean and times to float, following scikit-survival conventions.
|
|
103
|
+
|
|
104
|
+
**From existing DataFrame**:
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
from mlsurv.utils import to_structured_array
|
|
108
|
+
|
|
109
|
+
y = to_structured_array(times=df['OS_MONTHS'], events=df['OS_STATUS'])
|
|
110
|
+
X = df.drop(columns=['OS_MONTHS', 'OS_STATUS'])
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**From date columns** (when your data has diagnosis/follow-up dates instead of pre-computed times):
|
|
114
|
+
|
|
115
|
+
```python
|
|
116
|
+
from mlsurv.utils import compute_survival_time
|
|
117
|
+
|
|
118
|
+
X, y = compute_survival_time(
|
|
119
|
+
df, start_col='diagnosis_date', end_col='last_followup_date',
|
|
120
|
+
event_col='vital_status', time_unit='months',
|
|
121
|
+
event_values=['deceased'],
|
|
122
|
+
)
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Missing values are handled automatically via median imputation during preprocessing (configurable via `setup(imputer=...)`).
|
|
126
|
+
|
|
127
|
+
## Installation
|
|
128
|
+
|
|
129
|
+
Install from PyPI:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
pip install mlsurv
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
With deep learning support (PyTorch, pycox) for DeepSurv / DeepHit:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
pip install "mlsurv[deep]"
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
**macOS note:** the XGBoost models (`xgbaft`, `xgbcox`) need the OpenMP runtime,
|
|
142
|
+
which macOS does not ship by default. If you see an error about `libomp.dylib`
|
|
143
|
+
failing to load, install it once with Homebrew:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
brew install libomp
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
To install the latest unreleased version from GitHub:
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
pip install git+https://github.com/goeckslab/mlsurv.git
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
For development:
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
git clone https://github.com/goeckslab/mlsurv.git
|
|
159
|
+
cd mlsurv
|
|
160
|
+
pip install -e ".[dev]"
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
See [CONTRIBUTING.md](https://github.com/goeckslab/mlsurv/blob/main/CONTRIBUTING.md) for the
|
|
164
|
+
architecture overview, coding rules, and test conventions.
|
|
165
|
+
|
|
166
|
+
## Features
|
|
167
|
+
|
|
168
|
+
- **Low-code interface**: `setup()` / `run()` / `predict()` / `generate_report()` for a full analysis in under 10 lines of code ([Architecture](https://github.com/goeckslab/mlsurv/blob/main/docs/architecture.md))
|
|
169
|
+
- **10 survival models** across 4 families (linear, ensemble, kernel, neural) with unified interface ([Models](https://github.com/goeckslab/mlsurv/blob/main/docs/architecture.md#model-inventory))
|
|
170
|
+
- **Configurable preprocessing**: Imputation, scaling, and 5 feature selectors with leak-free CV pipelines ([Pipeline](https://github.com/goeckslab/mlsurv/blob/main/docs/pipeline.md))
|
|
171
|
+
- **Automated checks**: EPV warnings, leakage detection, PH and linearity testing, model recommendations ([Pipeline](https://github.com/goeckslab/mlsurv/blob/main/docs/pipeline.md#automated-setup-checks))
|
|
172
|
+
- **Optuna tuning**: EPV-aware search spaces, auto-trial sizing, convergence detection, study persistence ([Evaluation](https://github.com/goeckslab/mlsurv/blob/main/docs/evaluation.md#hyperparameter-tuning))
|
|
173
|
+
- **Multi-metric evaluation**: Harrell/IPCW/Antolini C-index, Brier/IBS, AUC(t), calibration slope/intercept, GND test ([Metrics](https://github.com/goeckslab/mlsurv/blob/main/docs/evaluation.md#evaluation-metrics))
|
|
174
|
+
- **Multi-scale evaluation**: Subpopulation analysis, prospective patient prediction, and single-patient HTML reports with SHAP waterfall + cohort context ([Evaluation](https://github.com/goeckslab/mlsurv/blob/main/docs/evaluation.md)); feature importance, SHAP, interactions, and individual patient explanations ([Feature Analysis](https://github.com/goeckslab/mlsurv/blob/main/docs/feature-analysis.md))
|
|
175
|
+
- **External validation & benchmarking**: Independent cohort validation, delta-C/NRI/IDI incremental metrics ([Validation](https://github.com/goeckslab/mlsurv/blob/main/docs/validation.md))
|
|
176
|
+
- **S(t|x) calibration**: Opt-in per-model calibration via `train(calibrate=...)` (isotonic / lowdof / breslow_slope) fit on leakage-free OOF predictions and applied automatically across evaluate / predict / validate, with a calibration banner in reports ([Calibration](https://github.com/goeckslab/mlsurv/blob/main/docs/evaluation.md#stx-calibration))
|
|
177
|
+
- **Automated reporting**: 12-section interactive HTML report, 14 limitation flags, TRIPOD+AI compliance checklist ([Reporting](https://github.com/goeckslab/mlsurv/blob/main/docs/reporting.md))
|
|
178
|
+
- **Parallel computing**: One-line `n_jobs=-1` setup with smart auto-disable and no oversubscription
|
|
179
|
+
- **26 CLI subcommands** for scripting and HPC pipelines ([CLI Guide](https://github.com/goeckslab/mlsurv/blob/main/docs/CLI.md))
|
|
180
|
+
- **Reproducible by default**: Single `random_state` seeds all frameworks (scikit-learn, XGBoost, PyTorch). Bit-exact reproducibility requires `n_jobs=1`; see [Reproducibility](https://github.com/goeckslab/mlsurv/blob/main/docs/evaluation.md#reproducibility)
|
|
181
|
+
|
|
182
|
+
## Documentation
|
|
183
|
+
|
|
184
|
+
| Guide | Description |
|
|
185
|
+
|-------|-------------|
|
|
186
|
+
| [Architecture & Models](https://github.com/goeckslab/mlsurv/blob/main/docs/architecture.md) | Four-stage workflow, 10 survival models, complexity tiers, unified interface |
|
|
187
|
+
| [Pipeline Configuration](https://github.com/goeckslab/mlsurv/blob/main/docs/pipeline.md) | Data loading, `setup()`, cross-validation, preprocessing, automated checks |
|
|
188
|
+
| [Model Development & Evaluation](https://github.com/goeckslab/mlsurv/blob/main/docs/evaluation.md) | Training, tuning, metrics, bootstrap CIs, model comparison, subpopulation analysis, patient prediction |
|
|
189
|
+
| [Feature Analysis](https://github.com/goeckslab/mlsurv/blob/main/docs/feature-analysis.md) | Feature importance, SHAP, interactions, individual patient explanations |
|
|
190
|
+
| [Validation & Benchmarking](https://github.com/goeckslab/mlsurv/blob/main/docs/validation.md) | External cohort validation, incremental benchmarking metrics |
|
|
191
|
+
| [Reporting & Compliance](https://github.com/goeckslab/mlsurv/blob/main/docs/reporting.md) | Limitation flags, HTML reports, TRIPOD+AI checklist, data export |
|
|
192
|
+
| [CLI Guide](https://github.com/goeckslab/mlsurv/blob/main/docs/CLI.md) | 26 command-line subcommands for scripting and HPC |
|
|
193
|
+
| [Tutorial Vignettes](https://github.com/goeckslab/mlsurv/tree/main/examples) | 7 Jupyter notebooks from quickstart to immunotherapy case study |
|
|
194
|
+
|
|
195
|
+
## Supported Models
|
|
196
|
+
|
|
197
|
+
mlsurv includes 10 survival models across 4 categories:
|
|
198
|
+
|
|
199
|
+
**Linear/Parametric (3)**
|
|
200
|
+
| Model | Description |
|
|
201
|
+
|-------|-------------|
|
|
202
|
+
| CoxPH | Cox Proportional Hazards |
|
|
203
|
+
| CoxNet | Elastic Net penalized Cox |
|
|
204
|
+
| Weibull AFT | Parametric Weibull Accelerated Failure Time model |
|
|
205
|
+
|
|
206
|
+
**Tree-Based Ensemble (4)**
|
|
207
|
+
| Model | Description |
|
|
208
|
+
|-------|-------------|
|
|
209
|
+
| RSF | Random Survival Forest |
|
|
210
|
+
| GBSA | Gradient Boosting Survival Analysis |
|
|
211
|
+
| XGBoost-Cox | XGBoost with survival:cox objective |
|
|
212
|
+
| XGBoost AFT | XGBoost with Accelerated Failure Time objective |
|
|
213
|
+
|
|
214
|
+
**Support Vector Machine (1)**
|
|
215
|
+
| Model | Description |
|
|
216
|
+
|-------|-------------|
|
|
217
|
+
| FSSVM | Fast Survival SVM |
|
|
218
|
+
|
|
219
|
+
**Neural Networks (2)**
|
|
220
|
+
| Model | Description |
|
|
221
|
+
|-------|-------------|
|
|
222
|
+
| DeepSurv | Continuous-time Cox neural network |
|
|
223
|
+
| DeepHit | Discrete-time neural network (DeepHitSingle) |
|
|
224
|
+
|
|
225
|
+
> **Note**: All 10 models assume a single event type. See [Limitations](#limitations) for clinical implications.
|
|
226
|
+
|
|
227
|
+
## Limitations
|
|
228
|
+
|
|
229
|
+
- Single-event right-censored outcomes only (no competing risks, no time-varying covariates)
|
|
230
|
+
- See [Reporting & Compliance](https://github.com/goeckslab/mlsurv/blob/main/docs/reporting.md#limitation-flags) for the full list of 14 automatically detected limitation flags
|
|
231
|
+
|
|
232
|
+
## Citation
|
|
233
|
+
|
|
234
|
+
If you use mlsurv in published work, please cite:
|
|
235
|
+
|
|
236
|
+
> mlsurv: Low-code machine learning for survival analysis. Goecks Lab, Moffitt Cancer Center. https://github.com/goeckslab/mlsurv
|
|
237
|
+
|
|
238
|
+
## Changelog
|
|
239
|
+
|
|
240
|
+
See [CHANGELOG.md](https://github.com/goeckslab/mlsurv/blob/main/CHANGELOG.md) for the release history.
|
|
241
|
+
|
|
242
|
+
## License
|
|
243
|
+
|
|
244
|
+
MIT License - see [LICENSE](https://github.com/goeckslab/mlsurv/blob/main/LICENSE)
|
|
245
|
+
|
|
246
|
+
## Acknowledgments
|
|
247
|
+
|
|
248
|
+
mlsurv was built in part with [Claude Code](https://claude.com/claude-code), Anthropic's agentic coding tool.
|