I wanted to find a general monotonic rescaling function (don't know if the naming is right) that can rescale a list of values according to 2 parameters :
alphain [0, 1] that amplifies the curve ;betain [0, 1] that sets the shape of the curve (more log-like or exp-like).
I am not a mathematician I cannot do it (even explain it...) but I managed to find 4 functions that do the job (hope you will understand with this demo) :
https://www.desmos.com/calculator/ubvimc9c88
The constraint is all values (x) must be normalized between 0 and 1. Functions'y are also between 0 and 1.
Here a straightforward example of its usage:
With alpha=0.15 : f(1.0), f(0.8), f(0.6), f(0.4), f(0.2), f(0.0) = 0.0, 0.06, 0.1, 0.2, 0.3, 1.0 (values are closer to 0)
With alpha=0.85 : f(1.0), f(0.8), f(0.6), f(0.4), f(0.2), f(0.0) = 0.0, 0.5, 0.8, 0.9, 0.99, 1.0 (values are closer to 1)
The problem is that the parameter beta is a boolean which make the shape of the curve either strict log-like or strict exp-like, it is not a continuous parameter between 0 and 1. The beta is thus a choice between red/blue and green/purple curves. But the main problem is I don't have a unified math function.
Here the python code:
def f(x, alpha=0.5, beta=True, inverse=True):
if beta:
if alpha < 0.5:
y = -(x ** (2 * alpha)) + 1
else:
y = -(x ** (1 / (2 * (abs(alpha - 1) + 0.5) - 1))) + 1
else:
if alpha < 0.5:
y = (1 - x) ** (1 / (2 * alpha))
else:
y = (1 - x) ** (2 * (abs(alpha - 1) + 0.5) - 1)
if inverse:
return y
else:
return 1 - y