Question

I have a bunch of percentage values in the form of doubles that relate to system usage stats (things like cpu usage, memory etc) and I am trying to plug them into a sigmoid function to output a second double that relates to the severity of the first value.

I realise that sigmoid shaped functions would allow this to happen but I'm unsure about how to go about it.

For reference here is the kind of function I am referring to in graph form.

Sigmoid graph

With input along the x axis in the form of a percentage value 1-100 and output on the y axis in a 5 point value of severity so from 0-5, im attempting to map one percentage based value to an arbitrary value through a function.

Thanks in advance for any help.

Was it helpful?

Solution

For a percentage p try

 Math.round(5.0/(1.0+Math.exp((50.0-p)/c)))

Here c controls the steepness of the transition from 0 to 5. A value of 10 looks about right to me.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top