Stan-to-TFP translators?

27 views
Skip to first unread message

Mike Lawrence

unread,
Mar 23, 2022, 9:39:02 AMMar 23
to TensorFlow Probability
Hey folks,

Long-time Stan user here, with current needs to add Bayes to a mobile app. I know one route would be to use TFP and TFLite to make a binary that would be deployable (ex. in a Unity app), but I come from a scientific/academic background, so learning a new PPL (and, frankly, TF's approach which I find rather opaque from my largely functional programming mindset) is somewhat daunting. I just learned of a Stan-to-NumPyro translator, which might be one avenue for me, but I thought I should also check if there might be any Stan-to-TFP translators I should look at as well. Any thoughts?

Mike


Junpeng Lao

unread,
Mar 26, 2022, 4:56:22 AMMar 26
to TensorFlow Probability, mike....@gmail.com
Hi Mike,

There is https://github.com/adamhaber/stan2tfp but there is not much development recently. My recommendation is to rewrite the Stan model into TFP with one of the jointdistribution API.

Mike Lawrence

unread,
Mar 27, 2022, 8:34:51 AMMar 27
to Junpeng Lao, TensorFlow Probability
Excellent, thanks! Ultimately I know I really should aim at learni bc TFP, particularly as I’m eventually looking to do sequential updates (something that’s still on the horizon for Stan). Looking at the available distributions in stan2tfp I don’t see anything obviously missing for my batched inference needs, so it might do the trick in the interim and certainly provides a useful tool for my TFP learning (i.e. makes it easy for me to make a stan model I understand & see how it would be implemented in TFP). 
--

--
Mike Lawrence, PhD
Co-founder & Research Scientist
Axem Neurotechnology
axemneuro.com

~ Certainty is (usually) folly ~

Brian Patton 🚀

unread,
Mar 28, 2022, 9:13:05 AMMar 28
to Mike Lawrence, Junpeng Lao, TensorFlow Probability
One thing to note is that if you have loops in your stan code, e.g. to index independent variables having the same distribution family with different parameters, you might get more performant code in TFP (than what you get from stan2tfp) by explicitly writing the vectorized version.


Brian Patton | Software Engineer | b...@google.com




--
You received this message because you are subscribed to the Google Groups "TensorFlow Probability" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tfprobabilit...@tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/tfprobability/CAB%2BQPJA8dpcjJQSqOvR57Eo%2BPcmjjM4ZKvjt%2B_6%3DDbH9Qn31OQ%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages