I am trying to understand this euclidean projection.
$\bar{s}^∗=\operatorname{argmin}_{\hat{s}∈C} \|\hat{s}−s^∗\|_2$
Here $\hat{s},\bar{s}^∗,s^∗$ are all vectors of size N. C is a hypercube defined by $C = \{ s | 0⪯s⪯1, s∈R^N \}$. I just need to understand whether I am understanding this correctly. So for example if N=3 and $s^*=\{1.2, 0.5, -.5\}$ does the final output of the equation will be with $\bar{s}^∗ = \{1.0, 0.5, 0.0\}$? Since this minimise the objective value. If this is not the answer then what is the approach to solve it?
I searched over the internet but didn't finding any explanation with example so to clear my concept I need to know this.
Your answer is correct.
We want to minimize $$(s_1 - 1.2)^2+(s_2-0.5)^2+(s_3+0.5)^2$$
subject to $$0\le s_i\le 1$$
Note that this problem is separable.
If the given value is more than $1$, it will be projected to $1$ as that minimizes the distance. Hence $\bar{s}_1^*=1$.
If the value is between $0$ and $1$, it takes the original value as we attain distance $0$ from that component.
If the value is less than $0$, it will be projected to $0$ as that minimizes the distance. Hence $\bar{s}_3^*=0$.