bella-companion 0.0.48__py3-none-any.whl → 0.1.2__py3-none-any.whl

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.

Files changed (72) hide show
  1. bella_companion/eucovid/beast_configs/GLM.xml +27 -17
  2. bella_companion/eucovid/beast_configs/MLP.xml +2 -3
  3. bella_companion/eucovid/run_beast.py +13 -107
  4. bella_companion/simulations/figures/epi_multitype.py +1 -1
  5. bella_companion/simulations/figures/fbd_2traits.py +1 -1
  6. bella_companion/utils/beast.py +2 -2
  7. bella_companion/utils/explain/pdp.py +14 -7
  8. bella_companion/utils/explain/shap.py +10 -8
  9. bella_companion/utils/explain/typeguards.py +1 -1
  10. {bella_companion-0.0.48.dist-info → bella_companion-0.1.2.dist-info}/METADATA +8 -5
  11. bella_companion-0.1.2.dist-info/RECORD +63 -0
  12. bella_companion-0.1.2.dist-info/WHEEL +4 -0
  13. {bella_companion-0.0.48.dist-info → bella_companion-0.1.2.dist-info}/entry_points.txt +1 -0
  14. bella_companion/__pycache__/__init__.cpython-310.pyc +0 -0
  15. bella_companion/__pycache__/cli.cpython-310.pyc +0 -0
  16. bella_companion/__pycache__/features.cpython-310.pyc +0 -0
  17. bella_companion/eucovid/__pycache__/__init__.cpython-310.pyc +0 -0
  18. bella_companion/eucovid/__pycache__/run_beast.cpython-310.pyc +0 -0
  19. bella_companion/eucovid/beast_configs/Nonparametric.xml +0 -399
  20. bella_companion/eucovid/data/case_data.csv +0 -346
  21. bella_companion/eucovid/data/change_dates.csv +0 -8
  22. bella_companion/eucovid/data/osi.csv +0 -376
  23. bella_companion/eucovid/data/predictors/all/closedborders_7e_nt.csv +0 -35
  24. bella_companion/eucovid/data/predictors/all/dist_7e_ls.csv +0 -35
  25. bella_companion/eucovid/data/predictors/all/flight_7e_ls.csv +0 -35
  26. bella_companion/eucovid/data/predictors/all/flight_pop_x_7e_ls.csv +0 -35
  27. bella_companion/eucovid/data/predictors/all/osi_x_7e_ls.csv +0 -35
  28. bella_companion/eucovid/data/predictors/all/osi_y_7e_ls.csv +0 -35
  29. bella_companion/eucovid/data/predictors/all/pop_x_7e_ls.csv +0 -35
  30. bella_companion/eucovid/data/predictors/all/pop_y_7e_ls.csv +0 -35
  31. bella_companion/eucovid/data/predictors/all/sharedborders_7e_nt.csv +0 -35
  32. bella_companion/eucovid/data/predictors/changetimes_all_7e.csv +0 -6
  33. bella_companion/platyrrhine/__pycache__/__init__.cpython-310.pyc +0 -0
  34. bella_companion/platyrrhine/__pycache__/results.cpython-310.pyc +0 -0
  35. bella_companion/platyrrhine/__pycache__/run_beast.cpython-310.pyc +0 -0
  36. bella_companion/platyrrhine/__pycache__/summarize.cpython-310.pyc +0 -0
  37. bella_companion/platyrrhine/__pycache__/summarize_logs.cpython-310.pyc +0 -0
  38. bella_companion/simulations/__pycache__/__init__.cpython-310.pyc +0 -0
  39. bella_companion/simulations/__pycache__/features.cpython-310.pyc +0 -0
  40. bella_companion/simulations/__pycache__/generate_data.cpython-310.pyc +0 -0
  41. bella_companion/simulations/__pycache__/generate_figures.cpython-310.pyc +0 -0
  42. bella_companion/simulations/__pycache__/metrics.cpython-310.pyc +0 -0
  43. bella_companion/simulations/__pycache__/run_beast.cpython-310.pyc +0 -0
  44. bella_companion/simulations/__pycache__/summarize.cpython-310.pyc +0 -0
  45. bella_companion/simulations/__pycache__/summarize_logs.cpython-310.pyc +0 -0
  46. bella_companion/simulations/figures/__pycache__/__init__.cpython-310.pyc +0 -0
  47. bella_companion/simulations/figures/__pycache__/epi_multitype.cpython-310.pyc +0 -0
  48. bella_companion/simulations/figures/__pycache__/epi_skyline.cpython-310.pyc +0 -0
  49. bella_companion/simulations/figures/__pycache__/fbd_2traits.cpython-310.pyc +0 -0
  50. bella_companion/simulations/figures/__pycache__/fbd_no_traits.cpython-310.pyc +0 -0
  51. bella_companion/simulations/figures/__pycache__/scenarios.cpython-310.pyc +0 -0
  52. bella_companion/simulations/figures/__pycache__/utils.cpython-310.pyc +0 -0
  53. bella_companion/simulations/scenarios/__pycache__/__init__.cpython-310.pyc +0 -0
  54. bella_companion/simulations/scenarios/__pycache__/common.cpython-310.pyc +0 -0
  55. bella_companion/simulations/scenarios/__pycache__/epi_multitype.cpython-310.pyc +0 -0
  56. bella_companion/simulations/scenarios/__pycache__/epi_skyline.cpython-310.pyc +0 -0
  57. bella_companion/simulations/scenarios/__pycache__/fbd_2traits.cpython-310.pyc +0 -0
  58. bella_companion/simulations/scenarios/__pycache__/fbd_no_traits.cpython-310.pyc +0 -0
  59. bella_companion/simulations/scenarios/__pycache__/scenario.cpython-310.pyc +0 -0
  60. bella_companion/utils/__pycache__/__init__.cpython-310.pyc +0 -0
  61. bella_companion/utils/__pycache__/beast.cpython-310.pyc +0 -0
  62. bella_companion/utils/__pycache__/explain.cpython-310.pyc +0 -0
  63. bella_companion/utils/__pycache__/slurm.cpython-310.pyc +0 -0
  64. bella_companion/utils/explain/__pycache__/__init__.cpython-310.pyc +0 -0
  65. bella_companion/utils/explain/__pycache__/pdp.cpython-310.pyc +0 -0
  66. bella_companion/utils/explain/__pycache__/shap.cpython-310.pyc +0 -0
  67. bella_companion/utils/explain/__pycache__/typeguards.cpython-310.pyc +0 -0
  68. bella_companion-0.0.48.dist-info/RECORD +0 -118
  69. bella_companion-0.0.48.dist-info/WHEEL +0 -5
  70. bella_companion-0.0.48.dist-info/top_level.txt +0 -1
  71. /bella_companion/eucovid/data/{predictors/changetimes_flights_4e.csv → changetimes.csv} +0 -0
  72. /bella_companion/eucovid/data/{predictors/flight_pop_x_4e_ls.csv → flights.csv} +0 -0
@@ -48,7 +48,7 @@
48
48
  <populationModel spec="ConstantPopulation" popSize="0.1"/>
49
49
  </stateNode>
50
50
  <stateNode id="Re" spec="RealParameter" value="1.0 1.1 1.2 1.3 1.4 1.01 1.1 1.2 1.3 1.4"/>
51
- <stateNode id="samplingProportion" spec="RealParameter" value="1.11E-5 1.2E-5 1.3E-5 1.4E-5 1.5E-5 1.1E-5 1.2E-5 1.3E-5 1.4E-5 1.5E-5 0.0 0.0 0.0 0.0 0.0"/>
51
+ <stateNode id="samplingProportion" spec="RealParameter" value="1.1E-4 1.2E-4 1.3E-4 1.4E-4 1.5E-4 1.11E-4 1.2E-4 1.3E-4 1.4E-4 1.5E-4 0.0 0.0 0.0 0.0 0.0"/>
52
52
  <stateNode id="migrationRateW" spec="RealParameter" value="0"/>
53
53
  <stateNode id="migrationRateScaler" spec="RealParameter" value="0.1"/>
54
54
  <stateNode id="processLength" spec="RealParameter" value="10.0"/>
@@ -76,9 +76,7 @@
76
76
  <becomeUninfectiousRate spec="SkylineVectorParameter" skylineValues="36.5" typeSet="@typeSet"/>
77
77
  <migrationRate id="migrationRateSP" spec="SkylineMatrixParameter" timesAreAges="true" processLength="@processLength" typeSet="@typeSet">
78
78
  <skylineValues spec="glmprior.util.GLMLogLinear" coefficients="@migrationRateW" scaleFactor="@migrationRateScaler" transform="false">
79
- <plate var="predictorFile" range="$(predictorFiles)">
80
- <predictor spec="RealParameterFromXSV" fileName="$(predictorFile)"/>
81
- </plate>
79
+ <predictor spec="RealParameterFromXSV" fileName="$(flightsPredictorFile)"/>
82
80
  <indicators spec="BooleanParameter" value="1"/>
83
81
  </skylineValues>
84
82
  <changeTimes spec="RealParameterFromXSV" fileName="$(changeTimesFile)"/>
@@ -94,26 +92,37 @@
94
92
  <distribution spec="SmartZeroExcludingPrior" x="@Re">
95
93
  <LogNormal name="distr" M="0.8" S="0.5"/>
96
94
  </distribution>
97
- <distribution spec="SmartZeroExcludingPrior" x="@samplingProportion" classesToExclude="1.2E-5 1.3E-5 1.4E-5 1.5E-5">
98
- <Uniform name="distr" lower="0" upper="0.15"/>
95
+
96
+ <!-- Sampling proportion in China -->
97
+ <distribution spec="SmartZeroExcludingPrior" x="@samplingProportionValues" classesToExclude="1.1E-4 1.2E-4 1.3E-4 1.4E-4 1.5E-4">
98
+ <Uniform name="distr" upper="0.024714828897338403"/>
99
+ </distribution>
100
+ <!-- Sampling proportion in China -->
101
+ <distribution spec="SmartZeroExcludingPrior" x="@samplingProportionValues" classesToExclude="1.11E-4 1.2E-4 1.3E-4 1.4E-4 1.5E-4">
102
+ <Uniform name="distr" upper="$1.8682742128337982e-4"/>
99
103
  </distribution>
100
- <distribution spec="SmartZeroExcludingPrior" x="@samplingProportion" classesToExclude="1.1E-5 1.3E-5 1.4E-5 1.5E-5">
101
- <Uniform name="distr" lower="0" upper="0.093"/>
104
+ <!-- Sampling proportion in France -->
105
+ <distribution spec="SmartZeroExcludingPrior" x="@samplingProportionValues" classesToExclude="1.1E-4 1.11E-4 1.3E-4 1.4E-4 1.5E-4">
106
+ <Uniform name="distr" upper="0.09217877094972067"/>
102
107
  </distribution>
103
- <distribution spec="SmartZeroExcludingPrior" x="@samplingProportion" classesToExclude="1.1E-5 1.2E-5 1.4E-5 1.5E-5">
104
- <Uniform name="distr" lower="0" upper="0.10"/>
108
+ <!-- Sampling proportion in Germany -->
109
+ <distribution spec="SmartZeroExcludingPrior" x="@samplingProportionValues" classesToExclude="1.1E-4 1.11E-4 1.2E-4 1.4E-4 1.5E-4">
110
+ <Uniform name="distr" upper="0.01770956316410862"/>
105
111
  </distribution>
106
- <distribution spec="SmartZeroExcludingPrior" x="@samplingProportion" classesToExclude="1.1E-5 1.2E-5 1.3E-5 1.5E-5">
107
- <Uniform name="distr" lower="0" upper="0.005"/>
112
+ <!-- Sampling proportion in Germany -->
113
+ <distribution spec="SmartZeroExcludingPrior" x="@samplingProportionValues" classesToExclude="1.1E-4 1.11E-4 1.2E-4 1.3E-4 1.5E-4">
114
+ <Uniform name="distr" upper="0.002209756926738059"/>
108
115
  </distribution>
109
- <distribution spec="SmartZeroExcludingPrior" x="@samplingProportion" classesToExclude="1.1E-5 1.2E-5 1.3E-5 1.4E-5">
110
- <Uniform name="distr" lower="0" upper="0.057"/>
116
+ <!-- Sampling proportion in EU -->
117
+ <distribution spec="SmartZeroExcludingPrior" x="@samplingProportionValues" classesToExclude="1.1E-4 1.11E-4 1.2E-4 1.3E-4 1.4E-4">
118
+ <Uniform name="distr" lower="0" upper="0.012770137524557957"/>
111
119
  </distribution>
120
+
112
121
  <prior name="distribution" x="@migrationRateW">
113
122
  <Normal name="distr" mean="0.0" sigma="1.0"/>
114
123
  </prior>
115
124
  <prior name="distribution" x="@migrationRateScaler">
116
- <LogNormal name="distr" M="0.0" S="0.8"/>
125
+ <LogNormal name="distr" M="0.0" S="1"/>
117
126
  </prior>
118
127
  <prior name="distribution" x="@gammaShape">
119
128
  <Exponential name="distr" mean="0.5"/>
@@ -136,8 +145,9 @@
136
145
  <operator spec="BactrianScaleOperator" parameter="@processLength" scaleFactor="0.25" weight="3.0"/>
137
146
  <operator spec="SmartScaleOperator" parameter="@Re" scaleFactor="0.25" weight="10.0"/>
138
147
  <operator spec="SmartScaleOperator" parameter="@samplingProportion" weight="3.0"/>
139
- <operator spec="BactrianRandomWalkOperator" parameter="@migrationRateW" weight="5.0" scaleFactor="0.1"/>
140
- <operator spec="AdaptableVarianceMultivariateNormalOperator" weight="5.0" coefficient="1.0" scaleFactor="0.5" beta="0.05" initial="800" burnin="400" every="1">
148
+ <operator spec="BactrianScaleOperator" parameter="@migrationRateScaler" scaleFactor="0.25" weight="3.0"/>
149
+ <operator spec="BactrianRandomWalkOperator" parameter="@migrationRateW" scaleFactor="0.1" weight="5.0"/>
150
+ <operator spec="AdaptableVarianceMultivariateNormalOperator" weight="5.0" scaleFactor="0.5" coefficient="1.0" beta="0.05" initial="800" burnin="400" every="1">
141
151
  <transformations spec="Transform$NoTransform" f="@migrationRateW"/>
142
152
  </operator>
143
153
  <operator spec="BactrianScaleOperator" parameter="@gammaShape" weight="1.0"/>
@@ -77,12 +77,11 @@
77
77
  <becomeUninfectiousRate spec="SkylineVectorParameter" skylineValues="36.5" typeSet="@typeSet"/>
78
78
  <migrationRate id="migrationRateSP" spec="SkylineMatrixParameter" timesAreAges="true" processLength="@processLength" typeSet="@typeSet">
79
79
  <skylineValues id="migrationRate" spec="bella.BayesMLP" nodes="$(nodes)">
80
- <plate var="predictorFile" range="$(predictorFiles)">
81
- <predictor spec="RealParameterFromXSV" fileName="$(predictorFile)"/>
82
- </plate>
80
+ <predictor spec="RealParameterFromXSV" fileName="$(flightsPredictorFile)"/>
83
81
  <plate var="n" range="$(layersRange)">
84
82
  <weights idref="migrationRateW$(n)"/>
85
83
  </plate>
84
+ <activationFunctionsOutput spec="bella.SoftPlus"/>
86
85
  </skylineValues>
87
86
  <changeTimes spec="RealParameterFromXSV" fileName="$(changeTimesFile)"/>
88
87
  </migrationRate>
@@ -1,4 +1,5 @@
1
1
  import os
2
+ from itertools import product
2
3
  from pathlib import Path
3
4
 
4
5
  from bella_companion.utils import submit_job
@@ -10,121 +11,26 @@ def run_beast():
10
11
  os.makedirs(output_dir, exist_ok=True)
11
12
 
12
13
  base_log_dir = Path(os.environ["BELLA_SBATCH_LOG_DIR"]) / "eucovid"
13
-
14
14
  data_dir = Path(__file__).parent / "data"
15
15
  beast_configs_dir = Path(__file__).parent / "beast_configs"
16
- msa_file = data_dir / "msa.fasta"
17
-
18
- predictors_dir = data_dir / "predictors"
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
- )
33
- all_predictors_data = " ".join(
34
- [
35
- f"-D msa_file={msa_file}",
36
- f"-D changeTimesFile={predictors_dir / 'changetimes_all_7e.csv'}",
37
- f"-D predictorFiles={all_predictor_files}",
38
- ]
39
- )
40
- flight_predictor_data = " ".join(
41
- [
42
- f"-D msa_file={msa_file}",
43
- f"-D changeTimesFile={predictors_dir / 'changetimes_flights_4e.csv'}",
44
- f"-D predictorFiles={predictors_dir / 'flight_pop_x_4e_ls.csv'}",
45
- ]
46
- )
47
-
48
- for seed in range(1, 3):
49
- run_beast_cmd = [os.environ["BELLA_RUN_BEAST_CMD"], f"-seed {42 + seed}"]
50
-
51
- """
52
- os.makedirs(output_dir / "Nonparametric", exist_ok=True)
53
- submit_job(
54
- " ".join(
55
- [
56
- *run_beast_cmd,
57
- f"-D aligned_fasta={msa_file}",
58
- f"-prefix {output_dir / 'Nonparametric'}{os.sep}{seed}-",
59
- str(beast_configs_dir / "Nonparametric.xml"),
60
- ]
61
- ),
62
- base_log_dir / "Nonparametric" / str(seed),
63
- cpus=128,
64
- mem_per_cpu=12000,
65
- )
66
- """
67
- os.makedirs(output_dir / "all-predictors-GLM", exist_ok=True)
68
- submit_job(
69
- " ".join(
70
- [
71
- *run_beast_cmd,
72
- all_predictors_data,
73
- f"-prefix {output_dir / 'all-predictors-GLM'}{os.sep}{seed}-",
74
- str(beast_configs_dir / "GLM.xml"),
75
- ]
76
- ),
77
- base_log_dir / "all-predictors-GLM" / str(seed),
78
- cpus=128,
79
- mem_per_cpu=12000,
80
- )
81
- """
82
- os.makedirs(output_dir / "flights-GLM", exist_ok=True)
83
- submit_job(
84
- " ".join(
85
- [
86
- *run_beast_cmd,
87
- flight_predictor_data,
88
- f"-prefix {output_dir / 'flights-GLM'}{os.sep}{seed}-",
89
- str(beast_configs_dir / "GLM.xml"),
90
- ]
91
- ),
92
- base_log_dir / "flights-GLM" / str(seed),
93
- cpus=128,
94
- mem_per_cpu=12000,
95
- )
96
- """
97
-
98
- os.makedirs(output_dir / "all-predictors-MLP", exist_ok=True)
99
- submit_job(
100
- " ".join(
101
- [
102
- *run_beast_cmd,
103
- '-D layersRange="0,1,2",nodes="16 8"',
104
- all_predictors_data,
105
- f"-prefix {output_dir / 'all-predictors-MLP'}{os.sep}{seed}-",
106
- str(beast_configs_dir / "MLP.xml"),
107
- ]
108
- ),
109
- base_log_dir / "all-predictors-MLP" / str(seed),
110
- cpus=128,
111
- mem_per_cpu=12000,
112
- )
113
16
 
114
- """
115
- os.makedirs(output_dir / "flights-MLP", exist_ok=True)
17
+ for seed, model in product(range(3), ["GLM", "MLP"]):
18
+ extra_data = '-D layersRange="0,1,2",nodes="16 8"' if model == "MLP" else ""
19
+ os.makedirs(output_dir / model, exist_ok=True)
116
20
  submit_job(
117
21
  " ".join(
118
22
  [
119
- *run_beast_cmd,
120
- '-D layersRange="0,1,2",nodes="16 8"',
121
- flight_predictor_data,
122
- f"-prefix {output_dir / 'flights-MLP'}{os.sep}{seed}-",
123
- str(beast_configs_dir / "MLP.xml"),
23
+ os.environ["BELLA_RUN_BEAST_CMD"],
24
+ f"-seed {seed}",
25
+ f"-D msa_file={data_dir / 'msa.fasta'}",
26
+ f"-D changeTimesFile={data_dir / 'changetimes.csv'}",
27
+ f"-D flightsPredictorFile={data_dir / 'flights.csv'}",
28
+ extra_data,
29
+ f"-prefix {output_dir / model}{os.sep}{seed}-",
30
+ str(beast_configs_dir / f"{model}.xml"),
124
31
  ]
125
32
  ),
126
- base_log_dir / "flights-MLP" / str(seed),
33
+ base_log_dir / model / str(seed),
127
34
  cpus=128,
128
35
  mem_per_cpu=12000,
129
36
  )
130
- """
@@ -6,7 +6,7 @@ import joblib
6
6
  import matplotlib.pyplot as plt
7
7
  import numpy as np
8
8
  import polars as pl
9
- from lumiere.backend import relu, sigmoid
9
+ from bella_lumiere.backend import relu, sigmoid
10
10
 
11
11
  from bella_companion.simulations.scenarios.epi_multitype import (
12
12
  MIGRATION_PREDICTOR,
@@ -6,7 +6,7 @@ import joblib
6
6
  import matplotlib.pyplot as plt
7
7
  import numpy as np
8
8
  import polars as pl
9
- from lumiere.backend import relu, sigmoid
9
+ from bella_lumiere.backend import relu, sigmoid
10
10
 
11
11
  from bella_companion.simulations.figures.utils import step
12
12
  from bella_companion.simulations.scenarios.fbd_2traits import (
@@ -7,9 +7,9 @@ from typing import Any
7
7
  import arviz as az
8
8
  import numpy as np
9
9
  import polars as pl
10
+ from bella_lumiere import read_log_file, read_weights
11
+ from bella_lumiere.typing import Weights
10
12
  from joblib import Parallel, delayed
11
- from lumiere import read_log_file, read_weights
12
- from lumiere.typing import Weights
13
13
  from tqdm import tqdm
14
14
 
15
15
  from bella_companion.utils.slurm import get_job_metadata
@@ -1,13 +1,15 @@
1
1
  import os
2
2
  from functools import partial
3
+ from itertools import product
3
4
  from pathlib import Path
4
5
 
5
6
  import matplotlib.pyplot as plt
6
7
  import numpy as np
7
8
  import seaborn as sns
9
+ from bella_lumiere import get_partial_dependence_values
10
+ from bella_lumiere.typing import ActivationFunction, Weights
8
11
  from joblib import Parallel, delayed
9
- from lumiere import get_partial_dependence_values
10
- from lumiere.typing import ActivationFunction, ArrayLike, Weights
12
+ from numpy.typing import ArrayLike
11
13
  from tqdm import tqdm
12
14
 
13
15
  import bella_companion.utils.explain.typeguards as tg
@@ -24,6 +26,7 @@ def _get_median_partial_dependence_values(
24
26
  pdvalues = [
25
27
  get_partial_dependence_values(
26
28
  weights=w,
29
+ inputs=inputs,
27
30
  features_grid=features_grid,
28
31
  hidden_activation=hidden_activation,
29
32
  output_activation=output_activation,
@@ -42,6 +45,7 @@ def plot_partial_dependencies(
42
45
  output_dir: str | Path,
43
46
  hidden_activation: ActivationFunction,
44
47
  output_activation: ActivationFunction,
48
+ inputs: ArrayLike | None = None,
45
49
  ):
46
50
  output_dir = Path(output_dir)
47
51
  os.makedirs(output_dir, exist_ok=True)
@@ -51,6 +55,8 @@ def plot_partial_dependencies(
51
55
  [0, 1] if feature.is_binary else continuous_grid
52
56
  for feature in features.values()
53
57
  ]
58
+ if inputs is None:
59
+ inputs = list(product(*features_grid))
54
60
 
55
61
  if tg.is_weights_list(weights):
56
62
  func = get_partial_dependence_values
@@ -65,6 +71,7 @@ def plot_partial_dependencies(
65
71
  delayed(
66
72
  partial(
67
73
  func,
74
+ inputs=inputs,
68
75
  features_grid=features_grid,
69
76
  hidden_activation=hidden_activation,
70
77
  output_activation=output_activation,
@@ -99,11 +106,11 @@ def plot_partial_dependencies(
99
106
  plt.plot( # pyright: ignore
100
107
  continuous_grid, median, color=feature.color, label=label
101
108
  )
102
- plt.xlabel("Feature value") # pyright: ignore
103
- plt.ylabel("MLP Output") # pyright: ignore
104
- plt.legend() # pyright: ignore
105
- plt.savefig(output_dir / "PDPs-continuous.svg") # pyright: ignore
106
- plt.close()
109
+ plt.xlabel("Feature value") # pyright: ignore
110
+ plt.ylabel("MLP Output") # pyright: ignore
111
+ plt.legend() # pyright: ignore
112
+ plt.savefig(output_dir / f"PDPs-continuous-{label}.svg") # pyright: ignore
113
+ plt.close()
107
114
 
108
115
  if any(f.is_binary for f in features.values()):
109
116
  data: list[float] = []
@@ -6,9 +6,9 @@ from typing import Callable
6
6
  import matplotlib.pyplot as plt
7
7
  import numpy as np
8
8
  import seaborn as sns
9
+ from bella_lumiere import get_shap_features_importance
10
+ from bella_lumiere.typing import ActivationFunction, Array, Weights
9
11
  from joblib import Parallel, delayed
10
- from lumiere import get_shap_features_importance
11
- from lumiere.typing import ActivationFunction, Array, Weights
12
12
  from numpy.typing import ArrayLike
13
13
  from tqdm import tqdm
14
14
 
@@ -68,13 +68,15 @@ def plot_shap_features_importance(
68
68
  output_file: str | Path,
69
69
  hidden_activation: ActivationFunction,
70
70
  output_activation: ActivationFunction,
71
+ inputs: ArrayLike | None = None,
71
72
  ):
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))
73
+ if inputs is None:
74
+ continuous_grid: list[float] = np.linspace(0, 1, 10).tolist()
75
+ features_grid: list[list[float]] = [
76
+ [0, 1] if feature.is_binary else continuous_grid
77
+ for feature in features.values()
78
+ ]
79
+ inputs = list(product(*features_grid))
78
80
 
79
81
  if tg.is_weights_list(weights):
80
82
  func = get_shap_features_importance
@@ -1,7 +1,7 @@
1
1
  from typing import Any, TypeGuard
2
2
 
3
3
  import numpy as np
4
- from lumiere.typing import Weights
4
+ from bella_lumiere.typing import Weights
5
5
 
6
6
 
7
7
  def is_list(obj: Any) -> TypeGuard[list[Any]]:
@@ -1,12 +1,15 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.3
2
2
  Name: bella-companion
3
- Version: 0.0.48
3
+ Version: 0.1.2
4
4
  Summary: Bayesian Evolutionary Layered Learning Architectures (BELLA) companion
5
- Requires-Python: >=3.10
6
- Description-Content-Type: text/markdown
5
+ Author: gabriele-marino
6
+ Author-email: gabriele-marino <gabmarino.8601@gmail.com>
7
7
  Requires-Dist: arviz>=0.22.0
8
- Requires-Dist: bella-lumiere>=0.0.19
8
+ Requires-Dist: bella-lumiere>=0.1.0
9
9
  Requires-Dist: dotenv>=0.9.9
10
10
  Requires-Dist: phylogenie>=3.1.4
11
11
  Requires-Dist: poetry>=2.2.1
12
12
  Requires-Dist: seaborn>=0.13.2
13
+ Requires-Python: >=3.10
14
+ Description-Content-Type: text/markdown
15
+
@@ -0,0 +1,63 @@
1
+ bella_companion/BELLA.jar,sha256=4mKDzPfz263rTqA9KS2f4Mc-UWGMuj8G48ZDonKSqVw,67408597
2
+ bella_companion/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
+ bella_companion/cli.py,sha256=CrtV2CG6G1nKCCVu02gtNlpHNJHLnFtSaru-LFiHKKc,3014
4
+ bella_companion/eucovid/__init__.py,sha256=09Ld_G7fZvCDCgEWsmaOyLVQ8pFc9QHAGnXKJ9Zm2AM,81
5
+ bella_companion/eucovid/beast_configs/GLM.xml,sha256=-SZWxJgJdBthp132ckPpRGooKoYfKKREi6VV3pF22aY,11532
6
+ bella_companion/eucovid/beast_configs/MLP.xml,sha256=C2d-Mcjw44CLFL-pCYgYdbZb1bNR-6OUBtaLWLUt5AU,10539
7
+ bella_companion/eucovid/data/changetimes.csv,sha256=XEepIXKRwcKknJq4-ovKlorvCypGi67B8znuQ5f1LTg,60
8
+ bella_companion/eucovid/data/flights.csv,sha256=tMR9-tuGtC3rVABXUtNdV9irUX-9aCCVb_fwksHTn8U,1068
9
+ bella_companion/eucovid/data/msa.fasta,sha256=sWaVSINSJDDLjmwlpl31JWM5VnKF7yViSpERI69glQc,4839354
10
+ bella_companion/eucovid/run_beast.py,sha256=nWxB_weZgohMpMiEV_jQmWU79uGp_i767DbvQZ3Jj90,1330
11
+ bella_companion/features.py,sha256=xj0iwGHhLV_4jxLmG0M-jXWejuKVFJqpB0dK8Skc9n8,283
12
+ bella_companion/platyrrhine/__init__.py,sha256=gySgNPoKaEdhcZppKMsCmS-aAcYw_rDEw0viz72Udaw,259
13
+ bella_companion/platyrrhine/beast_config.xml,sha256=bLzavt-Zd8cmSgQQnlCBfZ9KyM7d1inOGx12VNjPFb4,7056
14
+ bella_companion/platyrrhine/data/change_times.csv,sha256=tedobHbaY7-6M3V6F6HSqGAU9dpeeajR5mu1XGJfp6w,68
15
+ bella_companion/platyrrhine/data/traits.csv,sha256=N_mCnaM9Gy0Qot7-l_mK0vMvr7e_5BZ4bgUHpcoG9UM,3949
16
+ bella_companion/platyrrhine/data/trees.nwk,sha256=lpSiGUG5s3zE--IKPOyWrJ5vpJb_xAPnfxychs3YNIs,488232
17
+ bella_companion/platyrrhine/results.py,sha256=aRx9MkI43f5bhr-16UkShDH-_oMNFzhHxfU2WK1L3BY,7468
18
+ bella_companion/platyrrhine/run_beast.py,sha256=t1gUmn_HEXKqxgGXYCdohGDWeL-QEpW7r3bKXlRfdog,2494
19
+ bella_companion/platyrrhine/summarize.py,sha256=Qc3GE2vUspTqU_QjLdULvK0r7AZ3JTdqsBmd71izt7M,1356
20
+ bella_companion/simulations/__init__.py,sha256=gjO_QB2wp335l7UO-zA9fFQ5vmZauGItBuO-QZFu93E,439
21
+ bella_companion/simulations/beast_configs/epi-multitype/GLM.xml,sha256=VymAYsaZVuB3EPE0DCQSXpKepVq8pPjKaB5yhEpaVkE,4334
22
+ bella_companion/simulations/beast_configs/epi-multitype/MLP.xml,sha256=AoJyjvVcwKtut64d7sB2gnnenx5sXyuTTNCivykUyqU,4077
23
+ bella_companion/simulations/beast_configs/epi-multitype/Nonparametric.xml,sha256=DfCMcLM53b-XP9oIiQ9wJWOVTEP3GnoZaL5BMzLLfIQ,3208
24
+ bella_companion/simulations/beast_configs/epi-skyline/GLM.xml,sha256=7LtJhU7o7aQsnWK7ZIKj-mzmHgCn_RjxvKKbLIlp1Go,3619
25
+ bella_companion/simulations/beast_configs/epi-skyline/MLP.xml,sha256=ptoLM0FLDp54bUSxPm12qIvOYWyBkWR1e9VWVWjgU8E,3426
26
+ bella_companion/simulations/beast_configs/epi-skyline/Nonparametric.xml,sha256=LTiatqeAMiFfdD1leQ5TrGaJhsYwlkbMDpxqhVFOgUQ,2561
27
+ bella_companion/simulations/beast_configs/fbd-2traits/GLM.xml,sha256=Iff0eAShKLeOnlTmNu6044Wljtla3yckqo2LZ7mP6LY,5897
28
+ bella_companion/simulations/beast_configs/fbd-2traits/MLP.xml,sha256=RvF70fcnvoBcJxjyT4nELlFm94atSZpKm9d1aS-cJZ4,5428
29
+ bella_companion/simulations/beast_configs/fbd-2traits/Nonparametric.xml,sha256=ev6ZfMeCwMyK54G_4O8g-tbgoxoD3asxt71x91Cb1QY,3618
30
+ bella_companion/simulations/beast_configs/fbd-no-traits/GLM.xml,sha256=Caq7Gxqx-wYAu3_YkMikVqni3DjBv1Wt00sc1Upo1X8,4743
31
+ bella_companion/simulations/beast_configs/fbd-no-traits/MLP.xml,sha256=JE_cGh2DW5yPAXyXXr0D3DlovmV-aIbze7qrhENHK3w,4275
32
+ bella_companion/simulations/beast_configs/fbd-no-traits/Nonparametric.xml,sha256=m2xaHZwskCFInvVY1QH1fwQqH6p_fgESlPX2BbBeUhk,2822
33
+ bella_companion/simulations/figures/__init__.py,sha256=LeHPeBb4vxJo0pxLZi_9s6iRBKvWC32yhAZBByqK2_8,590
34
+ bella_companion/simulations/figures/epi_multitype.py,sha256=ez-yCP_rs7J0CkfEjt4SFwaiI5T0r3GcLhUXjxc9F3M,2627
35
+ bella_companion/simulations/figures/epi_skyline.py,sha256=SyFOsb8dwLuoN5IOCiQbG-ZCPDS8Wua_LL-cOuLtu_s,1673
36
+ bella_companion/simulations/figures/fbd_2traits.py,sha256=MCzZLmVi-txEIk8Sdm3Tw6oUGMahnifzMuPzwaDw_sY,2726
37
+ bella_companion/simulations/figures/fbd_no_traits.py,sha256=-_c-qnrFAYZ7vd4Ieeb-uYA3VUwURfrcP11BN9PG8JY,1907
38
+ bella_companion/simulations/figures/scenarios.py,sha256=gbMz1TUxxT2RSIq2kQlFioNdgSHk-gQY2OQuf6-7Fww,2817
39
+ bella_companion/simulations/figures/utils.py,sha256=0M5OrxaEuqcj9rR2uAc_O7utQvhEceZGH0sKrGRWaWs,3129
40
+ bella_companion/simulations/generate_data.py,sha256=edfhXrs76hl30i_xizup4z6qgzXZyaDzX_PVC62Ytpw,849
41
+ bella_companion/simulations/generate_figures.py,sha256=r3zGKnLGDpuVzzWVQIumkt1sTMl_4w1iKnVNy-fTJAg,371
42
+ bella_companion/simulations/metrics.py,sha256=kSX7-B4a-LDm1V--S8CvEJDktlJ8qkpo_gY6V7XbOXw,1930
43
+ bella_companion/simulations/run_beast.py,sha256=-L5PHkpPK-NGQoXxmeH7LMIWxtodvL4TOo-KkR2ISVQ,3299
44
+ bella_companion/simulations/scenarios/__init__.py,sha256=3Kl1lKcFpfb3vLX64DmSW4XCF5kXU1ZoHtstFH-ZIzU,876
45
+ bella_companion/simulations/scenarios/common.py,sha256=_ddaSuTvEVdttGkXB4HPc2B7IB1F_GBOCW3cVOPZ-ZM,807
46
+ bella_companion/simulations/scenarios/epi_multitype.py,sha256=hgl2-m9gPm6OntnOZeRfquflbXFuu2Kt4RmKinSslYo,2427
47
+ bella_companion/simulations/scenarios/epi_skyline.py,sha256=iLwsGw-DZK8QOIGhMRUyvFRDEwFrksSx46s2DB6sr0U,2353
48
+ bella_companion/simulations/scenarios/fbd_2traits.py,sha256=-BNJMx-4GGW32IaTDxwVOHs2ZW7z781GJn-tMycygcI,3529
49
+ bella_companion/simulations/scenarios/fbd_no_traits.py,sha256=OsJP2bJVswLgeerXSM0ULKnj5_lxRVHCCoENjs_fWPM,2508
50
+ bella_companion/simulations/scenarios/scenario.py,sha256=oV9yxxD_De5YdCLbAwIFLmiRXqOaoflJjTIkY2yu5M8,608
51
+ bella_companion/simulations/summarize.py,sha256=hfYpgmv2irD8wNQ-GYtJA324w94SKoYhx0bpDG2bb3w,1207
52
+ bella_companion/utils/__init__.py,sha256=Ehu8rgO6T2ie_BHW25I0-huoBIHPtknkHYvoUr-37BY,446
53
+ bella_companion/utils/beast.py,sha256=18LAAFkZeIvOGdA3VfTEjQxZKzDBW93OixGtMNZrRxU,2196
54
+ bella_companion/utils/explain/__init__.py,sha256=ksk8HWIpdiMhT4lW7H_05p_s44ihMiHHNM2TJGO9vz4,234
55
+ bella_companion/utils/explain/pdp.py,sha256=z7PhwnERDUnsM1XzYq971pjxadbgBhhaO7ZOwY0fKuM,5125
56
+ bella_companion/utils/explain/shap.py,sha256=ueCymQiVOcLIBy_Pf0yq7aOlI8ATehzhoxnBPYk8r0Y,3453
57
+ bella_companion/utils/explain/typeguards.py,sha256=U6N_lBosmXqFAiakB3zkjlHXzKd16e_cYkHLh76SSFY,591
58
+ bella_companion/utils/slurm.py,sha256=xEyf-Jxk8fy71t3fko_Ic9WtUFSdLFE3w4tR17gaBPw,1868
59
+ bella_companion/version.xml,sha256=Gr3nsYqFhVNP0Mszl_IfilxefsPN8ZpQlGlB8OJSwnE,522
60
+ bella_companion-0.1.2.dist-info/WHEEL,sha256=M6du7VZflc4UPsGphmOXHANdgk8zessdJG0DBUuoA-U,78
61
+ bella_companion-0.1.2.dist-info/entry_points.txt,sha256=Jmns5P9G0EXcV26VD5Na81SD2Fri_SiUISy9Rfz5ZYI,52
62
+ bella_companion-0.1.2.dist-info/METADATA,sha256=TqVhcmS0vcFs_Kz7OnUZawRbZNYBeh3auncLg5grmWI,472
63
+ bella_companion-0.1.2.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: uv 0.9.5
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -1,2 +1,3 @@
1
1
  [console_scripts]
2
2
  bella = bella_companion.cli:main
3
+