I was wondering how the get_latent_representation in SCVI RNA model is calculated. I tested the same function in PeakVI and I could confirm that the result from this function is the same when I use PEAKVI_model.module.z_encoder.encoder() followed by PEAKVI_model.module.z_encoder.mean_encoder(), but it’s not the case in SCVI. That says, the get_latent_representation of SCVI did not return the mean of the VAE bottleneck distribution?
By default, SCVI.get_latent_representation() returns the mean of the variational distribution which approximates the posterior distribution of the latent representation z_i for cell i.
If you specify the option give_mean = False, SCVI.get_latent_representation() will instead return a sample from the variational distribution.
Thanks, but did I use give_mean=True as default. The latent mean (mu of the latent distribution) calculated use the VAE module is not equal to the result from SCVI.get_latent_representation(give_mean=True) function.