class_docstr: Hierarchical radon model with contextual effects.
  
  Radon is a radioactive gas that enters homes through contact points with the
  ground. It is a carcinogen that is the primary cause of lung cancer in
  non-smokers. Radon levels vary greatly from household to household.
  
  The EPA did a study of radon levels in 80,000 houses. Two important predictors
  are: 1. Measurement in the basement or the first floor (radon higher in
  basements) 2. County uranium level (positive correlation with radon levels)
  We will build a hierarchical model of radon measurements in houses, in which
  the hierarchy is households within each county. We will incorporate a
  contextual effect corresponding to the mean floor at which the measurement
  was taken, by county.
  
  ```none
  
  county_effect_mean ~ Normal(loc=0, scale=1)
  county_effect_scale ~ Uniform(low=0, high=100)
  for i in range(num_counties):
    county_effect[i] ~ Normal(loc=county_effect_mean,
                              scale=county_effect_scale)
  for j in range(3):
    weight[j] ~ Normal(loc=0, scale=1)
  log_radon_scale ~ Uniform(low=0, high=100)
  
  for k in range(num_houses):
    log_radon[k] ~ Normal(
        loc=log_uranium * weight[1]           # effect of soil uranium
            + floor * weight[2]               # effect of floor
            + floor_by_county * weight[3]     # effect of mean floor by county
            + county_effect[county[k]],       # effect of county
        scale=log_radon_scale)
  ```
  
  This model is based on an example from [1] and is the same as the Stan model
  at
  <https://mc-stan.org/users/documentation/case-studies/radon.html
  #Correlations-among-levels>.
  
  Initializing this model with a `halfnormal` value for `prior_scale` will
  construct a modified version of this model in which the scales for the prior
  are constructed with a `HalfNormal` distribution instead of a `Uniform`
  distribution.
  
  ```none
  
  county_effect_scale ~ HalfNormal(scale=1.)
  log_radon_scale ~ HalfNormal(scale=1.)
  
  ```
  
  #### References
  
  [1] Gelman, A., & Hill, J. (2007). Data Analysis Using Regression and
      Multilevel/Hierarchical Models (1st ed.). Cambridge University Press.
  [2] Stan Development Team. 2018. Stan Modeling Language Users Guide and
      Reference Manual, Version 2.18.0. http://mc-stan.org
class_docstr_tok: ["Hierarchical","radon","model","with","contextual","effects",".","Radon","is","a","radioactive","gas","that","enters","homes","through","contact","points","with","the","ground",".","It","is","a","carcinogen","that","is","the","primary","cause","of","lung","cancer","in","non-smokers",".","Radon","levels","vary","greatly","from","household","to","household",".","The","EPA","did","a","study","of","radon","levels","in","80,000","houses",".","Two","important","predictors","are",":","1",".","Measurement","in","the","basement","or","the","first","floor","(","radon","higher","in","basements",")","2",".","County","uranium","level","(","positive","correlation","with","radon","levels",")","We","will","build","a","hierarchical","model","of","radon","measurements","in","houses",",","in","which","the","hierarchy","is","households","within","each","county",".","We","will","incorporate","a","contextual","effect","corresponding","to","the","mean","floor","at","which","the","measurement","was","taken",",","by","county",".","``","`","none","county_effect_mean","~","Normal","(","loc=0",",","scale=1",")","county_effect_scale","~","Uniform","(","low=0",",","high=100",")","for","i","in","range","(","num_counties",")",":","county_effect","[","i","]","~","Normal","(","loc=county_effect_mean",",","scale=county_effect_scale",")","for","j","in","range","(","3",")",":","weight","[","j","]","~","Normal","(","loc=0",",","scale=1",")","log_radon_scale","~","Uniform","(","low=0",",","high=100",")","for","k","in","range","(","num_houses",")",":","log_radon","[","k","]","~","Normal","(","loc=log_uranium","*","weight","[","1","]","#","effect","of","soil","uranium","+","floor","*","weight","[","2","]","#","effect","of","floor","+","floor_by_county","*","weight","[","3","]","#","effect","of","mean","floor","by","county","+","county_effect","[","county","[","k","]","]",",","#","effect","of","county","scale=log_radon_scale",")","``","`","This","model","is","based","on","an","example","from","[","1","]","and","is","the","same","as","the","Stan","model","at","<","https",":","\/\/mc-stan.org\/users\/documentation\/case-studies\/radon.html","#","Correlations-among-levels",">",".","Initializing","this","model","with","a","`","halfnormal","`","value","for","`","prior_scale","`","will","construct","a","modified","version","of","this","model","in","which","the","scales","for","the","prior","are","constructed","with","a","`","HalfNormal","`","distribution","instead","of","a","`","Uniform","`","distribution",".","``","`","none","county_effect_scale","~","HalfNormal","(","scale=1",".",")","log_radon_scale","~","HalfNormal","(","scale=1",".",")","``","`","#","#","#","#","References","[","1","]","Gelman",",","A.",",","&","Hill",",","J",".","(","2007",")",".","Data","Analysis","Using","Regression","and","Multilevel\/Hierarchical","Models","(","1st","ed.",")",".","Cambridge","University","Press",".","[","2","]","Stan","Development","Team",".","2018",".","Stan","Modeling","Language","Users","Guide","and","Reference","Manual",",","Version","2.18.0.","http",":","\/\/mc-stan.org"]
code: def _log_likelihood(self, value):
      return self._train_log_likelihood_fn(value)
  
imports: import functools
  import tensorflow.compat.v2
  import tensorflow_probability
  from tensorflow_probability.python.internal import dtype_util
  from inference_gym.internal import data
  from inference_gym.targets import bayesian_model
  from inference_gym.targets import model
  from inference_gym.targets.ground_truth import radon_contextual_effects_indiana
  from inference_gym.targets.ground_truth import radon_contextual_effects_indiana_halfnormal
  from inference_gym.targets.ground_truth import radon_contextual_effects_minnesota
  from inference_gym.targets.ground_truth import radon_contextual_effects_minnesota_halfnormal
label_desc: Use image node_id 3 for calling the RadonContextualEffects obj's underlying member method code with example usage: obj._log_likelihood(value) and returns: self