Skip to content

Commit

Permalink
[Missing Data pymc-devs#461] removed extra # comments
Browse files Browse the repository at this point in the history
Signed-off-by: Nathaniel <[email protected]>
  • Loading branch information
NathanielF committed Feb 3, 2023
1 parent 6eea76e commit 411b2be
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions examples/case_studies/Missing_Data_Imputation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,7 @@
"\n",
"\n",
"sensitivity = {}\n",
"n_missing = np.linspace(30, 100, 5) ## Change or alter the range as desired\n",
"n_missing = np.linspace(30, 100, 5) # Change or alter the range as desired\n",
"bootstrap_iterations = 100 # change to large number running a real analysis in this case\n",
"for n in n_missing:\n",
" sensitivity[int(n)] = {}\n",
Expand Down Expand Up @@ -8629,27 +8629,27 @@
"\n",
"with pm.Model(coords=coords) as hierarchical_model:\n",
"\n",
" ## Priors\n",
" # Priors\n",
" company_beta_lmx = pm.Normal(\"company_beta_lmx\", 0, 1)\n",
" company_beta_male = pm.Normal(\"company_beta_male\", 0, 1)\n",
" company_alpha = pm.Normal(\"company_alpha\", 20, 2)\n",
" team_alpha = pm.Normal(\"team_alpha\", 0, 1, dims=\"team\")\n",
" team_beta_lmx = pm.Normal(\"team_beta_lmx\", 0, 1, dims=\"team\")\n",
" sigma = pm.HalfNormal(\"sigma\", 4, dims=\"employee\")\n",
"\n",
" ## Imputed Predictors\n",
" # Imputed Predictors\n",
" mu_lmx = pm.Normal(\"mu_lmx\", 10, 5)\n",
" sigma_lmx = pm.HalfNormal(\"sigma_lmx\", 5)\n",
" lmx_pred = pm.Normal(\"lmx_pred\", mu_lmx, sigma_lmx, observed=df_employee[\"lmx\"].values)\n",
"\n",
" ## Combining Levels\n",
" # Combining Levels\n",
" alpha_global = pm.Deterministic(\"alpha_global\", company_alpha + team_alpha[team_idx])\n",
" beta_global_lmx = pm.Deterministic(\n",
" \"beta_global_lmx\", company_beta_lmx + team_beta_lmx[team_idx]\n",
" )\n",
" beta_global_male = pm.Deterministic(\"beta_global_male\", company_beta_male)\n",
"\n",
" ## Likelihood\n",
" # Likelihood\n",
" mu = pm.Deterministic(\n",
" \"mu\",\n",
" alpha_global + beta_global_lmx * lmx_pred + beta_global_male * df_employee[\"male\"].values,\n",
Expand Down
10 changes: 5 additions & 5 deletions examples/case_studies/Missing_Data_Imputation.myst.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ data_200.reset_index(inplace=True, drop=True)
sensitivity = {}
n_missing = np.linspace(30, 100, 5) ## Change or alter the range as desired
n_missing = np.linspace(30, 100, 5) # Change or alter the range as desired
bootstrap_iterations = 100 # change to large number running a real analysis in this case
for n in n_missing:
sensitivity[int(n)] = {}
Expand Down Expand Up @@ -708,27 +708,27 @@ coords = {"team": teams, "employee": np.arange(len(df_employee))}
with pm.Model(coords=coords) as hierarchical_model:
## Priors
# Priors
company_beta_lmx = pm.Normal("company_beta_lmx", 0, 1)
company_beta_male = pm.Normal("company_beta_male", 0, 1)
company_alpha = pm.Normal("company_alpha", 20, 2)
team_alpha = pm.Normal("team_alpha", 0, 1, dims="team")
team_beta_lmx = pm.Normal("team_beta_lmx", 0, 1, dims="team")
sigma = pm.HalfNormal("sigma", 4, dims="employee")
## Imputed Predictors
# Imputed Predictors
mu_lmx = pm.Normal("mu_lmx", 10, 5)
sigma_lmx = pm.HalfNormal("sigma_lmx", 5)
lmx_pred = pm.Normal("lmx_pred", mu_lmx, sigma_lmx, observed=df_employee["lmx"].values)
## Combining Levels
# Combining Levels
alpha_global = pm.Deterministic("alpha_global", company_alpha + team_alpha[team_idx])
beta_global_lmx = pm.Deterministic(
"beta_global_lmx", company_beta_lmx + team_beta_lmx[team_idx]
)
beta_global_male = pm.Deterministic("beta_global_male", company_beta_male)
## Likelihood
# Likelihood
mu = pm.Deterministic(
"mu",
alpha_global + beta_global_lmx * lmx_pred + beta_global_male * df_employee["male"].values,
Expand Down

0 comments on commit 411b2be

Please sign in to comment.