GammaGammaModelIndividual.save#

GammaGammaModelIndividual.save(fname, **kwargs)#

Save the model’s inference data to a file.

Parameters:
fnamestr

The name and path of the file to save the inference data with model parameters.

**kwargs

Additional keyword arguments to pass to arviz.InferenceData.to_netcdf(). Common options include: - engine : str, optional (default “netcdf4”)

Library to use for writing files.

  • groupslist of str, optional

    Groups to save to netcdf. If None, all groups are saved.

Returns:
None
Raises:
RuntimeError

If the model hasn’t been fit yet (no inference data available).

Examples

This method is meant to be overridden and implemented by subclasses. It should not be called directly on the base abstract class or its instances.

>>> class MyModel(ModelBuilder):
>>>     def __init__(self):
>>>         super().__init__()
>>> model = MyModel()
>>> model.fit(X, y)
>>> # Basic save
>>> model.save("model_results.nc")
>>>
>>> # Save with specific options
>>> model.save(
...     "model_results.nc",
...     engine="netcdf4",
...     groups=["posterior", "log_likelihood"],
... )