BART-Survival
BART-Survival: A Bayesian machine learning approach to survival analyses in Python - Published in JOSS (2025)
Science Score: 93.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 4 DOI reference(s) in README and JOSS metadata -
✓Academic publication links
Links to: joss.theoj.org -
○Committers with academic emails
-
○Institutional organization owner
-
✓JOSS paper metadata
Published in Journal of Open Source Software
Keywords from Contributors
Scientific Fields
Repository
Basic Info
- Host: GitHub
- Owner: CDCgov
- License: apache-2.0
- Language: Jupyter Notebook
- Default Branch: main
- Size: 16.3 MB
Statistics
- Stars: 4
- Watchers: 3
- Forks: 3
- Open Issues: 5
- Releases: 1
Metadata Files
README.md
Overview
BART-Survival is a Python package that supports discrete-time Survival analyses using the non-parametric machine learning algorithm, Bayesian Additive Regression Trees (BART). BART-Survival combines the performance of the BART algorithm from the PyMC-BART library with the proper structural formatting required to complete the end-to-end Survival analysis.
BART-Survival's performance is comparative to other Survival regression methods, such as Cox Proportional Hazard and AFT models, in low-complexity settings and can outperform these other models in high-complexity settings were their respective assumptions may fail (i.e. proportional hazard assumption, linearity assumptions). Additionally, the Bayesian framework provides easily accessible uncertainty intervals and capabilities to extensively interrogate trained model.
The BART-Survival library provides a simple API for completing standard Survival analysis, as well as allowing exposure to the underlying PyMC code providing accessibility to extend the BART-Survival library when necessary.
This repository contains the source code and documentation for the BART-Survival package as well as example notebooks.
BART-Survival can be installed directly from PyPi
python
pip install `BART-Survival`==0.1.1
Or as accessed from this repository.
API
Demonstration
Brief demo of the basic steps.
```python from lifelines.datasets import loadrossi from bartsurvival import surv_bart as sb import numpy as np
Load rossi dataset from lifelines
rossi = loadrossi() names = rossi.columns.tonumpy() rossi = rossi.to_numpy()
Transform data into 'augmented' dataset
Requires creation of the training dataset and a predictive dataset for inference
trn = sb.getsurvpretrain( ytime=rossi[:,0], ystatus=rossi[:,1], x = rossi[:,2:], timescale=7 )
posttest = sb.getposteriortest( ytime=rossi[:,0], ystatus=rossi[:,1], x = rossi[:,2:], timescale=7 )
Instantiate the BART models
model_dict is defines specific model parameters
modeldict = {"trees": 50, "splitrules": [ "pmb.ContinuousSplitRule()", # time "pmb.OneHotSplitRule()", # fin "pmb.ContinuousSplitRule()", # age "pmb.OneHotSplitRule()", # race "pmb.OneHotSplitRule()", # wexp "pmb.OneHotSplitRule()", # mar "pmb.OneHotSplitRule()", # paro "pmb.ContinuousSplitRule()", # prio ] }
sampler_dict defines specific sampling parameters
samplerdict = { "draws": 200, "tune": 200, "cores": 8, "chains": 8, "computeconvergencechecks": False } BSM = sb.BartSurvModel(modelconfig=modeldict, samplerconfig=sampler_dict)
Fit Model
BSM.fit( y = trn["y"], X = trn["x"], weights=trn["w"], coords = trn["coord"], random_seed=5 )
Get posterior predictive for evaluation.
post1 = BSM.sampleposteriorpredictive(Xpred=posttest["postx"], coords=posttest["coords"])
Convert to SV probability.
svprob = sb.getsv_prob(post1)
```
Validation study links
In progress...
CDCgov General Disclaimers
This repository was created for use by CDC programs to collaborate on public health related projects in support of the CDC mission. GitHub is not hosted by the CDC, but is a third party website used by CDC and its partners to share information and collaborate on software. CDC use of GitHub does not imply an endorsement of any one particular service, product, or enterprise.
Related Documents
Public Domain Standard Notice
This repository constitutes a work of the United States Government and is not subject to domestic copyright protection under 17 USC § 105. This repository is in the public domain within the United States, and copyright and related rights in the work worldwide are waived through the CC0 1.0 Universal public domain dedication. All contributions to this repository will be released under the CC0 dedication. By submitting a pull request you are agreeing to comply with this waiver of copyright interest.
License Standard Notice
The repository utilizes code licensed under the terms of the Apache Software License and therefore is licensed under ASL v2 or later.
This source code in this repository is free: you can redistribute it and/or modify it under the terms of the Apache Software License version 2, or (at your option) any later version.
This source code in this repository is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache Software License for more details.
You should have received a copy of the Apache Software License along with this program. If not, see http://www.apache.org/licenses/LICENSE-2.0.html
The source code forked from other open source projects will inherit its license.
Privacy Standard Notice
This repository contains only non-sensitive, publicly available data and information. All material and community participation is covered by the Disclaimer and Code of Conduct. For more information about CDC's privacy policy, please visit http://www.cdc.gov/other/privacy.html.
Contributing Standard Notice
Anyone is encouraged to contribute to the repository by forking and submitting a pull request. (If you are new to GitHub, you might start with a basic tutorial.) By contributing to this project, you grant a world-wide, royalty-free, perpetual, irrevocable, non-exclusive, transferable license to all users under the terms of the Apache Software License v2 or later.
All comments, messages, pull requests, and other submissions received through CDC including this GitHub page may be subject to applicable federal law, including but not limited to the Federal Records Act, and may be archived. Learn more at http://www.cdc.gov/other/privacy.html.
Records Management Standard Notice
This repository is not a source of government records, but is a copy to increase collaboration and collaborative potential. All government records will be published through the CDC web site.
Additional Standard Notices
Please refer to CDC's Template Repository for more information about contributing to this repository, public domain notices and disclaimers, and code of conduct.
Owner
- Name: Centers for Disease Control and Prevention
- Login: CDCgov
- Kind: organization
- Email: data@cdc.gov
- Location: Atlanta, GA
- Website: http://open.cdc.gov/
- Twitter: CDCgov
- Repositories: 114
- Profile: https://github.com/CDCgov
CDC's collaborative software projects to protect America from health, safety, and security threats, both foreign and in the U.S.
JOSS Publication
BART-Survival: A Bayesian machine learning approach to survival analyses in Python
Authors
Inform and Disseminate Division, Office of Public Health Data, Surveillance, and Technology, Centers for Disease Control and Prevention, Atlanta, Georgia, United States of America, Metas Solutions, Atlanta, Georgia, United States of America
Tags
Bayesian Machine Learning Survival Time to EventGitHub Events
Total
- Release event: 2
- Watch event: 2
- Push event: 11
- Fork event: 2
- Create event: 1
Last Year
- Release event: 2
- Watch event: 2
- Push event: 11
- Fork event: 2
- Create event: 1
Committers
Last synced: 5 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| twj8CDC | t****8@c****v | 122 |
| dependabot[bot] | 4****] | 8 |
| Boris Ning | 4****s | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 4 months ago
All Time
- Total issues: 0
- Total pull requests: 14
- Average time to close issues: N/A
- Average time to close pull requests: about 20 hours
- Total issue authors: 0
- Total pull request authors: 2
- Average comments per issue: 0
- Average comments per pull request: 0.07
- Merged pull requests: 8
- Bot issues: 0
- Bot pull requests: 13
Past Year
- Issues: 0
- Pull requests: 3
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 0.0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 3
Top Authors
Issue Authors
Pull Request Authors
- dependabot[bot] (23)
- twj8CDC (2)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 197 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 5
- Total maintainers: 1
pypi.org: bart-survival
Survival analyses with Bayesian Additivie Regression Trees using PyMC-BART as BART backend.
- Homepage: https://github.com/CDCgov/BART-Survival
- Documentation: https://bart-survival.readthedocs.io/
- License: apache-2.0
-
Latest release: 0.1.1
published over 1 year ago
Rankings
Maintainers (1)
Dependencies
- actions/checkout v4 composite
- actions/upload-artifact v4 composite
- openjournals/openjournals-draft-action master composite
- cloudpickle *
- numpy *
- pymc python_version<="5.10.3"
- pymc-bart *
- scipy *
- Babel ==2.14.0
- Jinja2 ==3.1.4
- MarkupSafe ==2.1.4
- PyYAML ==6.0.1
- Pygments ==2.17.2
- QtPy ==2.4.1
- SecretStorage ==3.3.3
- Send2Trash ==1.8.2
- Sphinx ==7.2.6
- alabaster ==0.7.16
- anyio ==4.2.0
- argon2-cffi ==23.1.0
- argon2-cffi-bindings ==21.2.0
- arrow ==1.3.0
- arviz ==0.17.0
- asttokens ==2.4.1
- async-lru ==2.0.4
- attrs ==23.2.0
- autograd ==1.6.2
- autograd-gamma ==0.5.0
- beautifulsoup4 ==4.12.3
- bleach ==6.1.0
- build ==1.0.3
- cachetools ==5.3.2
- certifi ==2023.11.17
- cffi ==1.16.0
- charset-normalizer ==3.3.2
- cloudpickle ==3.0.0
- comm ==0.2.1
- cons ==0.4.6
- contourpy ==1.2.0
- cryptography ==42.0.4
- cycler ==0.12.1
- debugpy ==1.8.0
- decorator ==5.1.1
- defusedxml ==0.7.1
- docopt ==0.6.2
- docutils ==0.20.1
- dotmap ==1.1.16
- ecos ==2.0.12
- etuples ==0.3.9
- exceptiongroup ==1.2.0
- executing ==2.0.1
- fastjsonschema ==2.19.1
- fastprogress ==1.0.3
- filelock ==2.0.6
- fonttools ==4.47.2
- formulaic ==1.0.1
- fqdn ==1.5.1
- future ==0.18.3
- h5netcdf ==1.3.0
- h5py ==3.10.0
- idna ==3.7
- imagesize ==1.4.1
- importlib-metadata ==7.0.1
- iniconfig ==2.0.0
- interface-meta ==1.3.0
- ipykernel ==6.29.0
- ipython ==8.21.0
- ipywidgets ==8.1.2
- isoduration ==20.11.0
- jaraco.classes ==3.3.0
- jedi ==0.19.1
- jeepney ==0.8.0
- joblib ==1.3.2
- json5 ==0.9.14
- jsonpointer ==2.4
- jsonschema ==4.21.1
- jsonschema-specifications ==2023.12.1
- jupyter ==1.0.0
- jupyter-console ==6.6.3
- jupyter-events ==0.9.0
- jupyter-lsp ==2.2.2
- jupyter_client ==8.6.0
- jupyter_core ==5.7.1
- jupyter_server ==2.12.5
- jupyter_server_terminals ==0.5.2
- jupyterlab ==4.0.12
- jupyterlab_pygments ==0.3.0
- jupyterlab_server ==2.25.2
- jupyterlab_widgets ==3.0.10
- keyring ==24.3.0
- kiwisolver ==1.4.5
- lifelines ==0.28.0
- llvmlite ==0.41.1
- logical-unification ==0.4.6
- markdown-it-py ==3.0.0
- matplotlib ==3.8.2
- matplotlib-inline ==0.1.6
- mdurl ==0.1.2
- miniKanren ==1.0.3
- mistune ==3.0.2
- more-itertools ==10.2.0
- multipledispatch ==1.0.0
- nbclient ==0.9.0
- nbconvert ==7.15.0
- nbformat ==5.9.2
- nbsphinx ==0.9.3
- nest-asyncio ==1.6.0
- nh3 ==0.2.15
- notebook ==7.0.8
- notebook_shim ==0.2.3
- numba ==0.58.1
- numexpr ==2.9.0
- numpy ==1.24.4
- osqp ==0.6.3
- overrides ==7.7.0
- packaging ==23.2
- pandas ==2.2.0
- pandocfilters ==1.5.1
- parso ==0.8.3
- pathlib ==1.0.1
- pexpect ==4.9.0
- pillow ==10.3.0
- pipelines ==0.0.14
- pkginfo ==1.9.6
- platformdirs ==4.2.0
- pluggy ==1.4.0
- prometheus-client ==0.19.0
- prompt-toolkit ==3.0.43
- psutil ==5.9.8
- ptyprocess ==0.7.0
- pure-eval ==0.2.2
- pycparser ==2.21
- pymc ==5.10.3
- pymc-experimental ==0.0.16
- pymc_bart ==0.5.7
- pyparsing ==3.1.1
- pyproject_hooks ==1.0.0
- pytensor ==2.18.6
- pytest ==8.0.0
- python-dateutil ==2.8.2
- python-json-logger ==2.0.7
- pytz ==2023.4
- pyzmq ==25.1.2
- qdldl ==0.1.7.post0
- qtconsole ==5.5.1
- readme-renderer ==42.0
- referencing ==0.33.0
- requests ==2.32.2
- requests-toolbelt ==1.0.0
- rfc3339-validator ==0.1.4
- rfc3986 ==2.0.0
- rfc3986-validator ==0.1.1
- rich ==13.7.0
- rpds-py ==0.17.1
- schema ==0.5.0
- scikit-learn ==1.5.0
- scikit-survival ==0.22.2
- scipy ==1.12.0
- sh ==1.11
- six ==1.16.0
- sniffio ==1.3.0
- snowballstemmer ==2.2.0
- soupsieve ==2.5
- sphinxcontrib-applehelp ==1.0.8
- sphinxcontrib-devhelp ==1.0.6
- sphinxcontrib-htmlhelp ==2.0.5
- sphinxcontrib-jsmath ==1.0.1
- sphinxcontrib-qthelp ==1.0.7
- sphinxcontrib-serializinghtml ==1.1.10
- stack-data ==0.6.3
- terminado ==0.18.0
- threadpoolctl ==3.2.0
- tinycss2 ==1.2.1
- tomli ==2.0.1
- toolz ==0.12.1
- tornado ==6.4.1
- traitlets ==5.14.1
- twine ==4.0.2
- types-python-dateutil ==2.8.19.20240106
- typing ==3.7.4.3
- typing_extensions ==4.9.0
- tzdata ==2023.4
- uri-template ==1.3.0
- urllib3 ==2.2.2
- wcwidth ==0.2.13
- webcolors ==1.13
- webencodings ==0.5.1
- websocket-client ==1.7.0
- widgetsnbextension ==4.0.10
- wrapt ==1.16.0
- xarray ==2024.1.1
- xarray-einstats ==0.7.0
- zipp ==3.17.0