bella-companion 0.0.46__tar.gz → 0.0.48__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.
Potentially problematic release.
This version of bella-companion might be problematic. Click here for more details.
- {bella_companion-0.0.46 → bella_companion-0.0.48}/PKG-INFO +2 -2
- bella_companion-0.0.48/bella_companion/__pycache__/cli.cpython-310.pyc +0 -0
- bella_companion-0.0.48/bella_companion/__pycache__/features.cpython-310.pyc +0 -0
- bella_companion-0.0.48/bella_companion/eucovid/__pycache__/run_beast.cpython-310.pyc +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/eucovid/beast_configs/GLM.xml +1 -1
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/eucovid/beast_configs/MLP.xml +1 -1
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/eucovid/run_beast.py +22 -10
- bella_companion-0.0.48/bella_companion/features.py +13 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/platyrrhine/__pycache__/run_beast.cpython-310.pyc +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/__pycache__/run_beast.cpython-310.pyc +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/figures/__pycache__/epi_multitype.cpython-310.pyc +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/figures/__pycache__/fbd_2traits.cpython-310.pyc +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/figures/epi_multitype.py +4 -4
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/figures/fbd_2traits.py +4 -4
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/scenarios/__pycache__/epi_multitype.cpython-310.pyc +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/scenarios/__pycache__/epi_skyline.cpython-310.pyc +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/scenarios/__pycache__/fbd_2traits.cpython-310.pyc +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/scenarios/__pycache__/fbd_no_traits.cpython-310.pyc +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/scenarios/__pycache__/scenario.cpython-310.pyc +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/scenarios/epi_multitype.py +1 -1
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/scenarios/epi_skyline.py +1 -1
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/scenarios/fbd_2traits.py +1 -1
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/scenarios/fbd_no_traits.py +1 -1
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/scenarios/scenario.py +1 -1
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/utils/__init__.py +4 -4
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/utils/__pycache__/__init__.cpython-310.pyc +0 -0
- bella_companion-0.0.48/bella_companion/utils/explain/__init__.py +7 -0
- bella_companion-0.0.48/bella_companion/utils/explain/__pycache__/__init__.cpython-310.pyc +0 -0
- bella_companion-0.0.48/bella_companion/utils/explain/__pycache__/pdp.cpython-310.pyc +0 -0
- bella_companion-0.0.48/bella_companion/utils/explain/__pycache__/shap.cpython-310.pyc +0 -0
- bella_companion-0.0.48/bella_companion/utils/explain/__pycache__/typeguards.cpython-310.pyc +0 -0
- {bella_companion-0.0.46/bella_companion/simulations/figures → bella_companion-0.0.48/bella_companion/utils}/explain/pdp.py +49 -13
- bella_companion-0.0.48/bella_companion/utils/explain/shap.py +102 -0
- bella_companion-0.0.48/bella_companion/utils/explain/typeguards.py +20 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion.egg-info/PKG-INFO +2 -2
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion.egg-info/SOURCES.txt +26 -24
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion.egg-info/requires.txt +1 -1
- {bella_companion-0.0.46 → bella_companion-0.0.48}/pyproject.toml +2 -4
- bella_companion-0.0.46/bella_companion/__pycache__/cli.cpython-310.pyc +0 -0
- bella_companion-0.0.46/bella_companion/eucovid/__pycache__/run_beast.cpython-310.pyc +0 -0
- bella_companion-0.0.46/bella_companion/simulations/features.py +0 -7
- bella_companion-0.0.46/bella_companion/simulations/figures/explain/__init__.py +0 -6
- bella_companion-0.0.46/bella_companion/simulations/figures/explain/__pycache__/__init__.cpython-310.pyc +0 -0
- bella_companion-0.0.46/bella_companion/simulations/figures/explain/__pycache__/pdp.cpython-310.pyc +0 -0
- bella_companion-0.0.46/bella_companion/simulations/figures/explain/__pycache__/shap.cpython-310.pyc +0 -0
- bella_companion-0.0.46/bella_companion/simulations/figures/explain/shap.py +0 -62
- bella_companion-0.0.46/bella_companion/utils/explain.py +0 -45
- {bella_companion-0.0.46 → bella_companion-0.0.48}/README.md +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/BELLA.jar +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/__init__.py +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/__pycache__/__init__.cpython-310.pyc +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/cli.py +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/eucovid/__init__.py +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/eucovid/__pycache__/__init__.cpython-310.pyc +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/eucovid/beast_configs/Nonparametric.xml +0 -0
- /bella_companion-0.0.46/bella_companion/eucovid/data/case_data.tsv → /bella_companion-0.0.48/bella_companion/eucovid/data/case_data.csv +0 -0
- /bella_companion-0.0.46/bella_companion/eucovid/data/change_dates.tsv → /bella_companion-0.0.48/bella_companion/eucovid/data/change_dates.csv +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/eucovid/data/msa.fasta +0 -0
- /bella_companion-0.0.46/bella_companion/eucovid/data/osi.tsv → /bella_companion-0.0.48/bella_companion/eucovid/data/osi.csv +0 -0
- /bella_companion-0.0.46/bella_companion/eucovid/data/predictors/all/closedborders_7e_nt.tsv → /bella_companion-0.0.48/bella_companion/eucovid/data/predictors/all/closedborders_7e_nt.csv +0 -0
- /bella_companion-0.0.46/bella_companion/eucovid/data/predictors/all/dist_7e_ls.tsv → /bella_companion-0.0.48/bella_companion/eucovid/data/predictors/all/dist_7e_ls.csv +0 -0
- /bella_companion-0.0.46/bella_companion/eucovid/data/predictors/all/flight_7e_ls.tsv → /bella_companion-0.0.48/bella_companion/eucovid/data/predictors/all/flight_7e_ls.csv +0 -0
- /bella_companion-0.0.46/bella_companion/eucovid/data/predictors/all/flight_pop_x_7e_ls.tsv → /bella_companion-0.0.48/bella_companion/eucovid/data/predictors/all/flight_pop_x_7e_ls.csv +0 -0
- /bella_companion-0.0.46/bella_companion/eucovid/data/predictors/all/osi_x_7e_ls.tsv → /bella_companion-0.0.48/bella_companion/eucovid/data/predictors/all/osi_x_7e_ls.csv +0 -0
- /bella_companion-0.0.46/bella_companion/eucovid/data/predictors/all/osi_y_7e_ls.tsv → /bella_companion-0.0.48/bella_companion/eucovid/data/predictors/all/osi_y_7e_ls.csv +0 -0
- /bella_companion-0.0.46/bella_companion/eucovid/data/predictors/all/pop_x_7e_ls.tsv → /bella_companion-0.0.48/bella_companion/eucovid/data/predictors/all/pop_x_7e_ls.csv +0 -0
- /bella_companion-0.0.46/bella_companion/eucovid/data/predictors/all/pop_y_7e_ls.tsv → /bella_companion-0.0.48/bella_companion/eucovid/data/predictors/all/pop_y_7e_ls.csv +0 -0
- /bella_companion-0.0.46/bella_companion/eucovid/data/predictors/all/sharedborders_7e_nt.tsv → /bella_companion-0.0.48/bella_companion/eucovid/data/predictors/all/sharedborders_7e_nt.csv +0 -0
- /bella_companion-0.0.46/bella_companion/eucovid/data/predictors/changetimes_all_7e.tsv → /bella_companion-0.0.48/bella_companion/eucovid/data/predictors/changetimes_all_7e.csv +0 -0
- /bella_companion-0.0.46/bella_companion/eucovid/data/predictors/changetimes_flights_4e.tsv → /bella_companion-0.0.48/bella_companion/eucovid/data/predictors/changetimes_flights_4e.csv +0 -0
- /bella_companion-0.0.46/bella_companion/eucovid/data/predictors/flight_pop_x_4e_ls.tsv → /bella_companion-0.0.48/bella_companion/eucovid/data/predictors/flight_pop_x_4e_ls.csv +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/platyrrhine/__init__.py +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/platyrrhine/__pycache__/__init__.cpython-310.pyc +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/platyrrhine/__pycache__/results.cpython-310.pyc +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/platyrrhine/__pycache__/summarize.cpython-310.pyc +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/platyrrhine/__pycache__/summarize_logs.cpython-310.pyc +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/platyrrhine/beast_config.xml +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/platyrrhine/data/change_times.csv +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/platyrrhine/data/traits.csv +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/platyrrhine/data/trees.nwk +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/platyrrhine/results.py +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/platyrrhine/run_beast.py +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/platyrrhine/summarize.py +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/__init__.py +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/__pycache__/__init__.cpython-310.pyc +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/__pycache__/features.cpython-310.pyc +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/__pycache__/generate_data.cpython-310.pyc +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/__pycache__/generate_figures.cpython-310.pyc +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/__pycache__/metrics.cpython-310.pyc +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/__pycache__/summarize.cpython-310.pyc +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/__pycache__/summarize_logs.cpython-310.pyc +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/beast_configs/epi-multitype/GLM.xml +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/beast_configs/epi-multitype/MLP.xml +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/beast_configs/epi-multitype/Nonparametric.xml +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/beast_configs/epi-skyline/GLM.xml +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/beast_configs/epi-skyline/MLP.xml +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/beast_configs/epi-skyline/Nonparametric.xml +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/beast_configs/fbd-2traits/GLM.xml +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/beast_configs/fbd-2traits/MLP.xml +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/beast_configs/fbd-2traits/Nonparametric.xml +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/beast_configs/fbd-no-traits/GLM.xml +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/beast_configs/fbd-no-traits/MLP.xml +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/beast_configs/fbd-no-traits/Nonparametric.xml +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/figures/__init__.py +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/figures/__pycache__/__init__.cpython-310.pyc +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/figures/__pycache__/epi_skyline.cpython-310.pyc +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/figures/__pycache__/fbd_no_traits.cpython-310.pyc +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/figures/__pycache__/scenarios.cpython-310.pyc +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/figures/__pycache__/utils.cpython-310.pyc +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/figures/epi_skyline.py +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/figures/fbd_no_traits.py +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/figures/scenarios.py +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/figures/utils.py +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/generate_data.py +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/generate_figures.py +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/metrics.py +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/run_beast.py +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/scenarios/__init__.py +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/scenarios/__pycache__/__init__.cpython-310.pyc +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/scenarios/__pycache__/common.cpython-310.pyc +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/scenarios/common.py +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/summarize.py +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/utils/__pycache__/beast.cpython-310.pyc +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/utils/__pycache__/explain.cpython-310.pyc +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/utils/__pycache__/slurm.cpython-310.pyc +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/utils/beast.py +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/utils/slurm.py +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/version.xml +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion.egg-info/dependency_links.txt +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion.egg-info/entry_points.txt +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion.egg-info/top_level.txt +0 -0
- {bella_companion-0.0.46 → bella_companion-0.0.48}/setup.cfg +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bella-companion
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.48
|
|
4
4
|
Summary: Bayesian Evolutionary Layered Learning Architectures (BELLA) companion
|
|
5
5
|
Requires-Python: >=3.10
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
7
7
|
Requires-Dist: arviz>=0.22.0
|
|
8
|
-
Requires-Dist: bella-lumiere>=0.0.
|
|
8
|
+
Requires-Dist: bella-lumiere>=0.0.19
|
|
9
9
|
Requires-Dist: dotenv>=0.9.9
|
|
10
10
|
Requires-Dist: phylogenie>=3.1.4
|
|
11
11
|
Requires-Dist: poetry>=2.2.1
|
|
Binary file
|
|
Binary file
|
{bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/eucovid/beast_configs/GLM.xml
RENAMED
|
@@ -143,7 +143,7 @@
|
|
|
143
143
|
<operator spec="BactrianScaleOperator" parameter="@gammaShape" weight="1.0"/>
|
|
144
144
|
<operator spec="BactrianScaleOperator" parameter="@kappa" weight="1.0"/>
|
|
145
145
|
|
|
146
|
-
<logger spec="Logger" fileName="MCMC.log" logEvery="1000" model="@posterior"
|
|
146
|
+
<logger spec="Logger" fileName="MCMC.log" logEvery="1000" model="@posterior">
|
|
147
147
|
<log idref="posterior"/>
|
|
148
148
|
<log idref="likelihood"/>
|
|
149
149
|
<log idref="prior"/>
|
{bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/eucovid/beast_configs/MLP.xml
RENAMED
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
<operator spec="BactrianScaleOperator" parameter="@gammaShape" weight="1.0"/>
|
|
145
145
|
<operator spec="BactrianScaleOperator" parameter="@kappa" weight="1.0"/>
|
|
146
146
|
|
|
147
|
-
<logger spec="Logger" fileName="MCMC.log" logEvery="1000" model="@posterior"
|
|
147
|
+
<logger spec="Logger" fileName="MCMC.log" logEvery="1000" model="@posterior">
|
|
148
148
|
<log idref="posterior"/>
|
|
149
149
|
<log idref="likelihood"/>
|
|
150
150
|
<log idref="prior"/>
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import os
|
|
2
|
-
from glob import glob
|
|
3
2
|
from pathlib import Path
|
|
4
3
|
|
|
5
4
|
from bella_companion.utils import submit_job
|
|
@@ -17,19 +16,32 @@ def run_beast():
|
|
|
17
16
|
msa_file = data_dir / "msa.fasta"
|
|
18
17
|
|
|
19
18
|
predictors_dir = data_dir / "predictors"
|
|
20
|
-
all_predictor_files =
|
|
19
|
+
all_predictor_files = [
|
|
20
|
+
"dist_7e_ls",
|
|
21
|
+
"osi_x_7e_ls",
|
|
22
|
+
"osi_y_7e_ls",
|
|
23
|
+
"pop_y_7e_ls",
|
|
24
|
+
"closedborders_7e_nt",
|
|
25
|
+
"sharedborders_7e_nt",
|
|
26
|
+
"pop_x_7e_ls",
|
|
27
|
+
"flight_7e_ls",
|
|
28
|
+
"flight_pop_x_7e_ls",
|
|
29
|
+
]
|
|
30
|
+
all_predictor_files = ",".join(
|
|
31
|
+
[str(predictors_dir / "all" / f"{file}.csv") for file in all_predictor_files]
|
|
32
|
+
)
|
|
21
33
|
all_predictors_data = " ".join(
|
|
22
34
|
[
|
|
23
35
|
f"-D msa_file={msa_file}",
|
|
24
|
-
f"-D changeTimesFile={predictors_dir / 'changetimes_all_7e.
|
|
36
|
+
f"-D changeTimesFile={predictors_dir / 'changetimes_all_7e.csv'}",
|
|
25
37
|
f"-D predictorFiles={all_predictor_files}",
|
|
26
38
|
]
|
|
27
39
|
)
|
|
28
40
|
flight_predictor_data = " ".join(
|
|
29
41
|
[
|
|
30
42
|
f"-D msa_file={msa_file}",
|
|
31
|
-
f"-D changeTimesFile={predictors_dir / 'changetimes_flights_4e.
|
|
32
|
-
f"-D predictorFiles={predictors_dir / 'flight_pop_x_4e_ls.
|
|
43
|
+
f"-D changeTimesFile={predictors_dir / 'changetimes_flights_4e.csv'}",
|
|
44
|
+
f"-D predictorFiles={predictors_dir / 'flight_pop_x_4e_ls.csv'}",
|
|
33
45
|
]
|
|
34
46
|
)
|
|
35
47
|
|
|
@@ -52,7 +64,6 @@ def run_beast():
|
|
|
52
64
|
mem_per_cpu=12000,
|
|
53
65
|
)
|
|
54
66
|
"""
|
|
55
|
-
|
|
56
67
|
os.makedirs(output_dir / "all-predictors-GLM", exist_ok=True)
|
|
57
68
|
submit_job(
|
|
58
69
|
" ".join(
|
|
@@ -63,7 +74,7 @@ def run_beast():
|
|
|
63
74
|
str(beast_configs_dir / "GLM.xml"),
|
|
64
75
|
]
|
|
65
76
|
),
|
|
66
|
-
base_log_dir / "
|
|
77
|
+
base_log_dir / "all-predictors-GLM" / str(seed),
|
|
67
78
|
cpus=128,
|
|
68
79
|
mem_per_cpu=12000,
|
|
69
80
|
)
|
|
@@ -78,7 +89,7 @@ def run_beast():
|
|
|
78
89
|
str(beast_configs_dir / "GLM.xml"),
|
|
79
90
|
]
|
|
80
91
|
),
|
|
81
|
-
base_log_dir / "
|
|
92
|
+
base_log_dir / "flights-GLM" / str(seed),
|
|
82
93
|
cpus=128,
|
|
83
94
|
mem_per_cpu=12000,
|
|
84
95
|
)
|
|
@@ -95,10 +106,11 @@ def run_beast():
|
|
|
95
106
|
str(beast_configs_dir / "MLP.xml"),
|
|
96
107
|
]
|
|
97
108
|
),
|
|
98
|
-
base_log_dir / "
|
|
109
|
+
base_log_dir / "all-predictors-MLP" / str(seed),
|
|
99
110
|
cpus=128,
|
|
100
111
|
mem_per_cpu=12000,
|
|
101
112
|
)
|
|
113
|
+
|
|
102
114
|
"""
|
|
103
115
|
os.makedirs(output_dir / "flights-MLP", exist_ok=True)
|
|
104
116
|
submit_job(
|
|
@@ -111,7 +123,7 @@ def run_beast():
|
|
|
111
123
|
str(beast_configs_dir / "MLP.xml"),
|
|
112
124
|
]
|
|
113
125
|
),
|
|
114
|
-
base_log_dir / "
|
|
126
|
+
base_log_dir / "flights-MLP" / str(seed),
|
|
115
127
|
cpus=128,
|
|
116
128
|
mem_per_cpu=12000,
|
|
117
129
|
)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
@dataclass
|
|
5
|
+
class Feature:
|
|
6
|
+
is_binary: bool
|
|
7
|
+
is_relevant: bool | None = None
|
|
8
|
+
|
|
9
|
+
@property
|
|
10
|
+
def color(self) -> str:
|
|
11
|
+
if self.is_relevant is None:
|
|
12
|
+
return "purple"
|
|
13
|
+
return "#E74C3C" if self.is_relevant else "gray"
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -8,16 +8,16 @@ import numpy as np
|
|
|
8
8
|
import polars as pl
|
|
9
9
|
from lumiere.backend import relu, sigmoid
|
|
10
10
|
|
|
11
|
-
from bella_companion.simulations.figures.explain import (
|
|
12
|
-
plot_partial_dependencies,
|
|
13
|
-
plot_shap_features_importance,
|
|
14
|
-
)
|
|
15
11
|
from bella_companion.simulations.scenarios.epi_multitype import (
|
|
16
12
|
MIGRATION_PREDICTOR,
|
|
17
13
|
MIGRATION_RATE_UPPER,
|
|
18
14
|
MIGRATION_RATES,
|
|
19
15
|
SCENARIO,
|
|
20
16
|
)
|
|
17
|
+
from bella_companion.utils import (
|
|
18
|
+
plot_partial_dependencies,
|
|
19
|
+
plot_shap_features_importance,
|
|
20
|
+
)
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
def _plot_predictions(log_summary: pl.DataFrame, output_dir: Path):
|
{bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/figures/fbd_2traits.py
RENAMED
|
@@ -8,10 +8,6 @@ import numpy as np
|
|
|
8
8
|
import polars as pl
|
|
9
9
|
from lumiere.backend import relu, sigmoid
|
|
10
10
|
|
|
11
|
-
from bella_companion.simulations.figures.explain import (
|
|
12
|
-
plot_partial_dependencies,
|
|
13
|
-
plot_shap_features_importance,
|
|
14
|
-
)
|
|
15
11
|
from bella_companion.simulations.figures.utils import step
|
|
16
12
|
from bella_companion.simulations.scenarios.fbd_2traits import (
|
|
17
13
|
FBD_RATE_UPPER,
|
|
@@ -20,6 +16,10 @@ from bella_companion.simulations.scenarios.fbd_2traits import (
|
|
|
20
16
|
SCENARIO,
|
|
21
17
|
STATES,
|
|
22
18
|
)
|
|
19
|
+
from bella_companion.utils import (
|
|
20
|
+
plot_partial_dependencies,
|
|
21
|
+
plot_shap_features_importance,
|
|
22
|
+
)
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
def _plot_predictions(log_summary: pl.DataFrame, output_dir: Path):
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -2,7 +2,7 @@ import numpy as np
|
|
|
2
2
|
from numpy.random import Generator
|
|
3
3
|
from phylogenie import get_epidemiological_events
|
|
4
4
|
|
|
5
|
-
from bella_companion.
|
|
5
|
+
from bella_companion.features import Feature
|
|
6
6
|
from bella_companion.simulations.scenarios.common import (
|
|
7
7
|
BECOME_UNINFECTIOUS_RATE,
|
|
8
8
|
EPI_MAX_TIME,
|
|
@@ -3,7 +3,7 @@ from functools import partial
|
|
|
3
3
|
import numpy as np
|
|
4
4
|
from phylogenie import SkylineParameter, get_epidemiological_events
|
|
5
5
|
|
|
6
|
-
from bella_companion.
|
|
6
|
+
from bella_companion.features import Feature
|
|
7
7
|
from bella_companion.simulations.scenarios.common import (
|
|
8
8
|
BECOME_UNINFECTIOUS_RATE,
|
|
9
9
|
EPI_MAX_TIME,
|
|
@@ -2,7 +2,7 @@ import numpy as np
|
|
|
2
2
|
from numpy.random import Generator
|
|
3
3
|
from phylogenie import SkylineVector, get_canonical_events
|
|
4
4
|
|
|
5
|
-
from bella_companion.
|
|
5
|
+
from bella_companion.features import Feature
|
|
6
6
|
from bella_companion.simulations.scenarios.common import (
|
|
7
7
|
FBD_MAX_TIME,
|
|
8
8
|
FBD_RATE_UPPER,
|
|
@@ -3,7 +3,7 @@ from functools import partial
|
|
|
3
3
|
import numpy as np
|
|
4
4
|
from phylogenie import SkylineParameter, get_canonical_events
|
|
5
5
|
|
|
6
|
-
from bella_companion.
|
|
6
|
+
from bella_companion.features import Feature
|
|
7
7
|
from bella_companion.simulations.scenarios.common import (
|
|
8
8
|
FBD_MAX_TIME,
|
|
9
9
|
FBD_RATE_UPPER,
|
|
@@ -4,8 +4,8 @@ from bella_companion.utils.beast import (
|
|
|
4
4
|
summarize_logs_dir,
|
|
5
5
|
)
|
|
6
6
|
from bella_companion.utils.explain import (
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
plot_partial_dependencies,
|
|
8
|
+
plot_shap_features_importance,
|
|
9
9
|
)
|
|
10
10
|
from bella_companion.utils.slurm import submit_job
|
|
11
11
|
|
|
@@ -13,7 +13,7 @@ __all__ = [
|
|
|
13
13
|
"summarize_log",
|
|
14
14
|
"summarize_logs_dir",
|
|
15
15
|
"read_weights_dir",
|
|
16
|
-
"
|
|
17
|
-
"
|
|
16
|
+
"plot_partial_dependencies",
|
|
17
|
+
"plot_shap_features_importance",
|
|
18
18
|
"submit_job",
|
|
19
19
|
]
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -6,20 +6,44 @@ import matplotlib.pyplot as plt
|
|
|
6
6
|
import numpy as np
|
|
7
7
|
import seaborn as sns
|
|
8
8
|
from joblib import Parallel, delayed
|
|
9
|
-
from lumiere
|
|
9
|
+
from lumiere import get_partial_dependence_values
|
|
10
|
+
from lumiere.typing import ActivationFunction, ArrayLike, Weights
|
|
10
11
|
from tqdm import tqdm
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
from bella_companion.
|
|
13
|
+
import bella_companion.utils.explain.typeguards as tg
|
|
14
|
+
from bella_companion.features import Feature
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _get_median_partial_dependence_values(
|
|
18
|
+
weights: list[Weights], # shape: (n_weight_samples, ...)
|
|
19
|
+
inputs: ArrayLike,
|
|
20
|
+
features_grid: list[list[float]],
|
|
21
|
+
hidden_activation: ActivationFunction,
|
|
22
|
+
output_activation: ActivationFunction,
|
|
23
|
+
) -> list[list[float]]: # shape: (n_features, n_grid_points)
|
|
24
|
+
pdvalues = [
|
|
25
|
+
get_partial_dependence_values(
|
|
26
|
+
weights=w,
|
|
27
|
+
features_grid=features_grid,
|
|
28
|
+
hidden_activation=hidden_activation,
|
|
29
|
+
output_activation=output_activation,
|
|
30
|
+
)
|
|
31
|
+
for w in weights
|
|
32
|
+
]
|
|
33
|
+
return [
|
|
34
|
+
np.median([pd[feature_idx] for pd in pdvalues], axis=0).tolist()
|
|
35
|
+
for feature_idx in range(len(features_grid))
|
|
36
|
+
]
|
|
14
37
|
|
|
15
38
|
|
|
16
39
|
def plot_partial_dependencies(
|
|
17
|
-
weights: list[list[Weights]],
|
|
40
|
+
weights: list[Weights] | list[list[Weights]],
|
|
18
41
|
features: dict[str, Feature],
|
|
19
|
-
output_dir: Path,
|
|
42
|
+
output_dir: str | Path,
|
|
20
43
|
hidden_activation: ActivationFunction,
|
|
21
44
|
output_activation: ActivationFunction,
|
|
22
45
|
):
|
|
46
|
+
output_dir = Path(output_dir)
|
|
23
47
|
os.makedirs(output_dir, exist_ok=True)
|
|
24
48
|
|
|
25
49
|
continuous_grid: list[float] = np.linspace(0, 1, 10).tolist()
|
|
@@ -27,10 +51,20 @@ def plot_partial_dependencies(
|
|
|
27
51
|
[0, 1] if feature.is_binary else continuous_grid
|
|
28
52
|
for feature in features.values()
|
|
29
53
|
]
|
|
54
|
+
|
|
55
|
+
if tg.is_weights_list(weights):
|
|
56
|
+
func = get_partial_dependence_values
|
|
57
|
+
elif tg.is_nested_weights_list(weights):
|
|
58
|
+
func = _get_median_partial_dependence_values
|
|
59
|
+
else:
|
|
60
|
+
raise ValueError(
|
|
61
|
+
"weights must be a list of Weights or a list of list of Weights"
|
|
62
|
+
)
|
|
63
|
+
|
|
30
64
|
jobs = Parallel(n_jobs=-1, return_as="generator_unordered")(
|
|
31
65
|
delayed(
|
|
32
66
|
partial(
|
|
33
|
-
|
|
67
|
+
func,
|
|
34
68
|
features_grid=features_grid,
|
|
35
69
|
hidden_activation=hidden_activation,
|
|
36
70
|
output_activation=output_activation,
|
|
@@ -48,19 +82,22 @@ def plot_partial_dependencies(
|
|
|
48
82
|
if any(not f.is_binary for f in features.values()):
|
|
49
83
|
for (label, feature), feature_pdvalues in zip(features.items(), pdvalues):
|
|
50
84
|
if not feature.is_binary:
|
|
51
|
-
color = "#E74C3C" if feature.is_relevant else "gray"
|
|
52
85
|
median = np.median(feature_pdvalues, axis=1)
|
|
53
86
|
lower = np.percentile(feature_pdvalues, 2.5, axis=1)
|
|
54
87
|
high = np.percentile(feature_pdvalues, 100 - 2.5, axis=1)
|
|
55
88
|
plt.fill_between( # pyright: ignore
|
|
56
|
-
continuous_grid, lower, high, alpha=0.25, color=color
|
|
89
|
+
continuous_grid, lower, high, alpha=0.25, color=feature.color
|
|
57
90
|
)
|
|
58
91
|
for mcmc_pds in feature_pdvalues.T:
|
|
59
92
|
plt.plot( # pyright: ignore
|
|
60
|
-
continuous_grid,
|
|
93
|
+
continuous_grid,
|
|
94
|
+
mcmc_pds,
|
|
95
|
+
color=feature.color,
|
|
96
|
+
alpha=0.2,
|
|
97
|
+
linewidth=1,
|
|
61
98
|
)
|
|
62
99
|
plt.plot( # pyright: ignore
|
|
63
|
-
continuous_grid, median, color=color, label=label
|
|
100
|
+
continuous_grid, median, color=feature.color, label=label
|
|
64
101
|
)
|
|
65
102
|
plt.xlabel("Feature value") # pyright: ignore
|
|
66
103
|
plt.ylabel("MLP Output") # pyright: ignore
|
|
@@ -84,10 +121,9 @@ def plot_partial_dependencies(
|
|
|
84
121
|
)
|
|
85
122
|
ax.get_legend().remove() # pyright: ignore
|
|
86
123
|
|
|
87
|
-
for i,
|
|
88
|
-
color = "#E74C3C" if f.is_relevant else "gray"
|
|
124
|
+
for i, feature in enumerate([f for f in features.values() if f.is_binary]):
|
|
89
125
|
for coll in ax.collections[i * 2 : i * 2 + 2]:
|
|
90
|
-
coll.set_facecolor(color)
|
|
126
|
+
coll.set_facecolor(feature.color)
|
|
91
127
|
|
|
92
128
|
plt.xlabel("Feature") # pyright: ignore
|
|
93
129
|
plt.ylabel("MLP Output") # pyright: ignore
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
from functools import partial
|
|
2
|
+
from itertools import product
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from typing import Callable
|
|
5
|
+
|
|
6
|
+
import matplotlib.pyplot as plt
|
|
7
|
+
import numpy as np
|
|
8
|
+
import seaborn as sns
|
|
9
|
+
from joblib import Parallel, delayed
|
|
10
|
+
from lumiere import get_shap_features_importance
|
|
11
|
+
from lumiere.typing import ActivationFunction, Array, Weights
|
|
12
|
+
from numpy.typing import ArrayLike
|
|
13
|
+
from tqdm import tqdm
|
|
14
|
+
|
|
15
|
+
import bella_companion.utils.explain.typeguards as tg
|
|
16
|
+
from bella_companion.features import Feature
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def _get_median_shap_features_importance(
|
|
20
|
+
weights: list[Weights],
|
|
21
|
+
inputs: ArrayLike,
|
|
22
|
+
hidden_activation: ActivationFunction,
|
|
23
|
+
output_activation: ActivationFunction,
|
|
24
|
+
) -> list[float]: # length: n_features
|
|
25
|
+
features_importance = np.array(
|
|
26
|
+
[
|
|
27
|
+
get_shap_features_importance(
|
|
28
|
+
weights=w,
|
|
29
|
+
inputs=inputs,
|
|
30
|
+
hidden_activation=hidden_activation,
|
|
31
|
+
output_activation=output_activation,
|
|
32
|
+
)
|
|
33
|
+
for w in weights
|
|
34
|
+
]
|
|
35
|
+
)
|
|
36
|
+
return np.median(features_importance, axis=0).tolist()
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def _plot_shap_violins(
|
|
40
|
+
features: dict[str, Feature],
|
|
41
|
+
features_importance: Array, # shape: (n_samples, n_features)
|
|
42
|
+
output_file: str | Path,
|
|
43
|
+
):
|
|
44
|
+
features_importance = np.asarray(features_importance)
|
|
45
|
+
features_importance /= features_importance.sum(axis=1, keepdims=True)
|
|
46
|
+
|
|
47
|
+
def _plot_violins(group_check: Callable[[Feature], bool]):
|
|
48
|
+
for i, (feature_name, feature) in enumerate(features.items()):
|
|
49
|
+
if group_check(feature):
|
|
50
|
+
sns.violinplot(
|
|
51
|
+
y=features_importance[:, i],
|
|
52
|
+
x=[feature_name] * len(features_importance),
|
|
53
|
+
cut=0,
|
|
54
|
+
color=feature.color,
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
_plot_violins(lambda f: not f.is_binary)
|
|
58
|
+
_plot_violins(lambda f: f.is_binary)
|
|
59
|
+
plt.xlabel("Feature") # pyright: ignore
|
|
60
|
+
plt.ylabel("Importance") # pyright: ignore
|
|
61
|
+
plt.savefig(output_file) # pyright: ignore
|
|
62
|
+
plt.close()
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def plot_shap_features_importance(
|
|
66
|
+
weights: list[Weights] | list[list[Weights]],
|
|
67
|
+
features: dict[str, Feature],
|
|
68
|
+
output_file: str | Path,
|
|
69
|
+
hidden_activation: ActivationFunction,
|
|
70
|
+
output_activation: ActivationFunction,
|
|
71
|
+
):
|
|
72
|
+
continuous_grid: list[float] = np.linspace(0, 1, 10).tolist()
|
|
73
|
+
features_grid: list[list[float]] = [
|
|
74
|
+
[0, 1] if feature.is_binary else continuous_grid
|
|
75
|
+
for feature in features.values()
|
|
76
|
+
]
|
|
77
|
+
inputs = list(product(*features_grid))
|
|
78
|
+
|
|
79
|
+
if tg.is_weights_list(weights):
|
|
80
|
+
func = get_shap_features_importance
|
|
81
|
+
elif tg.is_nested_weights_list(weights):
|
|
82
|
+
func = _get_median_shap_features_importance
|
|
83
|
+
else:
|
|
84
|
+
raise ValueError(
|
|
85
|
+
"weights must be a list of Weights or a list of list of Weights"
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
jobs = Parallel(n_jobs=-1, return_as="generator_unordered")(
|
|
89
|
+
delayed(
|
|
90
|
+
partial(
|
|
91
|
+
func,
|
|
92
|
+
inputs=inputs,
|
|
93
|
+
hidden_activation=hidden_activation,
|
|
94
|
+
output_activation=output_activation,
|
|
95
|
+
)
|
|
96
|
+
)(w)
|
|
97
|
+
for w in weights
|
|
98
|
+
)
|
|
99
|
+
features_importance = np.array(
|
|
100
|
+
[job for job in tqdm(jobs, total=len(weights), desc="Evaluating SHAPs")]
|
|
101
|
+
) # shape: (n_runs, n_features)
|
|
102
|
+
_plot_shap_violins(features, features_importance, output_file)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from typing import Any, TypeGuard
|
|
2
|
+
|
|
3
|
+
import numpy as np
|
|
4
|
+
from lumiere.typing import Weights
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def is_list(obj: Any) -> TypeGuard[list[Any]]:
|
|
8
|
+
return isinstance(obj, list)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def is_weights(obj: Any) -> TypeGuard[Weights]:
|
|
12
|
+
return is_list(obj) and all(isinstance(layer, np.ndarray) for layer in obj)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def is_weights_list(weights: Any) -> TypeGuard[list[Weights]]:
|
|
16
|
+
return is_list(weights) and all(is_weights(w) for w in weights)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def is_nested_weights_list(weights: Any) -> TypeGuard[list[list[Weights]]]:
|
|
20
|
+
return is_list(weights) and all(is_weights_list(w) for w in weights)
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bella-companion
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.48
|
|
4
4
|
Summary: Bayesian Evolutionary Layered Learning Architectures (BELLA) companion
|
|
5
5
|
Requires-Python: >=3.10
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
7
7
|
Requires-Dist: arviz>=0.22.0
|
|
8
|
-
Requires-Dist: bella-lumiere>=0.0.
|
|
8
|
+
Requires-Dist: bella-lumiere>=0.0.19
|
|
9
9
|
Requires-Dist: dotenv>=0.9.9
|
|
10
10
|
Requires-Dist: phylogenie>=3.1.4
|
|
11
11
|
Requires-Dist: poetry>=2.2.1
|
|
@@ -3,6 +3,7 @@ pyproject.toml
|
|
|
3
3
|
bella_companion/BELLA.jar
|
|
4
4
|
bella_companion/__init__.py
|
|
5
5
|
bella_companion/cli.py
|
|
6
|
+
bella_companion/features.py
|
|
6
7
|
bella_companion/version.xml
|
|
7
8
|
bella_companion.egg-info/PKG-INFO
|
|
8
9
|
bella_companion.egg-info/SOURCES.txt
|
|
@@ -12,6 +13,7 @@ bella_companion.egg-info/requires.txt
|
|
|
12
13
|
bella_companion.egg-info/top_level.txt
|
|
13
14
|
bella_companion/__pycache__/__init__.cpython-310.pyc
|
|
14
15
|
bella_companion/__pycache__/cli.cpython-310.pyc
|
|
16
|
+
bella_companion/__pycache__/features.cpython-310.pyc
|
|
15
17
|
bella_companion/eucovid/__init__.py
|
|
16
18
|
bella_companion/eucovid/run_beast.py
|
|
17
19
|
bella_companion/eucovid/__pycache__/__init__.cpython-310.pyc
|
|
@@ -19,22 +21,22 @@ bella_companion/eucovid/__pycache__/run_beast.cpython-310.pyc
|
|
|
19
21
|
bella_companion/eucovid/beast_configs/GLM.xml
|
|
20
22
|
bella_companion/eucovid/beast_configs/MLP.xml
|
|
21
23
|
bella_companion/eucovid/beast_configs/Nonparametric.xml
|
|
22
|
-
bella_companion/eucovid/data/case_data.
|
|
23
|
-
bella_companion/eucovid/data/change_dates.
|
|
24
|
+
bella_companion/eucovid/data/case_data.csv
|
|
25
|
+
bella_companion/eucovid/data/change_dates.csv
|
|
24
26
|
bella_companion/eucovid/data/msa.fasta
|
|
25
|
-
bella_companion/eucovid/data/osi.
|
|
26
|
-
bella_companion/eucovid/data/predictors/changetimes_all_7e.
|
|
27
|
-
bella_companion/eucovid/data/predictors/changetimes_flights_4e.
|
|
28
|
-
bella_companion/eucovid/data/predictors/flight_pop_x_4e_ls.
|
|
29
|
-
bella_companion/eucovid/data/predictors/all/closedborders_7e_nt.
|
|
30
|
-
bella_companion/eucovid/data/predictors/all/dist_7e_ls.
|
|
31
|
-
bella_companion/eucovid/data/predictors/all/flight_7e_ls.
|
|
32
|
-
bella_companion/eucovid/data/predictors/all/flight_pop_x_7e_ls.
|
|
33
|
-
bella_companion/eucovid/data/predictors/all/osi_x_7e_ls.
|
|
34
|
-
bella_companion/eucovid/data/predictors/all/osi_y_7e_ls.
|
|
35
|
-
bella_companion/eucovid/data/predictors/all/pop_x_7e_ls.
|
|
36
|
-
bella_companion/eucovid/data/predictors/all/pop_y_7e_ls.
|
|
37
|
-
bella_companion/eucovid/data/predictors/all/sharedborders_7e_nt.
|
|
27
|
+
bella_companion/eucovid/data/osi.csv
|
|
28
|
+
bella_companion/eucovid/data/predictors/changetimes_all_7e.csv
|
|
29
|
+
bella_companion/eucovid/data/predictors/changetimes_flights_4e.csv
|
|
30
|
+
bella_companion/eucovid/data/predictors/flight_pop_x_4e_ls.csv
|
|
31
|
+
bella_companion/eucovid/data/predictors/all/closedborders_7e_nt.csv
|
|
32
|
+
bella_companion/eucovid/data/predictors/all/dist_7e_ls.csv
|
|
33
|
+
bella_companion/eucovid/data/predictors/all/flight_7e_ls.csv
|
|
34
|
+
bella_companion/eucovid/data/predictors/all/flight_pop_x_7e_ls.csv
|
|
35
|
+
bella_companion/eucovid/data/predictors/all/osi_x_7e_ls.csv
|
|
36
|
+
bella_companion/eucovid/data/predictors/all/osi_y_7e_ls.csv
|
|
37
|
+
bella_companion/eucovid/data/predictors/all/pop_x_7e_ls.csv
|
|
38
|
+
bella_companion/eucovid/data/predictors/all/pop_y_7e_ls.csv
|
|
39
|
+
bella_companion/eucovid/data/predictors/all/sharedborders_7e_nt.csv
|
|
38
40
|
bella_companion/platyrrhine/__init__.py
|
|
39
41
|
bella_companion/platyrrhine/beast_config.xml
|
|
40
42
|
bella_companion/platyrrhine/results.py
|
|
@@ -49,7 +51,6 @@ bella_companion/platyrrhine/data/change_times.csv
|
|
|
49
51
|
bella_companion/platyrrhine/data/traits.csv
|
|
50
52
|
bella_companion/platyrrhine/data/trees.nwk
|
|
51
53
|
bella_companion/simulations/__init__.py
|
|
52
|
-
bella_companion/simulations/features.py
|
|
53
54
|
bella_companion/simulations/generate_data.py
|
|
54
55
|
bella_companion/simulations/generate_figures.py
|
|
55
56
|
bella_companion/simulations/metrics.py
|
|
@@ -89,12 +90,6 @@ bella_companion/simulations/figures/__pycache__/fbd_2traits.cpython-310.pyc
|
|
|
89
90
|
bella_companion/simulations/figures/__pycache__/fbd_no_traits.cpython-310.pyc
|
|
90
91
|
bella_companion/simulations/figures/__pycache__/scenarios.cpython-310.pyc
|
|
91
92
|
bella_companion/simulations/figures/__pycache__/utils.cpython-310.pyc
|
|
92
|
-
bella_companion/simulations/figures/explain/__init__.py
|
|
93
|
-
bella_companion/simulations/figures/explain/pdp.py
|
|
94
|
-
bella_companion/simulations/figures/explain/shap.py
|
|
95
|
-
bella_companion/simulations/figures/explain/__pycache__/__init__.cpython-310.pyc
|
|
96
|
-
bella_companion/simulations/figures/explain/__pycache__/pdp.cpython-310.pyc
|
|
97
|
-
bella_companion/simulations/figures/explain/__pycache__/shap.cpython-310.pyc
|
|
98
93
|
bella_companion/simulations/scenarios/__init__.py
|
|
99
94
|
bella_companion/simulations/scenarios/common.py
|
|
100
95
|
bella_companion/simulations/scenarios/epi_multitype.py
|
|
@@ -111,9 +106,16 @@ bella_companion/simulations/scenarios/__pycache__/fbd_no_traits.cpython-310.pyc
|
|
|
111
106
|
bella_companion/simulations/scenarios/__pycache__/scenario.cpython-310.pyc
|
|
112
107
|
bella_companion/utils/__init__.py
|
|
113
108
|
bella_companion/utils/beast.py
|
|
114
|
-
bella_companion/utils/explain.py
|
|
115
109
|
bella_companion/utils/slurm.py
|
|
116
110
|
bella_companion/utils/__pycache__/__init__.cpython-310.pyc
|
|
117
111
|
bella_companion/utils/__pycache__/beast.cpython-310.pyc
|
|
118
112
|
bella_companion/utils/__pycache__/explain.cpython-310.pyc
|
|
119
|
-
bella_companion/utils/__pycache__/slurm.cpython-310.pyc
|
|
113
|
+
bella_companion/utils/__pycache__/slurm.cpython-310.pyc
|
|
114
|
+
bella_companion/utils/explain/__init__.py
|
|
115
|
+
bella_companion/utils/explain/pdp.py
|
|
116
|
+
bella_companion/utils/explain/shap.py
|
|
117
|
+
bella_companion/utils/explain/typeguards.py
|
|
118
|
+
bella_companion/utils/explain/__pycache__/__init__.cpython-310.pyc
|
|
119
|
+
bella_companion/utils/explain/__pycache__/pdp.cpython-310.pyc
|
|
120
|
+
bella_companion/utils/explain/__pycache__/shap.cpython-310.pyc
|
|
121
|
+
bella_companion/utils/explain/__pycache__/typeguards.cpython-310.pyc
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "bella-companion"
|
|
3
|
-
version = "0.0.
|
|
3
|
+
version = "0.0.48"
|
|
4
4
|
description = "Bayesian Evolutionary Layered Learning Architectures (BELLA) companion"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.10"
|
|
7
7
|
dependencies = [
|
|
8
8
|
"arviz>=0.22.0",
|
|
9
|
-
"bella-lumiere>=0.0.
|
|
9
|
+
"bella-lumiere>=0.0.19",
|
|
10
10
|
"dotenv>=0.9.9",
|
|
11
11
|
"phylogenie>=3.1.4",
|
|
12
12
|
"poetry>=2.2.1",
|
|
@@ -32,5 +32,3 @@ build-backend = "setuptools.build_meta"
|
|
|
32
32
|
[tool.setuptools]
|
|
33
33
|
packages = ["bella_companion"]
|
|
34
34
|
|
|
35
|
-
[tool.setuptools.package-data]
|
|
36
|
-
bella_companion = ["**/*"]
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
bella_companion-0.0.46/bella_companion/simulations/figures/explain/__pycache__/pdp.cpython-310.pyc
DELETED
|
Binary file
|
bella_companion-0.0.46/bella_companion/simulations/figures/explain/__pycache__/shap.cpython-310.pyc
DELETED
|
Binary file
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
from functools import partial
|
|
2
|
-
from itertools import product
|
|
3
|
-
from pathlib import Path
|
|
4
|
-
from typing import Callable
|
|
5
|
-
|
|
6
|
-
import matplotlib.pyplot as plt
|
|
7
|
-
import numpy as np
|
|
8
|
-
import seaborn as sns
|
|
9
|
-
from joblib import Parallel, delayed
|
|
10
|
-
from lumiere.typing import ActivationFunction, Weights
|
|
11
|
-
from tqdm import tqdm
|
|
12
|
-
|
|
13
|
-
from bella_companion.simulations.features import Feature
|
|
14
|
-
from bella_companion.utils import get_median_shap_features_importance
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
def plot_shap_features_importance(
|
|
18
|
-
weights: list[list[Weights]], # shape: (n_runs, n_weights_samples, ...)
|
|
19
|
-
features: dict[str, Feature],
|
|
20
|
-
output_file: Path,
|
|
21
|
-
hidden_activation: ActivationFunction,
|
|
22
|
-
output_activation: ActivationFunction,
|
|
23
|
-
):
|
|
24
|
-
continuous_grid: list[float] = np.linspace(0, 1, 10).tolist()
|
|
25
|
-
features_grid: list[list[float]] = [
|
|
26
|
-
[0, 1] if feature.is_binary else continuous_grid
|
|
27
|
-
for feature in features.values()
|
|
28
|
-
]
|
|
29
|
-
inputs = list(product(*features_grid))
|
|
30
|
-
|
|
31
|
-
jobs = Parallel(n_jobs=-1, return_as="generator_unordered")(
|
|
32
|
-
delayed(
|
|
33
|
-
partial(
|
|
34
|
-
get_median_shap_features_importance,
|
|
35
|
-
inputs=inputs,
|
|
36
|
-
hidden_activation=hidden_activation,
|
|
37
|
-
output_activation=output_activation,
|
|
38
|
-
)
|
|
39
|
-
)(w)
|
|
40
|
-
for w in weights
|
|
41
|
-
)
|
|
42
|
-
features_importances = np.array(
|
|
43
|
-
[job for job in tqdm(jobs, total=len(weights), desc="Evaluating SHAPs")]
|
|
44
|
-
) # shape: (n_runs, n_features)
|
|
45
|
-
features_importances /= features_importances.sum(axis=1, keepdims=True)
|
|
46
|
-
|
|
47
|
-
def _plot_violins(group_check: Callable[[Feature], bool]):
|
|
48
|
-
for i, (feature_name, feature) in enumerate(features.items()):
|
|
49
|
-
if group_check(feature):
|
|
50
|
-
sns.violinplot(
|
|
51
|
-
y=features_importances[:, i],
|
|
52
|
-
x=[feature_name] * len(features_importances),
|
|
53
|
-
cut=0,
|
|
54
|
-
color="#E74C3C" if feature.is_relevant else "gray",
|
|
55
|
-
)
|
|
56
|
-
|
|
57
|
-
_plot_violins(lambda f: not f.is_binary)
|
|
58
|
-
_plot_violins(lambda f: f.is_binary)
|
|
59
|
-
plt.xlabel("Feature") # pyright: ignore
|
|
60
|
-
plt.ylabel("Importance") # pyright: ignore
|
|
61
|
-
plt.savefig(output_file) # pyright: ignore
|
|
62
|
-
plt.close()
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import numpy as np
|
|
2
|
-
from lumiere import get_partial_dependence_values, get_shap_features_importance
|
|
3
|
-
from lumiere.typing import ActivationFunction, Weights
|
|
4
|
-
from numpy.typing import ArrayLike
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
def get_median_partial_dependence_values(
|
|
8
|
-
weights: list[Weights], # shape: (n_weight_samples, ...)
|
|
9
|
-
features_grid: list[list[float]],
|
|
10
|
-
hidden_activation: ActivationFunction,
|
|
11
|
-
output_activation: ActivationFunction,
|
|
12
|
-
) -> list[list[float]]: # shape: (n_features, n_grid_points)
|
|
13
|
-
pdvalues = [
|
|
14
|
-
get_partial_dependence_values(
|
|
15
|
-
weights=w,
|
|
16
|
-
features_grid=features_grid,
|
|
17
|
-
hidden_activation=hidden_activation,
|
|
18
|
-
output_activation=output_activation,
|
|
19
|
-
)
|
|
20
|
-
for w in weights
|
|
21
|
-
]
|
|
22
|
-
return [
|
|
23
|
-
np.median([pd[feature_idx] for pd in pdvalues], axis=0).tolist()
|
|
24
|
-
for feature_idx in range(len(features_grid))
|
|
25
|
-
]
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
def get_median_shap_features_importance(
|
|
29
|
-
weights: list[Weights],
|
|
30
|
-
inputs: ArrayLike,
|
|
31
|
-
hidden_activation: ActivationFunction,
|
|
32
|
-
output_activation: ActivationFunction,
|
|
33
|
-
) -> list[float]: # length: n_features
|
|
34
|
-
features_importance = np.array(
|
|
35
|
-
[
|
|
36
|
-
get_shap_features_importance(
|
|
37
|
-
weights=w,
|
|
38
|
-
inputs=inputs,
|
|
39
|
-
hidden_activation=hidden_activation,
|
|
40
|
-
output_activation=output_activation,
|
|
41
|
-
)
|
|
42
|
-
for w in weights
|
|
43
|
-
]
|
|
44
|
-
)
|
|
45
|
-
return np.median(features_importance, axis=0).tolist()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/platyrrhine/beast_config.xml
RENAMED
|
File without changes
|
{bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/platyrrhine/data/change_times.csv
RENAMED
|
File without changes
|
{bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/platyrrhine/data/traits.csv
RENAMED
|
File without changes
|
{bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/platyrrhine/data/trees.nwk
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/figures/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/figures/epi_skyline.py
RENAMED
|
File without changes
|
|
File without changes
|
{bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/figures/scenarios.py
RENAMED
|
File without changes
|
{bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/figures/utils.py
RENAMED
|
File without changes
|
{bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/generate_data.py
RENAMED
|
File without changes
|
{bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/generate_figures.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/scenarios/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion/simulations/scenarios/common.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bella_companion-0.0.46 → bella_companion-0.0.48}/bella_companion.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|