Validation of Developer Guide codes for scVI implementation

Dear the authors of scvi-tools
Thank you for a great effort to make scvi-tools available.
Could you please revise the codes implementing the loss function in the following link:

I suspect that there were a few typos in the following lines of code, especially the parameters of the NegativeBinomial function (is total_counts = theta? what is the parameter total, why it’s assigned to nb_logits?)

term 1

    # the pytorch NB distribution uses a different parameterization
    # so we must apply a quick transformation (included in scvi-tools, but here we use the pytorch code)
    nb_logits = (px_rate + 1e-4).log() - (theta + 1e-4).log()
    log_lik = NegativeBinomial(**total_counts=theta, total=nb_logits**).log_prob(x).sum(dim=-1)

If possible, could you please explain a bit more detail about the calculation of nb_logits in the post?

Developer API is one of the outstanding features of scvi-tools. However, there seems to be not so many documents explaining how to use it effectively. Hope you have more posts about this in the near future.

Many thanks, and look forward to hearing from you!

I believe this is a bug. Thanks for raising this issue.

We will continue to improve the developer tutorials, so stay tuned!

1 Like

Thanks a lot for your feedback! I am looking forward to further updates/tutorials from you.