biogeme.bayesian_estimation.raw_bayesian_results module

Raw Bayesian estimation results built from ArviZ InferenceData (PyMC).

Michel Bierlaire Mon Oct 20 2025, 17:18:07

class biogeme.bayesian_estimation.raw_bayesian_results.RawBayesianResults(*, idata, model_name, log_like_name, number_of_observations, user_notes='', data_name='', beta_names=None, sampler=None, target_accept=None, run_time=None)[source]

Bases: object

Minimal, NetCDF-only container of Bayesian estimation results.

This class holds an ArviZ InferenceData (PyMC posterior, etc.) and a handful of metadata that cannot be robustly deduced from the InferenceData.

  • No YAML sidecar is produced.

  • All information is stored in a single NetCDF file via save().

  • To reload, use load() which reads both posterior and metadata from the same NetCDF file.

Stored metadata (beyond what can be inferred from idata):
  • model_name (str)

  • user_notes (str)

  • data_name (str)

  • beta_names (list[str]) # model free/fixed parameter names for reporting

  • sampler (str | None)

  • target_accept (float | None)

  • random_seed (int | None)

  • run_time (timedelta | None)

Parameters:
  • idata (az.InferenceData)

  • model_name (str)

  • log_like_name (str)

  • number_of_observations (int)

  • user_notes (str)

  • data_name (str)

  • beta_names (list[str] | None)

  • sampler (str | None)

  • target_accept (float | None)

  • run_time (timedelta | None)

property beta_names: list[str]
property chains: int
property data_name: str
property draws: int
property idata: InferenceData
classmethod load(cls, path)[source]

Load from a single NetCDF file written by save().

Metadata are read from idata.posterior.attrs, where they were stored by save(). No custom biogeme_meta group is used anymore.

Return type:

RawBayesianResults

Parameters:

path (str)

property log_like_name: str
property model_name: str
property number_of_observations: int
property run_time: timedelta | None
property sampler: str | None
save(path)[source]

Write a single NetCDF file with posterior + metadata.

Return type:

None

Parameters:

path (str)

property target_accept: float | None
to_dict()[source]
Return type:

dict

property user_notes: str