Returns a vector with the same number of elements as x
Arguments
x
real argument between -Inf and +Inf, can be a vector
type
number or character string, specifying the type of function. The following expressions vary between -1 and +1 with a slope of 1 at the symmetry x=0. tanh (1): hyperbolic tangent function, tanh(x), which becomes the logistic function, 1/(1+exp(-x)), if all arguments kept at default. atan (2): arctangent function, 2/pi*atan(pi/2*x) err (3): error function, erf(sqrt(pi)/2*x) sqrt (4): algebraic function with root, x/sqrt(1+x^2) abs (5): algebraic function with absolute value, x/(1+abs(x)) gd (6): Gudermannian function, 4/pi*atan(tanh(pi/4*x))
fmin
asymptotic function minimum at x=-Inf
fmax
asymptotic function maximum at x=+Inf
xmid
point of symmetry, where the function value is (fmin+fmax)/2
col = c('red','orange','#cccc00','#00bb00','blue','purple')
for (i in seq(6)) {
graphics::curve(sigmoid(x,i),-3,3,add=i>1,col=col[i],ylab='sigmoid(x)')
}
graphics::lines(c(-1.5,1.5),c(-1,2),lty=2)