Let $S$ be a finit set of real numbers (well not exactly "real" numbers but as "real" as it is possible by representing them by the primitive type "float" on the computer). I need to find a function
$f:\mathbb{R}\to[0,1], f(s)\in[0,1],s\in S$
such that:
$\sum_{s\in S}f(s)=1$
Ist there a straightforward way to achieve this?
Edit:
Since my question was ambiguous I'll try to explain my problem respecting more details.
I have an an algorithm, that works this way:
- Given is a list of objects $L$ and an integer $k$, where $k=|L|$.
- For each label $l\in L$ the algorithm computes $k$ real numbers. The numbers are the elements of the $S$ mentioned above.
I want to normalize the output data (the dataset $S$ produced by the algorithm). An example would be an output $S=\{a_1,\dots ,a_i\}$ where $a_k\in\mathbb{R}$ for $1\leq i\leq k$.
After the normalization the data should satisfy the conditions I mentioned above.
- $\sum_{i=1}^{k}a_i=1$
- $a_i\in [0,1]$ for each $a_i$
I hope, that the questoin is now more clear.