@@ -141,7 +141,8 @@ def simulate_draw(theta, n):
141141
142142def analytical_beta_posterior(data, alpha0, beta0):
143143 """
144- Computes analytically the posterior distribution with beta prior parametrized by (alpha, beta)
144+ Computes analytically the posterior distribution
145+ with beta prior parametrized by (alpha, beta)
145146 given # num observations
146147
147148 Parameters
@@ -226,7 +227,8 @@ We will use the following priors:
226227``` {code-cell} ipython3
227228def TruncatedLogNormal_trans(loc, scale):
228229 """
229- Obtains the truncated log normal distribution using numpyro's TruncatedNormal and ExpTransform
230+ Obtains the truncated log normal distribution
231+ using numpyro's TruncatedNormal and ExpTransform
230232 """
231233 base_dist = ndist.TruncatedNormal(
232234 low=-jnp.inf, high=jnp.log(1), loc=loc, scale=scale
@@ -443,7 +445,8 @@ def show_prior(
443445
444446def set_model(model: BayesianInference, data):
445447 """
446- Define the probabilistic model by specifying prior, conditional likelihood, and data conditioning
448+ Define the probabilistic model by specifying prior,
449+ conditional likelihood, and data conditioning
447450 """
448451 theta = sample_prior(model)
449452 output = numpyro.sample(
@@ -455,7 +458,8 @@ def MCMC_sampling(
455458 model: BayesianInference, data, num_samples, num_warmup=1000
456459 ):
457460 """
458- Computes numerically the posterior distribution with beta prior parametrized by (alpha0, beta0)
461+ Computes numerically the posterior distribution
462+ with beta prior parametrized by (alpha0, beta0)
459463 given data using MCMC
460464 """
461465 data = jnp.array(data, dtype=float)
@@ -476,7 +480,8 @@ def MCMC_sampling(
476480# this is required by svi.run()
477481def beta_guide(model: BayesianInference, data):
478482 """
479- Defines the candidate parametrized variational distribution that we train to approximate posterior with numpyro
483+ Defines the candidate parametrized variational distribution
484+ that we train to approximate posterior with numpyro
480485 Here we use parameterized beta
481486 """
482487 alpha_q = numpyro.param("alpha_q", 10, constraint=nconstraints.positive)
@@ -488,7 +493,8 @@ def beta_guide(model: BayesianInference, data):
488493# similar with beta_guide()
489494def truncnormal_guide(model: BayesianInference, data):
490495 """
491- Defines the candidate parametrized variational distribution that we train to approximate posterior with numpyro
496+ Defines the candidate parametrized variational distribution
497+ that we train to approximate posterior with numpyro
492498 Here we use truncated normal on [0,1]
493499 """
494500 loc = numpyro.param("loc", 0.5, constraint=nconstraints.interval(0.0, 1.0))
@@ -638,10 +644,8 @@ class BayesianInferencePlot:
638644 a list of sample size
639645 BayesianInferenceClass : class.
640646 a class initiated using BayesianInference()
641-
642647 """
643648
644- """Enter Parameters for data generation and plotting"""
645649 theta: float
646650 N_list: list
647651 BayesianInferenceClass: BayesianInference
0 commit comments