Exemplo n.º 1
0
 def _ext_identity(samples):
     """Extracts the values of all latent variables."""
     res = collections.OrderedDict()
     res['avg_effect'] = util.get_columns(samples, r'^avg_effect$')[:, 0]
     res['log_stddev'] = util.get_columns(samples, r'^log_stddev$')[:, 0]
     res['school_effects'] = util.get_columns(samples,
                                              r'^school_effects\.\d+$')
     return res
 def _ext_identity(samples):
     """Extracts the values of all latent variables."""
     return {
         'innovation_noise_scale':
         util.get_columns(samples, r'^innovation_noise_scale$')[:, 0],
         'observation_noise_scale':
         util.get_columns(samples, r'^observation_noise_scale$')[:, 0],
         'locs':
         util.get_columns(samples, r'^loc\.\d+$')
     }
Exemplo n.º 3
0
 def _ext_identity(samples):
   """Extracts the values of all latent variables."""
   latents = util.get_columns(samples, r'^latents\.\d+\.\d+$')
   return {
       'innovation_scale': util.get_columns(samples,
                                            r'^innovation_scale$')[:, 0],
       'observation_scale': util.get_columns(samples,
                                             r'^observation_scale$')[:, 0],
       # Last two dimensions are swapped in Stan output.
       'latents': latents.reshape((-1, 3, 30)).swapaxes(1, 2)}
Exemplo n.º 4
0
 def _ext_identity(samples):
     """Extracts the values of all latent variables."""
     res = collections.OrderedDict()
     res['county_effect_mean'] = util.get_columns(
         samples, r'^county_effect_mean$')[:, 0]
     res['county_effect_scale'] = util.get_columns(
         samples, r'^county_effect_scale$')[:, 0]
     res['county_effect'] = util.get_columns(samples,
                                             r'^county_effect\[\d+\]$')
     res['weight'] = util.get_columns(samples, r'^weight\[\d+\]$')
     res['log_radon_scale'] = (util.get_columns(samples,
                                                r'^log_radon_scale$')[:, 0])
     return res
 def _ext_identity(samples):
     """Extracts the values of all latent variables."""
     res = collections.OrderedDict()
     res['mean_log_volatility'] = util.get_columns(
         samples, r'^mean_log_volatility$')[:, 0]
     res['white_noise_shock_scale'] = util.get_columns(
         samples, r'^white_noise_shock_scale$')[:, 0]
     res['persistence_of_volatility'] = util.get_columns(
         samples, r'^persistence$')[:, 0]
     res['log_volatility'] = util.get_columns(
         samples,
         r'^log_volatilities\[\d+\]$',
     )
     return res
Exemplo n.º 6
0
 def _ext_identity(samples):
     """Extracts all the parameters."""
     res = collections.OrderedDict()
     res['mean_student_ability'] = util.get_columns(
         samples,
         r'^mean_student_ability$',
     )[:, 0]
     res['student_ability'] = util.get_columns(
         samples,
         r'^student_ability\[\d+\]$',
     )
     res['question_difficulty'] = util.get_columns(
         samples,
         r'^question_difficulty\[\d+\]$',
     )
     return res
Exemplo n.º 7
0
 def _ext_identity(samples):
   """Extract all the parameters."""
   res = collections.OrderedDict()
   res['unscaled_weights'] = util.get_columns(
       samples,
       r'^unscaled_weights\[\d+\]$',
   )
   res['local_scales'] = util.get_columns(
       samples,
       r'^local_scales\[\d+\]$',
   )
   res['global_scale'] = util.get_columns(
       samples,
       r'^global_scale$',
   )[:, 0]
   return res
Exemplo n.º 8
0
 def _ext_identity(samples):
     """Extract all the parameters."""
     res = collections.OrderedDict()
     res['amplitude'] = util.get_columns(
         samples,
         r'^amplitude$',
     )[:, 0]
     res['length_scale'] = util.get_columns(
         samples,
         r'^length_scale$',
     )[:, 0]
     res['log_intensity'] = util.get_columns(
         samples,
         r'^log_intensity\.\d+$',
     )
     return res
 def _ext_identity(samples):
     """Extracts the values of all latent variables."""
     locs = util.get_columns(samples, r'^loc\.\d+$')
     return locs
Exemplo n.º 10
0
 def _ext_per_example_test_nll(samples):
     return util.get_columns(samples, r'^per_example_test_nll\[\d+\]$')
Exemplo n.º 11
0
 def _ext_test_nll(samples):
     return util.get_columns(samples, r'^test_nll$')[:, 0]
Exemplo n.º 12
0
 def _ext_identity(samples):
   """Extracts the values of all latent variables."""
   latents = util.get_columns(samples, r'^latents\.\d+\.\d+$')
   # Last two dimensions are swapped in Stan output.
   return latents.reshape((-1, 3, 30)).swapaxes(1, 2)
Exemplo n.º 13
0
 def _ext_identity(samples):
     return util.get_columns(samples, r'^weights\[\d+\]$')