Home > Mobile >  What is the best function with a y limit for data processing in numpy
What is the best function with a y limit for data processing in numpy

Time:01-17

I'm processing a large set of data using numpy and want to take an input between 0 and infinity to output a value between 0 and 1 with greater inputs giving greater outputs and adjustable gradient. I have used y = arctan(x*S)/1.58 with x as input value and S being the slope between x and y. Is this computationally efficient, or is there a better function or way to do this?

Plot with S=0.2

CodePudding user response:

You're looking for a bijection between the unit interval and the real line. In machine learning, these are often called activation functions. Arctan is one activation function, although you will have to transform it to get it to go from 0 to 1 (you should divide by pi, not pi/2, and then add 0.5; also, as DYZ says in a comment, use math.pi, not a decimal approximation). Logistic functions are probably a bit more common. You can also use any probability distribution's CDF.

  •  Tags:  
  • Related