I am searching for a minimizer of the function
$$\min_y \sum_{i=0}^n \frac{\sqrt{\lvert \textbf{x}_i - y\rvert}}{n}$$
where x is a vector $\in \mathbb{R}$ (see y_true below), and y $\in \mathbb{R}$.
Empirically, I show that the minimizer of the function seems to be $min(\textbf{x})$, or in Python code 1e-9:
import numpy as np
# some random data
y_true = np.array([1e-9,1e-9,1e-9,1e-7,1e-6,1e-5,1e-5,1e-5,1e-4])
# testing out minimizers emprically
for y_pred in [1e-9, 1e-9 + 1e-20, 1e-8, 1e-7, 1e-6, 1e-5, 1e-4]:
print(f'{y_pred}: {np.mean(np.sqrt(np.abs(y_true-np.repeat(y_pred, len(y_true)))))}')
# --> 1e-9 is exactly the minimizer of the square-rooted absolute distance. Why?!
I can't get my head around why that would be the case. When I eliminate the square root (resulting in the well known "mean absolute error"), the minimizer is somewhere between the values of y_true. Yet when I take the square root of this distance, the minimum is exactly 1e-9..?
Thank you for some insight on the matter!
PS: Copy-pasting this Python code will make it work in float64, i.e. there are no numerical issues at hand.
It isn't true in general that $y^*$ is equal to $\min_i \mathbf \{ \mathbf x_i\mid 0\leq i\leq n\}$. Define first for notational convenience $$f_{\mathbf x}(y) = \sum\limits_{i=0}^n \frac{\sqrt{|\mathbf x_i - y|}}{n}. $$
Now I will give a counter-example to your claim. Let $\mathbf x = (1, 4, 9)^\intercal$, such that $n=2$, and $\mathbf x_0 = 1$, $\mathbf x_1 = 4$, $\mathbf x_2 = 9$. Then you would expect the minimizer to be $1$, but in fact $$f_{\mathbf x}(1) = \sqrt{2}+\frac{\sqrt{3}}{2}\approx 2.28 $$ and $$f_{\mathbf x}(4) = \frac12(\sqrt{3}+\sqrt{5}) \approx 1.98.$$
Therefore, $f_{\mathbf x}(4) < f_{\mathbf x}(1)$ in contradiction with your conjecture.
As for giving more general insight to $f_{\mathbf x}(y)$, I cannot at this moment. Its behavior is not particularly nice, see for example Wolfram Alpha. In all the examples I've tried though, it does seem that the minimizer is always exactly one of the elements of $\mathbf x$, and not some number between them. However, that may not always be the case. I haven't given it sufficient thought.