Skip to content

Commit

Permalink
Automatic params table can now handle priors
Browse files Browse the repository at this point in the history
  • Loading branch information
romain-ragonnet committed Jul 17, 2023
1 parent 2a2055e commit 606cc7b
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,29 @@
"cells": [
{
"cell_type": "code",
"execution_count": 110,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from autumn.projects.sm_covid2.common_school.project_maker import get_school_project_parameter_set\n",
"from autumn.projects.sm_covid2.common_school.calibration import get_bcm_object\n",
"import pandas as pd\n",
"from copy import copy\n",
"from pathlib import Path"
]
},
{
"cell_type": "code",
"execution_count": 111,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"bcm = get_bcm_object(\"FRA\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -23,7 +33,7 @@
},
{
"cell_type": "code",
"execution_count": 112,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -36,7 +46,7 @@
},
{
"cell_type": "code",
"execution_count": 113,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -51,7 +61,7 @@
},
{
"cell_type": "code",
"execution_count": 114,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -68,7 +78,7 @@
},
{
"cell_type": "code",
"execution_count": 115,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -77,14 +87,20 @@
"\n",
" for index in params_df.index:\n",
" if params_df.loc[index, 'value'] == \"LOAD\":\n",
" params_df.loc[index, 'value'] = get_param_val(params_df.loc[index, 'param_key'], model_params)\n",
" p_name = params_df.loc[index, 'param_key']\n",
" if p_name in bcm.priors:\n",
" p = bcm.priors[p_name]\n",
" displayed_value = p.__repr__().replace(\"UniformPrior bounds:\", \"Uniform\")\n",
" else:\n",
" displayed_value = get_param_val(p_name, model_params)\n",
" params_df.loc[index, 'value'] = displayed_value\n",
"\n",
" return params_df"
]
},
{
"cell_type": "code",
"execution_count": 116,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -93,7 +109,7 @@
},
{
"cell_type": "code",
"execution_count": 117,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -106,7 +122,7 @@
},
{
"cell_type": "code",
"execution_count": 118,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -115,7 +131,7 @@
},
{
"cell_type": "code",
"execution_count": 119,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -124,7 +140,7 @@
},
{
"cell_type": "code",
"execution_count": 120,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand Down
Git LFS file not shown

0 comments on commit 606cc7b

Please sign in to comment.