tomodrgn.convergence#

Functions to aid estimation of model training convergence.

Functions

calc_ccs_alltoall_intraepoch

For each epoch in epochs, calculates the (auto-masked) correlation coefficient between each pair of volumes generated at that epoch.

calc_ccs_alltogroundtruth

For each epoch in epochs, calculates the (auto-masked) correlation coefficient between each tomoDRGN volume and each ground_truth volume.

calc_ccs_pairwise_epochs

For each successive pair of epochs in epochs, calculates the (auto-masked) correlation coefficient between the same particle's tomoDRGN-evaluated volume at those epochs.

calc_fscs_pairwise_epochs

For each successive pair of epochs in epochs, calculates the (auto-masked) FSC between the same particle's tomoDRGN-evaluated volume at those epochs.

calc_kld_two_gaussians

Compute the KLD between two gaussians with diagomal covariance.

calc_test_train_pair_volumes_cc_complement

Calculate the scale of heterogeneity among all volumes generated from test latent embeddings of the same particles in the same epoch

calc_test_train_pair_volumes_fscs

Calculate the FSC between volumes generated from test and train latent embeddings of the same particles in the same epoch.

encoder_latent_shifts

Calculates and plots various metrics characterizing the per-particle latent vectors between successive epochs ranging between 0 and final_epoch.

follow_candidate_particles

Plot how the labeled set of particles migrates within latent space at selected epochs over training.

fsc_referencevol_to_manyvols

Calculate the Fourier Shell Correlation (FSC) between one reference volume and many query volumes.

generate_test_train_pair_volumes

Select random particle indices and generate corresponding volumes using train-split images' latent embeddings and test-split latent embeddings.

plot_latent_pca

Calculates, saves, and plots PC1 vs PC2 for all particles' latent embeddings at selected epochs

plot_latent_umap

Calculates, plots, and saves UMAP embeddings of subset of particles' selected epochs' latent encodings

plot_loss

Plot the total loss, reconstruction loss, and KLD divergence per epoch.

sketch_via_umap_local_maxima

Sketch one epoch's latent space via local maxima finding to find dense neighborhoods of particles with similar embeddings as "well-supported" by the data