<p>Writing a question in Meta asking for feedback is a way to solicit feedback.</p>
<hr />
<p>The blue box at the top of your post reads &quot;Closed. This question needs details or clarity. It is not currently accepting answers.
Add details and clarify the problem being solved. This will help others answer the question. You can edit the question.&quot; This is the feedback.</p>
<hr />
<p>I didn't vote to close the question, so I can't speak for the people who did. However, there are several parts of the question that could be clarified.</p>
<ol>
<li><p>The question is completely general. You want to compute an expectation of an arbitrary function where neither <span class="math-container">$P$</span> nor <span class="math-container">$f$</span> are described. Often, solving a very general problem is harder than solving a more specific problem; providing detail about what you want to do and how the proposed procedure fits into it could make the answer more tractable.</p>
</li>
<li><p>In general, estimating posterior distributions is challenging. It becomes more challenging when estimating very many parameters and highly multimodal and non-identified likelihoods, such as neural networks. Bayesian inference tools exist to estimate posterior distributions, but it's not clear from the question whether you are using them at all, or if you are conflating them with SGD.</p>
</li>
<li><p>You describe SGD as &quot;sampling parameters,&quot; which is not what SGD is. SGD does not generate random deviates from a desired target distribution. SGD is an <em>optimization</em> algorithm. The purpose of SGD is to adjust parameters <span class="math-container">$\theta$</span> so that some loss achieves a local minimum. When the SGD loss is a negative likelihood, then it is analogous to a maximum likelihood estimator; both are point estimates of parameters given a dataset and a model specification.</p>
</li>
<li><p>Bayesian neural networks are a specialized topic in their own right. It's possible that this is what you're after, since you're using a neural network and desire estimates of distributions over <span class="math-container">$\theta$</span>. If you are asking about Bayesian neural networks, then this question is very broad and would benefit from an explanation of what you know and what you would like to find out.</p>
</li>
</ol>
<p>It's possible that you have some specialized procedure in mind that resolves these inconsistencies and ambiguities. If so, you should edit your question to describe them.</p>
