# Differentiable programming for general Bayesian decision theory

It is my understanding that differentiable programming and thus libraries like TensorFlow (e.g. TFP) and JAX can be used to solve Bayesian decision theory problems where e.g. we have a probabilistic model of the loss we may incur based on a decision we need to make with information available. After all, these libraries should be able to help us optimize general and potentially large non-convex problems.

Broadly speaking, I'm referring to general problems of the form:

$$\underset{d}{\operatorname{argmin}} \mathrm{E}^\pi\left[L\left(\theta,d\right)| \text{D}\right]$$

where we have the standard notation:

• $$L$$ is the loss function
• $$\pi$$ is our prior over parameters of the model
• $$d$$ is the decision we are trying to make
• $$\text{D}$$ is our data or current knowledge

However, I haven't encountered yet any actual examples showing this particular connection where one flexibly defines the Loss function using probabilistic programming and optimize the decision problem via differentiable programming.

This may be because these libraries seem to be primarily geared towards learning from data and inference of model parameters. This is in contrast to e.g. optimizing the prices of items in a store, a portfolio in finance, or, say, the sample sizes for an expensive A/B/n test that are required be set a priori.

That said, there may be something else at play, perhaps the difficulty of solving the equation above for loss functions that can be much more general, and complex than e.g. NLL or 0/1 loss (MAP), gets in the way.

In other words, I'm wondering about the use of diff. programming today for optimizing general Bayesian Loss functions, i.e. using it for broader problems than just e.g. fitting a model, or running a PPL sampler per se, as in e.g. HMC for estimating model parameters (often a "standard" loss function), or obviously computing posteriors.

Can one actually fully model and solve these types of general problems today with e.g. TFP, JAX, PyTorch, etc? If not (or not so easily), why?

Perhaps motivated by the above, what type of software is otherwise available today to solve problems of the general form above, where the model and random variables can be specified flexibly via e.g. probabilistic programming?

• So, if I understand correctly, the problems you're interested in involve estimating uncertain/stochastic losses/rewards?
– jkm
Jan 11, 2020 at 18:42
• They minimize random losses that depend on a set of modeling random variables and the set of decision variables @jkm Jan 11, 2020 at 19:38
{"ft_lang_label":"__label__en","ft_lang_prob":0.8940182,"math_prob":0.981443,"size":2236,"snap":"2023-14-2023-23","text_gpt3_token_len":498,"char_repetition_ratio":0.10887097,"word_repetition_ratio":0.0,"special_character_ratio":0.21198569,"punctuation_ratio":0.12413793,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9939594,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-05-31T12:02:00Z\",\"WARC-Record-ID\":\"<urn:uuid:abaf391c-8f33-49c5-bc4b-ec9836270557>\",\"Content-Length\":\"154590\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:04f79976-bf69-4244-8c96-4b8b7d5fed30>\",\"WARC-Concurrent-To\":\"<urn:uuid:3b64bb1d-0334-4ba7-88aa-2791a42c0470>\",\"WARC-IP-Address\":\"151.101.1.69\",\"WARC-Target-URI\":\"https://stats.stackexchange.com/questions/444340/differentiable-programming-for-general-bayesian-decision-theory\",\"WARC-Payload-Digest\":\"sha1:RVFNUS77LM7RSNFJ2YFITWYFT4QI5HSO\",\"WARC-Block-Digest\":\"sha1:ATVRWW5V2BVIPR3RHJPXIGBWJHGC6JW5\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-23/CC-MAIN-2023-23_segments_1685224646457.49_warc_CC-MAIN-20230531090221-20230531120221-00661.warc.gz\"}"}