@@ -762,14 +762,15 @@ def sample_prior(prior, batch_size):
762762del embed_sub
763763
764764# %% [markdown]
765- # ### cVAE - change of pseudoinputs over training
765+ # ### VAMP - change of pseudoinputs over training
766766
767767# %%
768768pis = []
769769model = XXJointModel (adata = adata_training , prior = 'vamp' , n_prior_components = 100 ,
770770 pseudoinputs_data_init = True )
771771pis .append ([model .module .prior .u .detach ().cpu ().numpy (),
772772 model .module .prior .u_cov .detach ().cpu ().numpy ()])
773+ # Train for 1 epoch and see how PIs migrate
773774for i in range (20 ):
774775 model .train (max_epochs = 1 ,
775776 check_val_every_n_epoch = 1 ,
@@ -786,6 +787,7 @@ def sample_prior(prior, batch_size):
786787 model .module .prior .u_cov .detach ().cpu ().numpy ()])
787788
788789# %%
790+ # PIs are on level of data - thus they must be encoded to get them to latent space
789791pis_z = [model .module .encoder (x = torch .tensor (x ,device = model .module .device ),
790792 cov = torch .tensor (cov ,device = model .module .device )
791793 )['y_m' ].detach ().cpu ().numpy ()
@@ -808,7 +810,7 @@ def sample_prior(prior, batch_size):
808810embed_sub .obs ['species' ]= embed_sub .obs .system .map ({0 :'mm' ,1 :'hs' })
809811
810812# %%
811- # Pseudoinput and data sub embedding
813+ # Pseudoinput and data sub joint embedding
812814embed_sub_pin = sc .concat ([embed_sub ,embed_pis ],
813815 merge = 'unique' , join = 'outer' )
814816embed_sub_pin .obs ['input_type' ]= ['expr' ]* embed_sub .shape [0 ]+ \
0 commit comments