cellflow.training.PCADecodedMetrics

class cellflow.training.PCADecodedMetrics(ref_adata, metrics, metric_aggregations=None, log_prefix='pca_decoded_')[source]

Callback to compute metrics on decoded validation data during training

Parameters:
  • ref_adata (AnnData) – An AnnData object with the reference data containing adata.varm["X_mean"] and adata.varm["PCs"].

  • metrics (list[Literal['r_squared', 'mmd', 'sinkhorn_div', 'e_distance']]) – List of metrics to compute. Supported metrics are "r_squared", "mmd", "sinkhorn_div", and "e_distance".

  • metric_aggregations (list[Literal['mean', 'median']]) – List of aggregation functions to use for each metric. Supported aggregations are "mean" and "median".

  • log_prefix (str) – Prefix to add to the log keys.

Methods

on_log_iteration(valid_source_data, ...)

Called at each validation/log iteration to reconstruct the data and compute metrics on the reconstruction

on_train_begin(*args, **kwargs)

Called at the beginning of training.

on_train_end(valid_source_data, ...)

Called at the end of training to compute metrics