In mathematics and machine learning, the softplus function is
f(x)=log(1+ex).
It is a smooth approximation (in fact, an analytic function) to the ramp function, which is known as the rectifier or ReLU (rectified linear unit) in machine learning. For large negative
x
log(1+ex)=log(1+\epsilon)\gtrapproxlog1=0
x
log(1+ex)\gtrapproxlog(ex)=x
x
The names softplus[1] [2] and SmoothReLU[3] are used in machine learning. The name "softplus" (2000), by analogy with the earlier softmax (1989) is presumably because it is a smooth (soft) approximation of the positive part of, which is sometimes denoted with a superscript plus,
x+:=max(0,x)
The derivative of softplus is the logistic function:
f'(x)=
ex | |
1+ex |
=
1 | |
1+e-x |
The logistic sigmoid function is a smooth approximation of the derivative of the rectifier, the Heaviside step function.
See main article: LogSumExp. The multivariable generalization of single-variable softplus is the LogSumExp with the first argument set to zero:
+(x | |
\operatorname{LSE | |
1, |
...,xn):=\operatorname{LSE}(0,x1,...,xn)=ln(1+
x1 | |
e |
+ … +
xn | |
e |
).
The LogSumExp function is
\operatorname{LSE}(x1,...,xn)=
x1 | |
ln(e |
+ … +
xn | |
e |
),
and its gradient is the softmax; the softmax with the first argument set to zero is the multivariable generalization of the logistic function. Both LogSumExp and softmax are used in machine learning.
The convex conjugate (specifically, the Legendre transform) of the softplus function is the negative binary entropy (with base). This is because (following the definition of the Legendre transform: the derivatives are inverse functions) the derivative of softplus is the logistic function, whose inverse function is the logit, which is the derivative of negative binary entropy.
Softplus can be interpreted as logistic loss (as a positive number), so by duality, minimizing logistic loss corresponds to maximizing entropy. This justifies the principle of maximum entropy as loss minimization.
This function can be approximated as:
ln\left(1+ex\right) ≈ \begin{cases}ln2,&x=0,\\[6pt]
x | |
1-e-x/ln2 |
,&x ≠ 0\end{cases}
By making the change of variables
x=yln(2)
log2(1+2y) ≈ \begin{cases}1,&y=0,\\[6pt]
y | |
1-e-y |
,&y ≠ 0.\end{cases}
A sharpness parameter
k
f(x)=
ln(1+ekx) | |
k, |
f'(x)=
ekx | |
1+ekx |
=
1 | |
1+e-kx |
.