Example #1
0
 def test_io_function(self, data, eight_schools_params):
     inference_data = self.get_inference_data(  # pylint: disable=W0612
         data, eight_schools_params
     )
     assert hasattr(inference_data, "posterior")
     here = os.path.dirname(os.path.abspath(__file__))
     data_directory = os.path.join(here, "saved_models")
     filepath = os.path.join(data_directory, "io_function_testfile.nc")
     # az -function
     to_netcdf(inference_data, filepath)
     assert os.path.exists(filepath)
     assert os.path.getsize(filepath) > 0
     inference_data2 = from_netcdf(filepath)
     assert hasattr(inference_data2, "posterior")
     os.remove(filepath)
     assert not os.path.exists(filepath)
     # Test deprecated functions
     save_data(inference_data, filepath)
     assert os.path.exists(filepath)
     assert os.path.getsize(filepath) > 0
     inference_data3 = load_data(filepath)
     assert hasattr(inference_data3, "posterior")
     os.remove(filepath)
     assert not os.path.exists(filepath)
Example #2
0
"""
Joyplot
=======

_thumb: .8, .5
"""
import arviz as az

az.style.use('arviz-darkgrid')

non_centered_data = az.load_data('data/non_centered_eight.nc')
fig, axes = az.forestplot(non_centered_data,
                          kind='joyplot',
                          var_names=['theta'],
                          combined=True,
                          textsize=11,
                          joyplot_overlap=3,
                          colors='white',
                          r_hat=False,
                          n_eff=False)
axes[0].set_title('Estimated theta for eight schools model', fontsize=11)