4

I am looking for the simplest sigmoid function that goes from 0 to 1 and has a fixed starting point and tunable slope. As I am not a mathematician, I am sure I already used a lot of improper terms, but I hope it will be clear:

  1. $$y=\frac{1}{1+e^{-x\alpha}}$$

The standard sigmoid (1.) is not such, as it's starting position depends on the slope (α).

I found that (2.) has the desired start:

  1. $$y=1-\frac{1}{\left( 1+\left( x \right)^{4} \right)}$$

enter image description here Plot image

Now that is great, but I need a sigmoid, when below 0 (or actually below β in 3.) it is always zero and it is possibly differentiable.

  1. $$y=1-\frac{1}{\left( 1+\left( x-β \right)^{4} \right)}$$

My most sincere apologies if this question breaks the noob-o-meter. Please also correct me, if I used the wrong terms/ language.

  • snaggy seems not that compatible with this site. – Siong Thye Goh Aug 22 '17 at 18:10
  • Sorry, I realised the .jpg needs to be replaced to .png to be working! Thanks for the fix! – bud.dugong Aug 22 '17 at 18:13
  • Would you settle for a piecewise-defined function? A common way to build a “tunable” sigmoid is out of pieces of parabolas. – amd Aug 22 '17 at 20:37
  • Piecewise, in my understanding is a set of two functions, evaluated on adjacent intervals. (Correct me if I am wrong.) I would avoid piecewise functions, if possible.

    I got to a certain point:

    $${y=\left( 1-\frac{1}{\left( 1+α \cdot (x-β)^{4} \right)} \right)\cdot \left( .5+\frac{x}{2\cdot \mbox{abs}\left( x \right)} \right)}$$

    where α tunes the slope and β tunes the inflexion point, but abs() is not differentiable, and I hope there is a simpler formula than above.

    – bud.dugong Aug 22 '17 at 22:07
  • Which can be simplifed to:

    $$y= {0.5*(sgn(X) +1) \cdot α \cdot X^4 \over α \cdot X^4 +1}$$

    where $$X=x-β$$ sgn(x) is differentiable at all values except x=0.

    – bud.dugong Aug 27 '17 at 09:38

2 Answers2

4

I recently developed a sigmoidal function that is based on the Superparabola as a differentiable model for the Heaviside step function. It has the following attributes:

  1. It is complete in a finite regime (i.e., the ends are absolute rather than asymptotic).

  2. It is fully differentiable over the entire regime.

  3. Parametrically, it can vary between a ramp function and a step function.

In addition, it can be moved and scaled as required. Without any further ado, the function is given by

$$f\left( x \right)=\frac{1}{2}\left[ 1+\text{sgn} (x)\,\frac{B\left( {1}/{2}\;,p+1,{{\left| x \right|}^{2}} \right)}{B\left( {1}/{2}\;,p+1 \right)} \right]$$

where the numerator and denominator $B$s are the incomplete and complete beta functions, respectively. When $p=0$ you get the ramp function and as $p\to\infty$ you get the step function. For all other $p$ you get a sigmoidal function with variable rise slope.

Also, note that the derivative of the incomplete beta function is given by

$$\frac{d}{dx}B(\nu,\mu,x)=x^{\nu-1}(1-x)^{\mu-1}$$

The figure below shows a typical sigmoidal function so-calculated (red) and the superparabola (blue) from which it was created by integration.

Sigmoid function

Cye Waldman
  • 7,524
2

A simpler function that may be useful as a sigmoid function with tunable slope $m$ and range $[-1,1]$ for $x\in [-1,1]$ is $$ f(x) = \frac{m x}{1+|x|(m-1)} $$ This function is odd, i.e. $f(-x)=-f(x)$, and interpolates smoothly between $-1$ and $1$ for $x\in[-1,1]$, such that $f'(x)>0$, and $f'(0)=m$. When $m=1$, you get the ramp function (i.e., $f(x)=x$), and when $m\to\infty$ you get the Heaviside function. Note, however, that the slope at $x=-1$ and $x=1$ is not zero (impossible if you want to have the ramp function as one member of this family).