3

Take this sample graph illustration:

Graph

As $X$ approaches negative infinity the output approaches $-5$

As $X$ approaches positive infinity the output approaches $5$

From what I recall this would be leveraging $\log, \ln$ or $e$ but I'm failing to remember the specific principles involved to come up with this function.

Other things that would be nice for this function is that it accelerates very quickly from the origin and tapers off which I tried to illustrate.

Bring this back to the real world and not just conceptual, realistic values of $X$ will primarily exist between $-10,10$ and much less frequently $-20,20$ and $-50,50$. My goal is to produce scoring algorithm with constrained limits on the output of the score.

The simpler the function, the better.


This function seems to be very close to what I'm looking for:

$5*\frac{x}{1+|x|}$

The graph it produces is:

sigmoid

At $F(5)$ and $F(-5)$ the graph is approximately 4 and -4.

How can I stretch out this function that $F(10)$ and $F(-10)$ are roughly 4 and -4 instead?

Able to answer this question myself, replace $X$ with $0.5X$

4 Answers4

2

You have many alternatives. Have a look at this picture:

enter image description here

You can choose any one of these functions and just multiply it by the max value you want to obtain (you wrote about $5$). If you replace $x$ with $kx$ you are able to tune how steep the curve is in the middle. You can find this functions and even a few other examples on Wikipedia's entry about sigmoid functions.

FOLLOW UP: you can tune the purple function to get what you need in two different ways: $y=5\frac{x/2}{1+|x/2|}$ and $y=5\frac{x}{5/2+|x|}$.

lesath82
  • 2,395
2

It looks like you want a sigmoid function. $$y = 5\left(\frac{2}{1 + e^{-kx}} - 1\right)$$ Increasing k will give a faster change through the origin. This one will go between $-5$ and $5$, replace the $5$ out front for a different range.

Kaynex
  • 2,448
2

The simplest is $$f(x)=\frac{10}{1+e^{-x}}-5$$

It is a simple logistic function subtracted by 0.5 multiplied by $10$.

KKZiomek
  • 4,012
1

What about this :$$f(x)=\frac{10}{\pi} \tan^{-1}x$$

Jaideep Khare
  • 19,293