Bayesian Event-Based Model for Disease Subtype and Stage Inference
Project description
pysubebm
Installation
pip install bebms=
or git clone this project, and then
pip install -e .
Generate synthetic data
Git clone this repository, and at the root, run
bash gen.sh
The generated data will be found at [bebms/test/my_data](bebms/test/my_data/) as .csv files.
The parameters are pre-set and can be found at [bebms/data/params.json](bebms/data/params.json). You can modify the parameters by modifying the json file.
You can also change parameters in config.toml to adjust what data to generate.
Run bebms algorithm
To run bebms, after git cloning this repository, at the root, run
bash test.sh
You can check [bebms/test/test.py](bebms/test/test.py) to learn how to use the [run_bebms](bebms/run.py) function.
The results will be saved in the folder of [bebms/test/algo_results](bebms/test/algo_results/).
Compare with SuStaIn
You can also compare the results of bebms with those of SuStaIn.
First, you need to install packages required by SuSta
pip install git+https://github.com/noxtoby/awkde
pip install git+https://github.com/hongtaoh/ucl_kde_ebm
pip install git+https://github.com/hongtaoh/pySuStaIn
Then, at the root of this repository, run
bash test_sustain.sh
You can check details at [bebms/test/test_sustain.py](bebms/test/test_sustain.py).
The results will be saved in the folder of [bebms/test/sustain_results](bebms/test/sustain_results/).
Save comparison results
You can save the results of bebms along with those of SuStaIn by running at the root:
python3 save_csv.py
The results will be found at the root as all_results.csv.
Use your own data
You can use your own data. But make sure that your data follows the format as in data in [bebms/data/samples](bebms/data/samples/).
Changelogs
- 2025-08-21 (V 0.0.3)
- Did the
generate_data.py.
- Did the
- 2025-08-22 (V 0.0.5)
- Did the
mh.py - Correct conjugate_priors implementation.
- Did the
- 2025-08-23 (V 0.1.2)
- Improved functions in
utils.py.
- Improved functions in
- 2025-08-29 (V 0.1.3)
- Didn't change much.
- 2025-08-30 (V 0.1.8)
- Optimized
compute_likelihood_and_posteriorssuch that we only calculate healthy participants' ln likelihood once every time. - Made sure subtype assignment accuracy does not apply to healthy participants at all.
- Fixed a major bug in data generation. The very low subtype assignment might be due to this error.
- Included both subtype accuracy in
run.py.
- Optimized
- 2025-08-31 (V 0.2.5)
- Resacle event times and disease stages for exp7-9 such that max(event_times) = max_stage -1, and max(disease_stages) = max_stage.
- Changed the experiments and some of the implementation.
- Forcing
max(event_times) = max_stage -1, but not forcing disease stages.
- 2025-09-01 (V 0.2.9)
- REMOVED THE Forcing
max(event_times) = max_stage -1 - Modified the
run.py.
- REMOVED THE Forcing
- 2025-09-02 (V 0.3.3.1)
- Redid the staging and subtyping.
- Integrated with labels and not.
- 2025-09-04 (V 0.3.3.2)
- Made sure in staging with labels, the new_order indices starts from 1 instead of 0. This is because participant stages now start from 0.
- 2025-09-06 (V 0.3.5.6)
- Added the plot function back.
- 2025-09-08 (V 0.3.5.8)
- Added
ml_subtypein output results. - Added all_logs to the output returned in
run.py.
- Added
- 2025-09-21 (V 0.3.9)
- Removed
iteration >= burn_inwhen updating best_*.
- Removed
- 2025-11-03 (V 0.4.1)
- Changed the package name to
bebms. - Edited README.
- Changed the package name to
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bebms-0.4.1.tar.gz.
File metadata
- Download URL: bebms-0.4.1.tar.gz
- Upload date:
- Size: 86.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.8.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
81fb702cbe14d54069dc2b7412c820643a995b847154dba6ff30a1d2bea3d1b4
|
|
| MD5 |
29d60806e2fafb04f9d3c994bd19c83d
|
|
| BLAKE2b-256 |
0e1526de98ac1f8d8bfd05bd55be79df9c8330a8d3a0c5bfe32e4e1f1befa3d4
|
File details
Details for the file bebms-0.4.1-py3-none-any.whl.
File metadata
- Download URL: bebms-0.4.1-py3-none-any.whl
- Upload date:
- Size: 126.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.8.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f4f363aba92544a7bb48600ea83b8138aa797e5f909319dd16f3521bead5951b
|
|
| MD5 |
051dcf05ba14343e17451895869523a0
|
|
| BLAKE2b-256 |
5651d4fa3c2a9ed93687ea596a78ed31ab4fa799304e986820c326a938ce4c13
|