Skip to content

Commit 8a460b9

Browse files
authored
Release v0.3.0
2 parents be0df58 + 83b68b1 commit 8a460b9

File tree

85 files changed

+4134
-3432
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+4134
-3432
lines changed

doc/analysis.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
Analysis
2+
========
3+
4+
After using PEtab Select to perform model selection, you may want to operate on all "good" calibrated models.
5+
The PEtab Select Python library provides some methods to help with this. Please request any missing methods.
6+
7+
See the Python API docs for the :class:`petab_select.Models` class, which provides some methods. In particular, :attr:`petab_select.Models.df` can be used
8+
to get a quick overview over all models, as a pandas dataframe.
9+
10+
Additionally, see the Python API docs for the :mod:`petab_select.analyze` module, which contains some methods to subset and group models,
11+
or compute "weights" (e.g. Akaike weights).
12+
13+
Model hashes
14+
^^^^^^^^^^^^
15+
16+
Model hashes are special objects in the library, that are generated from model-specific information that is unique within a single PEtab Select problem.
17+
18+
This means you can reconstruct the model given some model hash. For example, with this model hash `M1-000`, you can reconstruct the :class:`petab_select.ModelHash` from a string, then reconstruct the :class:`petab_select.Model`.
19+
20+
.. code-block:: language
21+
22+
ModelHash.from_hash("M1-000").get_model(petab_select_problem)
23+
24+
You can use this to get the uncalibrated version of a calibrated model.
25+
26+
.. code-block:: language
27+
28+
model.hash.get_model(petab_select_problem)

doc/api.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ petab-select Python API
77
:toctree: generated
88

99
petab_select
10+
petab_select.analyze
1011
petab_select.candidate_space
1112
petab_select.constants
1213
petab_select.criteria

doc/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
5959

6060
html_theme = "sphinx_rtd_theme"
61-
# html_static_path = ['_static']
61+
html_static_path = ["standard"]
6262
html_logo = "logo/logo-wide.svg"
6363

6464

doc/examples/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
These notebooks need to be run to see the output. Pre-computed output can be viewed in the documentation, at https://petab-select.readthedocs.io/en/stable/examples.html

doc/examples/calibrated_models/calibrated_models.yaml

Lines changed: 88 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -2,114 +2,142 @@
22
AICc: 37.97523003111246
33
NLLH: 17.48761501555623
44
estimated_parameters:
5-
sigma_x2: 4.462298385653177
6-
model_hash: M_0-000
7-
model_id: M_0-000
8-
model_subspace_id: M_0
5+
sigma_x2: 4.462298422134608
6+
iteration: 1
7+
model_hash: M-000
8+
model_id: M-000
9+
model_subspace_id: M
910
model_subspace_indices:
1011
- 0
1112
- 0
1213
- 0
1314
parameters:
14-
k1: 0
15-
k2: 0
15+
k1: 0.2
16+
k2: 0.1
1617
k3: 0
17-
petab_yaml: petab_problem.yaml
18-
predecessor_model_hash: virtual_initial_model
18+
model_subspace_petab_yaml: petab_problem.yaml
19+
predecessor_model_hash: virtual_initial_model-
1920
- criteria:
20-
AICc: -0.1754060811089051
21-
NLLH: -4.0877030405544525
21+
AICc: -0.17540608110890332
22+
NLLH: -4.087703040554452
2223
estimated_parameters:
2324
k3: 0.0
24-
sigma_x2: 0.12242920113658744
25-
model_hash: M_1-000
26-
model_id: M_1-000
27-
model_subspace_id: M_1
25+
sigma_x2: 0.12242920113658338
26+
iteration: 2
27+
model_hash: M-001
28+
model_id: M-001
29+
model_subspace_id: M
2830
model_subspace_indices:
2931
- 0
3032
- 0
31-
- 0
33+
- 1
3234
parameters:
3335
k1: 0.2
3436
k2: 0.1
3537
k3: estimate
36-
petab_yaml: petab_problem.yaml
37-
predecessor_model_hash: M_0-000
38+
model_subspace_petab_yaml: petab_problem.yaml
39+
predecessor_model_hash: M-000
3840
- criteria:
39-
AICc: -0.27451405630430337
40-
NLLH: -4.137257028152152
41+
AICc: -0.27451438069575573
42+
NLLH: -4.137257190347878
4143
estimated_parameters:
42-
k2: 0.10147827639089564
43-
sigma_x2: 0.12142256779953603
44-
model_hash: M_2-000
45-
model_id: M_2-000
46-
model_subspace_id: M_2
44+
k2: 0.10147824307890803
45+
sigma_x2: 0.12142219599557078
46+
iteration: 2
47+
model_hash: M-010
48+
model_id: M-010
49+
model_subspace_id: M
4750
model_subspace_indices:
4851
- 0
49-
- 0
52+
- 1
5053
- 0
5154
parameters:
5255
k1: 0.2
5356
k2: estimate
5457
k3: 0
55-
petab_yaml: petab_problem.yaml
56-
predecessor_model_hash: M_0-000
58+
model_subspace_petab_yaml: petab_problem.yaml
59+
predecessor_model_hash: M-000
5760
- criteria:
58-
AICc: -0.7053270517931587
59-
NLLH: -4.352663525896579
61+
AICc: -0.7053270766271886
62+
NLLH: -4.352663538313594
6063
estimated_parameters:
61-
k1: 0.20160888007873565
62-
sigma_x2: 0.11713858557052499
63-
model_hash: M_3-000
64-
model_id: M_3-000
65-
model_subspace_id: M_3
64+
k1: 0.20160925279667963
65+
sigma_x2: 0.11714017664827497
66+
iteration: 2
67+
model_hash: M-100
68+
model_id: M-100
69+
model_subspace_id: M
6670
model_subspace_indices:
67-
- 0
71+
- 1
6872
- 0
6973
- 0
7074
parameters:
7175
k1: estimate
7276
k2: 0.1
7377
k3: 0
74-
petab_yaml: petab_problem.yaml
75-
predecessor_model_hash: M_0-000
78+
model_subspace_petab_yaml: petab_problem.yaml
79+
predecessor_model_hash: M-000
7680
- criteria:
77-
AICc: 9.294672948206841
78-
NLLH: -4.352663525896579
81+
AICc: 9.294672923372811
82+
NLLH: -4.352663538313594
7983
estimated_parameters:
80-
k1: 0.20160888007873565
84+
k1: 0.20160925279667963
8185
k3: 0.0
82-
sigma_x2: 0.11713858557052499
83-
model_hash: M_5-000
84-
model_id: M_5-000
85-
model_subspace_id: M_5
86+
sigma_x2: 0.11714017664827497
87+
iteration: 3
88+
model_hash: M-101
89+
model_id: M-101
90+
model_subspace_id: M
8691
model_subspace_indices:
92+
- 1
8793
- 0
88-
- 0
89-
- 0
94+
- 1
9095
parameters:
9196
k1: estimate
9297
k2: 0.1
9398
k3: estimate
94-
petab_yaml: petab_problem.yaml
95-
predecessor_model_hash: M_3-000
99+
model_subspace_petab_yaml: petab_problem.yaml
100+
predecessor_model_hash: M-100
96101
- criteria:
97-
AICc: 7.852170288089528
98-
NLLH: -5.073914855955236
102+
AICc: 7.8521704398854
103+
NLLH: -5.0739147800573
99104
estimated_parameters:
100-
k1: 0.20924739987621038
101-
k2: 0.0859065470362628
102-
sigma_x2: 0.1038731029818225
103-
model_hash: M_6-000
104-
model_id: M_6-000
105-
model_subspace_id: M_6
105+
k1: 0.20924804320838675
106+
k2: 0.0859052351446815
107+
sigma_x2: 0.10386846319370771
108+
iteration: 3
109+
model_hash: M-110
110+
model_id: M-110
111+
model_subspace_id: M
106112
model_subspace_indices:
107-
- 0
108-
- 0
113+
- 1
114+
- 1
109115
- 0
110116
parameters:
111117
k1: estimate
112118
k2: estimate
113119
k3: 0
114-
petab_yaml: petab_problem.yaml
115-
predecessor_model_hash: M_3-000
120+
model_subspace_petab_yaml: petab_problem.yaml
121+
predecessor_model_hash: M-100
122+
- criteria:
123+
AICc: 35.94352968170024
124+
NLLH: -6.028235159149878
125+
estimated_parameters:
126+
k1: 0.6228488917665873
127+
k2: 0.020189424009226256
128+
k3: 0.0010850434974038557
129+
sigma_x2: 0.08859278245811462
130+
iteration: 4
131+
model_hash: M-111
132+
model_id: M-111
133+
model_subspace_id: M
134+
model_subspace_indices:
135+
- 1
136+
- 1
137+
- 1
138+
parameters:
139+
k1: estimate
140+
k2: estimate
141+
k3: estimate
142+
model_subspace_petab_yaml: petab_problem.yaml
143+
predecessor_model_hash: M-100
Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,2 @@
11
model_subspace_id petab_yaml k1 k2 k3
2-
M_0 petab_problem.yaml 0 0 0
3-
M_1 petab_problem.yaml 0.2 0.1 estimate
4-
M_2 petab_problem.yaml 0.2 estimate 0
5-
M_3 petab_problem.yaml estimate 0.1 0
6-
M_4 petab_problem.yaml 0.2 estimate estimate
7-
M_5 petab_problem.yaml estimate 0.1 estimate
8-
M_6 petab_problem.yaml estimate estimate 0
9-
M_7 petab_problem.yaml estimate estimate estimate
2+
M petab_problem.yaml 0.2;estimate 0.1;estimate 0

doc/examples/example_cli_famos.ipynb

Lines changed: 9 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
},
2323
{
2424
"cell_type": "code",
25-
"execution_count": 1,
25+
"execution_count": null,
2626
"id": "1f04dce0",
2727
"metadata": {},
2828
"outputs": [],
@@ -33,17 +33,19 @@
3333
"\n",
3434
"from example_cli_famos_helpers import (\n",
3535
" parse_summary_to_progress_list,\n",
36+
" petab_select_problem_yaml, # noqa: F401\n",
3637
")\n",
3738
"\n",
3839
"output_path = Path().resolve() / \"output_famos\"\n",
3940
"output_path_str = str(output_path)\n",
40-
"shutil.rmtree(output_path_str)\n",
41+
"if output_path.exists():\n",
42+
" shutil.rmtree(output_path_str)\n",
4143
"output_path.mkdir(exist_ok=False, parents=True)"
4244
]
4345
},
4446
{
4547
"cell_type": "code",
46-
"execution_count": 2,
48+
"execution_count": null,
4749
"id": "a81560e6",
4850
"metadata": {},
4951
"outputs": [],
@@ -108,72 +110,12 @@
108110
},
109111
{
110112
"cell_type": "code",
111-
"execution_count": 3,
113+
"execution_count": null,
112114
"id": "bb1a5144",
113115
"metadata": {},
114-
"outputs": [
115-
{
116-
"name": "stdout",
117-
"output_type": "stream",
118-
"text": [
119-
"Executing iteration 1\n",
120-
"Executing iteration 2\n",
121-
"Executing iteration 3\n",
122-
"Executing iteration 4\n",
123-
"Executing iteration 5\n",
124-
"Executing iteration 6\n",
125-
"Executing iteration 7\n",
126-
"Executing iteration 8\n",
127-
"Executing iteration 9\n",
128-
"Executing iteration 10\n",
129-
"Executing iteration 11\n",
130-
"Executing iteration 12\n",
131-
"Executing iteration 13\n",
132-
"Executing iteration 14\n",
133-
"Executing iteration 15\n",
134-
"Executing iteration 16\n",
135-
"Executing iteration 17\n",
136-
"Executing iteration 18\n",
137-
"Executing iteration 19\n"
138-
]
139-
},
140-
{
141-
"name": "stderr",
142-
"output_type": "stream",
143-
"text": [
144-
"/home/dilan/Documents/future_annex/model_selection/packages/petab_select/petab_select/candidate_space.py:376: RuntimeWarning: Model `model_subspace_1-0001011010010010` has been previously excluded from the candidate space so is skipped here.\n",
145-
" warnings.warn(\n"
146-
]
147-
},
148-
{
149-
"name": "stdout",
150-
"output_type": "stream",
151-
"text": [
152-
"Executing iteration 20\n",
153-
"Executing iteration 21\n",
154-
"Executing iteration 22\n",
155-
"Executing iteration 23\n",
156-
"Executing iteration 24\n",
157-
"Executing iteration 25\n",
158-
"Executing iteration 26\n",
159-
"Executing iteration 27\n",
160-
"Executing iteration 28\n",
161-
"Executing iteration 29\n",
162-
"Executing iteration 30\n",
163-
"Executing iteration 31\n",
164-
"Executing iteration 32\n",
165-
"Executing iteration 33\n",
166-
"Executing iteration 34\n",
167-
"Executing iteration 35\n",
168-
"Executing iteration 36\n",
169-
"Executing iteration 37\n",
170-
"Model selection has terminated.\n"
171-
]
172-
}
173-
],
116+
"outputs": [],
174117
"source": [
175118
"%%bash -s \"$petab_select_problem_yaml\" \"$output_path_str\"\n",
176-
"\n",
177119
"petab_select_problem_yaml=$1\n",
178120
"output_path_str=$2\n",
179121
"\n",
@@ -217,7 +159,7 @@
217159
},
218160
{
219161
"cell_type": "code",
220-
"execution_count": 4,
162+
"execution_count": null,
221163
"id": "93caf071",
222164
"metadata": {},
223165
"outputs": [],
@@ -227,7 +169,7 @@
227169
},
228170
{
229171
"cell_type": "code",
230-
"execution_count": 5,
172+
"execution_count": null,
231173
"id": "cb61d0f7",
232174
"metadata": {},
233175
"outputs": [],

0 commit comments

Comments
 (0)