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          │
╞══════════════╪══════════════╪══════════════╪══════════════╡
│ -2882.424453 ┆ -2809.0876   ┆ -2638.714156 ┆ -2604.137622 │
│ -2695.299327 ┆ -2666.497867 ┆ -2608.185358 ┆ -2576.545684 │
│ -2642.539971 ┆ -2532.638368 ┆ -2576.463401 ┆ -2568.516617 │
│ -2488.369418 ┆ -2513.134161 ┆ -2549.299382 ┆ -2554.131179 │
│ …            ┆ …            ┆ …            ┆ …            │
│ -1972.005746 ┆ -2122.788121 ┆ -1965.921104 ┆ -1969.328651 │
│ -1966.516529 ┆ -2117.398333 ┆ -1993.351756 ┆ -1986.589833 │
│ -1969.400394 ┆ -2147.941128 ┆ -1968.697139 ┆ -1988.805311 │
│ -1920.217666 ┆ -2081.368421 ┆ -1909.655836 ┆ -1920.432849 │
└──────────────┴──────────────┴──────────────┴──────────────┘