0
$\begingroup$

To model my data, i need a function that resembles $f(x) = s(x) + x$ with $f : \mathbb{R} \rightarrow \mathbb{R}$, where $s(x)$ is a sigmoid-like function with co-domain $(0,1)$. So if we look at the derivate, a small bump around zero.

The problem now is that in order to efficiently sample the data (which is important for my problem), I need to calculate the inverse of the function.

I would say that the numerical error of the inverse is not as important as efficiency. I am currently approximating the inverse via gauss-newton, but since I need to sample a lot, this turns out to be quite a bottleneck (I am currently doing approx. $53$ iterations). My current $s$ is the standard logistic function.

I have tried a lot of the obvious sigmoid-functions, but I never managed to derive an inverse function.

Edit: $s$ must be twice continuously differentiable.

$\endgroup$
  • $\begingroup$ How smooth must $s$ be? $\endgroup$ – Hagen von Eitzen Jun 3 at 14:15
  • $\begingroup$ thanks, I am going to edit the question $\endgroup$ – Leander Jun 3 at 14:16
2
$\begingroup$

As you want to compute the inverse, let us start from that end: Consider $$g(x)=\begin{cases}3x^5-10x^3+30x&-1\le x\le 1\\ 15x+8&x\ge1\\ 15x-8&x\le -1\end{cases} $$ Then $g$ is $C^2$ and has no critical points, hence has a $C^2$ inverse $f$ that looks like a line plus a sigmoidal. To match your demands for $x\ll 0$ and $x\gg 0$, we consider a variant $$\tilde g(x):=cg(ax+b)+d$$ for suitable $a,b,c,d$. If I am not mistaken, $ a=\frac{16}{15}$, $b=\frac 8{15}$, $c=\frac1{16}$, $d=0$ should be okay. Also, $\tilde g$ is very efficient to compute (but $s$ perhaps is not).

$\endgroup$
  • $\begingroup$ easy solutions are often the best. Don't know why I haven't thought about approximating them vial some polynomials. Thanks! $\endgroup$ – Leander Jun 5 at 12:36
0
$\begingroup$

Not an answer to the question asked

This doesn't provide a function $s$ such that it's sigmoid, but $f(x) = x + s(x)$ is easily invertible. But it still may be of use:

Have you considered an alternative like rejection sampling? That doesn't require the inverse. For something like a sigmoid, this should result in only about a 50% rejection rate, which isn't bad at all. Sure beats $53$ iterations of Gauss-Newton! It also lets you pick a function $s$ that's appropriate for your model, rather than one that's computationally convenient.

In a broader view: are you certain that all the constraints of your problem are necessary? If sampling entails inversion problems, perhaps you can change sampling strategies rather than searching for algebraically convenient functions.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.