(see edits below with attempts made in the meanwhile after posting the question)
Problem
I need to modify a sigmoid function for an AI application, but cannot figure out the correct math. Given a variable $x \in [0,1]$, a function $f(x)$ should satisfy the following requirements (pardon the math-noobiness of my expression):
a) the values of $f(x)$ should be costrained to $[0,1]$
b) when $x=0$ then $f(x)=0$, and when $x=1$ then $f(x)=1$
c) $f(x)$ should follow a sigmoid or "S-curve" shape within these bounds, with some variable changing the "steepness" of the curve.
I used a different function earlier, corresponding to (0), illustrated below on the left:
(0) $f(x) = x^{(z+0.5)^{-b}}$ , where $b=2$ with $z \in [0,1]$ controlling the curve

What is a function that would satisfy these requirements, i.e. do the same thing as equation (0) but with an S-curve$?_{(I\hspace{1mm} hope\hspace{1mm} this\hspace{1mm} makes\hspace{1mm} at\hspace{1mm} least\hspace{1mm} some \hspace{1mm}mathematical\hspace{1mm} sense...)}$
Attempt 1
I tried to accomplish something similar with a logistic function (by varying the $x_0$ value; cf. equation (1) and the right side plot above)
(1) $f(x) = \dfrac{1}{1 + e^{-b(x-(1-x_0))}}$ , where $b=10$, $x_0 \in [0,1]$
...so that $x_0 = 0.5$ yields some central or average curve (like the linear growth line on the leftmost plot), and values around it rise or lower the steepness. Shortcoming: the "ends" of the curve where $x=\{0,1\}$ won't reach the required values of 0 and 1 respectively. I don't want to force it arbitrarily with an if-else, it should come naturally from the properties of an equation (and as such form nice curves).
Attempt 2
This sort of does the trick, now the ends smootly reach 0 and 1 for all values of $x_0$:
(2) $f(x) = \Bigg(\bigg( \dfrac{1}{1 + e^{-b(x-(1-x_0))}}\bigg)x\Bigg)^{1-x} $
Only problem, the effect is not "symmetrical", when comparing high and low values. Observe the values for $f(x)$ with $x_0 = [0,1]$; $b=10$ (left side plot below). The curve steepness varies more among lower $x_0$ values (yellow,red) than amoing higher values (pink); also, changing $x_0$ also has noticably more effect in lower values of $x$ than its higher values.
Attempt 3
Ok maybe if-elsing the hell out of those extreme values is not such a bad idea.
(3) $f(x) = \Bigg(\bigg( \dfrac{1}{1 + e^{-b(x-(1-x_0))}}\bigg)g(x)\Bigg)^{1-h(x)} $
where $g(x) = \left\{\begin{array}{ll}1 & x>0\\0 & otherwise\end{array}\right.$ and $h(x) = \left\{\begin{array}{ll}1 & x==0\\0 & otherwise\end{array}\right.$
The right side plot above illustrates the result: the ends are still nicely 0 and 1, and now the curves above and below $x_0=0.5$ are symmetrical, but there are noticable "jumps" on $x=0.1$ and $x=0.9$ if $x_0$ is in its either extremes. Still not good.
So far all my attempts are all so-so, each lacking in some respect. A better solution would thus still be very welcome.


y=1-x, ieg(x) = (f(x) + (1-f(1-x)))/2should be symmetrical. – Peter Nov 01 '23 at 20:36