sigmoid: Sigmoid function and gradient

Description Usage Arguments Details Value Examples

Description

Sigmoid function and gradient

Usage

1
sigmoid(x, lower.limit = 0, upper.limit = 1)

Arguments

x

Point to evaluate sigmoid function and gradient

lower.limit

Lower limit of the sigmoid function; defaults to 0

upper.limit

Upper limit of the sigmoid function; defaults to 1

Details

Evaluates the sigmoid function ((upper.bound - lower.bound) / (1 + exp(-x)) + lower.bound) and its gradient ((upper.bound - lower.bound) * exp(-x) / (1 + exp(-x))^2).

Value

Returns a list with two elements, each with the same number of elements as x

value

Value of the sigmoid function at x

gradient

Value of the gradient of the sigmoid function at x

Examples

1
2
3
4
5
x <- seq(-5, 5, length.out = 100)
sigmoid.result <- sigmoid(x)

plot(sigmoid.result$value ~ x, type = "l")
plot(sigmoid.result$gradient ~ x, type = "l")

tkmckenzie/ikde documentation built on May 13, 2019, 9:53 p.m.