gfa.tracking#

Fit tracking and serialization for GFA models.

Classes

GFAFitTracker

Quantities tracked during a GFA model fit.

GFAFitFlags

Status flags from a GFA model fit.

GFAFitContext

Context passed to callbacks during GFA fitting.


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

Quantities tracked during a GFA model fit.

Attributes:
lbndarray of float, shape (num_iter,)

Variational lower bound at each iteration.

iter_timendarray of float, shape (num_iter,)

Runtime on each iteration.

lb_basefloat or None

Baseline lower bound for convergence checking.

class GFAFitFlags(
converged: bool = False,
decreasing_lb: bool = False,
private_var_floor: bool = False,
x_dims_removed: int = 0,
)[source]#

Status flags from a GFA 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.

x_dims_removedint, default 0

Number of latent dimensions removed due to low variance.

class GFAFitContext(
config: GFAFitConfig,
obs_hyperprior: ObsParamsHyperPrior,
obs_posterior: ObsParamsPosterior,
latents_posterior: LatentsPosteriorStatic,
tracker: GFAFitTracker,
flags: GFAFitFlags,
)[source]#

Context passed to callbacks during GFA fitting.

Provides read-only access to fitting state and a save() method for checkpointing. Checkpoints can be loaded via GFAModel.load().

Parameters:
configGFAFitConfig

Fitting configuration.

obs_hyperpriorObsParamsHyperPrior

Prior hyperparameters.

obs_posteriorObsParamsPosterior

Observation model posterior.

latents_posteriorLatentsPosteriorStatic

Latent variable posterior.

trackerGFAFitTracker

Fitting progress tracker.

flagsGFAFitFlags

Fitting status flags.