Open LukasHats opened 3 weeks ago
Hi @LukasHats, this is because CellCharter uses a slightly modified version of trVAE (I just removed the last ReLU layer). So you always have to use CellCharter's implementation for training. This means running:
`trvae = cc.tl.TRVAE( adata=adata, condition_key=condition_key, conditions=conditions, recon_loss='mse', use_mmd=False, )
trvae.train( n_epochs=trvae_epochs, alpha_epoch_anneal=200, early_stopping_kwargs=early_stopping_kwargs, enable_progress_bar=True,
)`
I will add trVAE's implementation to CellCharter's documentation and clarify this aspect! Thank you for pointing it out :)
Ah that makes sense! Thanks for the quick solution. 2 more questions:
1) trVAE documentation states that mse
should be used on (log1p) normalized data, so I used that or in my case arcsinh. Would you say training the cc.tl.TRVAE
model should be done with that or the scaled data as you suggested?
2) If I would like to discover functional marker-based neighborhoods, i.e. metabolic markers without having cell type markers interfering with it, would it theoretically work to drop all markers but the metabolic markers from the adata and then run cellcharter? I guess the cluster stability might be problematic without strong celltype determining markers.
EDIT: if you do both scaling and normalization, I would normalize first and scale after, not the reverse!
Then I will try with and without scaling. Thanks for your input! I will leave this issue open so you can close it after adding the documentation :)
Report
Dear @marcovarrone ,
as suggested by you in the other issue I wanted to use trVAE for batch correction. However I get an Error when trying to load the saved trVAE. Here is my code. Its data from IMC
So Because of this issue I had to train with
use_mmd=False
Now I tried to load the model, but I get this Error:Any ideas on this? why do we have this additional
.0.
?I could circumvent this by directly using the
autok
object to transfer the latent adata object, however, I trained the trvAE on normalized (non-scaled) data and wanted to use it on the scaled data, as suggested by you. I trained it only on normalized data as trvae suggests that it should be trained on normalized data whenmse
is used. And I want to make sure I am not doing anything wrong here. Or should I also train it on scaled data?Thanks a lot (again) in advance! :)
Version information