What is the intuition behind calculation of posterior mean as minimizing squared loss? I know that in order to calculate the posterior mean $\bar{\theta}$ ; you need to calculate the formula below; and it is pretty intuitive you need to weight your posterior pdf by possible ${\theta}$ values and integrate out the according to ${\theta}$ values.
$$
\bar{\theta}=\int \theta p(\theta | y) d \theta
$$
As long as I understood correctly, the calculation above can be also interpreted like minimizing below squared loss. BUT, what is the intuition behind the following calculation ? 
$$
min\int(\theta-\widehat{\theta})^{2} p(\theta | y) \mathrm{d} \theta
$$
Thank you all in advance!
 A: For a given estimator $\nu$, the associated mean square error risk writes:
$$MSE(\nu) = E[ (\nu(y) - \theta)^2 ] = \int(\theta-\nu(y))^{2} p(\theta | y) \mathrm{d} \theta $$
so its minimizer (that we will call $\bar{\theta}$) writes
$$
\bar{\theta} = argmin_{\nu(y) } MSE(\nu) = argmin_{\nu(y) }\int(\theta-\nu(y))^{2} p(\theta | y) \mathrm{d} \theta
$$
A necessary condition for $\bar{\theta}$ to be the solution of the above minimisation problem is that it cancels the first order derivative of the expression to minimise wrt ${\nu}$ (https://en.wikipedia.org/wiki/Mathematical_optimization#Necessary_conditions_for_optimality):
$$
\frac{\partial  \int(\theta-\nu)^{2} p(\theta | y) \mathrm{d} \theta}{\partial \nu} = 0,
$$
which gives (after a few step) the solution:
$$
\nu(y)=\int \theta p(\theta | y) d \theta.
$$
which coincides with the posterior mean and shows the posterior mean is a minimiser of the mean square error risk. 
The square-loss/mean paradigm has a long story. First, it enjoys computational advantages. Moreover, working with mean quantities is ubiquitous and thus most people feel comfortable with it. Nonetheless other losses (e.g. L1 norm) can be considered depending on your application.
