lace.Engine.diagnostics

Engine.diagnostics(name: str = 'score')

Get convergence diagnostics.

Parameters:

name (str) – ‘loglike’, ‘logprior’, or ‘score’ (default).

Returns:

Contains a column for the diagnostic for each state. Each row corresponds to an iteration of the Markov chain.

Return type:

polars.DataFrame

Examples

Get the state scores

>>> from lace.examples import Animals
>>> animals = Animals()
>>> diag = animals.diagnostics()
>>> diag.shape
(5000, 16)
>>> diag[:, :4]  
shape: (5_000, 4)
┌──────────────┬──────────────┬──────────────┬──────────────┐
│ score_0      ┆ score_1      ┆ score_2      ┆ score_3      │
│ ---          ┆ ---          ┆ ---          ┆ ---          │
│ f64          ┆ f64          ┆ f64          ┆ f64          │
╞══════════════╪══════════════╪══════════════╪══════════════╡
│ -2533.503142 ┆ -2531.11451  ┆ -2488.379725 ┆ -2527.653495 │
│ -2510.144546 ┆ -2519.318755 ┆ -2449.46579  ┆ -2529.866394 │
│ -2494.957427 ┆ -2527.118066 ┆ -2417.423267 ┆ -2518.054613 │
│ -2517.055318 ┆ -2534.235993 ┆ -2413.22879  ┆ -2523.029661 │
│ …            ┆ …            ┆ …            ┆ …            │
│ -1763.593686 ┆ -1601.3273   ┆ -1873.277623 ┆ -1767.766707 │
│ -1724.87438  ┆ -1648.269934 ┆ -1906.093392 ┆ -1809.921707 │
│ -1776.739292 ┆ -1670.216919 ┆ -1898.314835 ┆ -1756.702674 │
│ -1733.91896  ┆ -1665.882412 ┆ -1900.749398 ┆ -1750.687124 │
└──────────────┴──────────────┴──────────────┴──────────────┘