latents.tracking#

Base classes for fit tracking infrastructure.

Classes

FitTracker

Base class for quantities tracked during a model fit.

FitFlags

Status flags from a model fit.


class FitTracker(
lb: ndarray | None = None,
iter_time: ndarray | None = None,
lb_base: float | None = None,
)[source]#

Base class for quantities tracked during a model fit.

Parameters:
lbndarray of float, shape (num_iter,) or None, default None

Variational lower bound at each iteration.

iter_timendarray of float, shape (num_iter,) or None, default None

Runtime on each iteration.

lb_basefloat or None, default None

Baseline lower bound for convergence checking. Set during initial iterations of a fresh fit and preserved during resume.

Attributes:
lbndarray of float, shape (num_iter,) or None

Variational lower bound at each iteration.

iter_timendarray of float, shape (num_iter,) or None

Runtime on each iteration.

lb_basefloat or None

Baseline lower bound for convergence checking.

Examples

Access via a fitted model:

>>> model.fit(Y)
>>> model.tracker.plot_lb()      # Plot convergence
>>> model.tracker.plot_runtime() # Plot cumulative runtime
plot_lb() None[source]#

Plot the variational lower bound each iteration.

plot_runtime() None[source]#

Plot the runtime at each iteration.

class FitFlags(
converged: bool = False,
decreasing_lb: bool = False,
private_var_floor: bool = False,
)[source]#

Status flags from a model fit.

Parameters:
convergedbool, default False

True if the lower bound converged before reaching max_iter.

decreasing_lbbool, default False

True if lower bound decreased during fitting.

private_var_floorbool, default False

True if the private variance floor was used on any values of phi.

Examples

Access via a fitted model:

>>> model.fit(Y)
>>> model.flags.display()  # Print status summary