stanbkt.fits.MCMCFitOptions#

class stanbkt.fits.MCMCFitOptions(seed=None, extra_kwargs=<factory>, chains=4, parallel_chains=4, threads_per_chain=1, iter_warmup=1000, iter_sampling=1000, save_warmup=None, thin=None, adapt_delta=None, max_treedepth=None, show_progress=True, show_console=False)#

Bases: BaseFitOptions

Common options for cmdstanpy.CmdStanModel.sample().

Parameters:
  • chains (int) – Number of Markov chains.

  • parallel_chains (int) – Number of chains to run in parallel.

  • threads_per_chain (int) – Number of threads used per chain.

  • iter_warmup (int) – Warmup iterations per chain.

  • iter_sampling (int) – Sampling iterations per chain.

  • save_warmup (bool | None) – Whether to save warmup samples.

  • thin (int | None) – Thinning period.

  • seed (int | list[int] | None) – RNG seed (single seed or one seed per chain).

  • adapt_delta (float | None) – Target acceptance statistic for NUTS adaptation.

  • max_treedepth (int | None) – Maximum tree depth for NUTS.

  • show_progress (bool) – Whether to show sampling progress.

  • show_console (bool) – Whether to stream CmdStan console output.

  • extra_kwargs (dict[str, Any])

adapt_delta: float | None = None#
chains: int = 4#
extra_kwargs: dict[str, Any]#
classmethod from_dict(d)#

Create fit options from a dictionary.

Known dataclass fields are extracted and used for instantiation. Remaining keys are stored in extra_kwargs for CmdStanPy.

Parameters:

d (dict[str, Any]) – Dictionary containing fit options. Keys matching dataclass fields are assigned to those fields; remaining keys go to extra_kwargs.

Returns:

New instance of the fit options class with fields populated from dict.

Return type:

Self

iter_sampling: int = 1000#
iter_warmup: int = 1000#
max_treedepth: int | None = None#
parallel_chains: int = 4#
save_warmup: bool | None = None#
seed: int | list[int] | None = None#
show_console: bool = False#
show_progress: bool = True#
thin: int | None = None#
threads_per_chain: int = 1#
to_dict()#

Convert options to a CmdStanPy kwargs dictionary.

None values are removed so CmdStanPy can apply its own defaults.

Returns:

Flat kwargs dictionary for CmdStanPy APIs.

Return type:

dict[str, Any]