Bayes analysis result
bayes_analysis_result
¶
Classes¶
BayesAnalysisResult
dataclass
¶
BayesAnalysisResult(
metadata: ToolResultMetadata = ToolResultMetadata(),
raw_samples: ndarray | None = None,
thin_number: int | None = None,
ndim: int | None = None,
processed_samples: ndarray | None = None,
posterior_predictive: (
DeconditionedDistribution | None
) = None,
lppd: float = None,
ml: float = None,
)
Bases: BaseResult
The result of a Bayesian inference.
Attributes¶
lppd
class-attribute
instance-attribute
¶
lppd: float = None
Twice the opposite of the lppd, a Bayesian validation criterion.
metadata
class-attribute
instance-attribute
¶
metadata: ToolResultMetadata = field(
default_factory=ToolResultMetadata
)
ToolResultMetadata attached to a result.
ml
class-attribute
instance-attribute
¶
ml: float = None
Twice the opposite of the log marginal likelihood, a Bayesian validation criterion.
ndim
class-attribute
instance-attribute
¶
ndim: int | None = None
The dimension of the calibration problem.
posterior_predictive
class-attribute
instance-attribute
¶
posterior_predictive: DeconditionedDistribution | None = (
None
)
The posterior predictive distribution useful to perform uncertainty propagation.
processed_samples
class-attribute
instance-attribute
¶
processed_samples: ndarray | None = None
The MCMC samples after burnin or thining.
raw_samples
class-attribute
instance-attribute
¶
raw_samples: ndarray | None = None
The MCMC samples without burnin or thining.
thin_number
class-attribute
instance-attribute
¶
thin_number: int | None = None
The thining number to ensure independency between the posterior samples.
Methods:¶
from_hdf5
classmethod
¶
from_hdf5(path: str | Path)
Deserialize from a file path.
Source code in src\vimseo\tools\base_result.py
92 93 94 95 96 | |
from_hdf5_buffer
classmethod
¶
from_hdf5_buffer(buffer: IOBase | bytes)
Deserialize from a file-like object or bytes (e.g. Streamlit uploader).
Source code in src\vimseo\tools\base_result.py
98 99 100 101 102 103 104 105 106 | |
save_metadata_to_disk
¶
save_metadata_to_disk(file_path: Path | str = '')
Save metadata to disk in a readable format.
Source code in src\vimseo\tools\base_result.py
118 119 120 121 122 123 124 | |
to_hdf5
¶
to_hdf5(path: str | Path) -> None
Serialize a BaseResult into an HDF5 file.
The file can be explored with an on-line reader, like https://myhdf5.hdfgroup.org/. For more information about hdf5, see HDF5 documentation.
Source code in src\vimseo\tools\base_result.py
70 71 72 73 74 75 76 77 78 79 80 | |
to_hdf5_buffer
¶
to_hdf5_buffer() -> BytesIO
Serialize a BaseResult into an HDF5 buffer.
Source code in src\vimseo\tools\base_result.py
82 83 84 85 86 87 88 89 90 | |
to_pickle
¶
to_pickle(file_path: str | Path)
Save result instance to disk.
Source code in src\vimseo\tools\base_result.py
64 65 66 67 | |
PosteriorChecks
dataclass
¶
PosteriorChecks(result: BayesAnalysisResult)
Source code in src\vimseo\tools\bayes\bayes_analysis_result.py
75 76 77 78 79 80 81 82 83 | |
Attributes¶
lppd
instance-attribute
¶
lppd: float = result.lppd
Twice the opposite of the lppd, a Bayesian validation criterion.
ml
instance-attribute
¶
ml: float = result.ml
Twice the opposite of the log marginal likelihood, a Bayesian validation criterion.
model
instance-attribute
¶
model: str = result.metadata.settings['likelihood_dist']
The model whose results are to be plotted.
posterior_predictive
instance-attribute
¶
posterior_predictive: DeconditionedDistribution = (
result.posterior_predictive
)
The posterior predictive distribution useful to perform uncertainty propagation.