2

This is a refinement of this question: (Computationally) Simple sigmoid.

Ideally, I would like to have relatively simple sigmoid function with the following properties:

  1. derivatives at -1 and 1 are zero
  2. derivative is not zero between -1 and 1
  3. derivative at 0 is 1, maybe can be controlled with a parameter
  4. I can control the change in derivative near -1 and 1 within (-1,1), so that the derivative doesn't depart from zero too quickly or too slowly.
  5. The curve is "symmetric" in the sense that flipping the curve on [0,1] both vertically and horizontally produces the curve on [0,1].

Approximations to items 1 through 5 are OK. This is for a computer simulation in which values $c$ in [-1,1] cause an increase or decrease in other values $e$ in [-1,1]. I want $e$ to change quickly when it's pushed around in the middle range near 0, but to be pushed up slowly when it's near 1, and similarly when pushed down near -1. I just need a function that works well enough; it doesn't have to perfect.

I've had trouble figuring out how to tune the sigmoids I'm aware of in order to get properties that are close to 1 through 5.

Thanks!

Mars
  • 1,338

1 Answers1

2

So a possible solution is $$\tanh\frac{kx}{(1-x^2)^{1/n}}$$ For $k > 0, n \geq 1$ being a constants for adjustment of the function as you like.
In general to explain how you can construct more sigmoid functions. Let's assume we have a sigmoid function $f(x):\mathbb{R} \rightarrow[-1;1]$ and we want to make it to find $g(x): [-1;1] \rightarrow[-1;1]$ what we can do is use a mapping $h(x):[-1;1] \rightarrow [-\infty ; \infty]$ and define $g(x) = f(h(x))$. Such mapping is $h(x) = \frac{kx}{(1-x^2)^{1/n}}$. Using this you can build and more functions for what you need using different well known sigmoids. And you should play a bit with $k$ and $n$ to find a good solution.
And don't forget that for any sigmoid $f(x):\mathbb{R} \rightarrow [0;1]$ you can transform them to $[-1;1]$ by taking $2*f(x)-1$ and vice versa.

Alex Botev
  • 1,106
  • Thanks very much for the additional parameter n, the additional explanation! – Mars Apr 21 '13 at 04:30
  • Belov, btw I'm now finding your function useful with $n\in (0,1)$ as well as $\geq 1$. Recently I needed a function that's flat near 0 and then steeply rises/drops to extreme values near 1 and -1, and your function allows that with small $n$ (e.g. $k=0.01$, $n=0.35$). I'm not sure whether it counts as a sigmoid any more--certainly not a paradigmatic sigmoid, I guess. (For some reason I neglected to upvote as well as accept your answer two years ago--now corrected.) – Mars Jan 26 '15 at 20:19