y=ln(1+ex)y = \ln(1+e^x)

Graph of the Softplus Function y=ln(1+ex)y = \ln(1 + e^x)

y=ln(1+ex)y = \ln(1 + e^x) is called the softplus function. Since ex>0e^x > 0 gives 1+ex>11 + e^x > 1, the logarithm is always positive, so the domain is all real numbers and the range is y>0y > 0. The inside 1+ex1 + e^x increases monotonically and ln\ln is increasing, so the whole function is monotonically increasing.

As xx \to -\infty, ex0e^x \to 0 and ln(1+0)=0\ln(1 + 0) = 0, so on the left y=0y = 0 (the xx-axis) is an asymptote. As x+x \to +\infty, 1+exex1 + e^x \approx e^x, so yln(ex)=xy \approx \ln(e^x) = x, and on the right the line y=xy = x is an asymptote. The graph is thus a smoothly bent shape, flat near 00 on the left and approaching the slope-11 line on the right.

The derivative is exactly the logistic (sigmoid) function:

y=ex1+ex=11+exy' = \dfrac{e^x}{1 + e^x} = \dfrac{1}{1 + e^{-x}}

Its value lies between 00 and 11, tending to 00 as xx \to -\infty and to 11 as x+x \to +\infty. The second derivative is positive, so the graph is always convex.

Here are some values; for large xx the output is almost equal to xx.

  • x=0y=ln20.693x = 0 \Rightarrow y = \ln 2 \approx 0.693
  • x=1y=ln(1+e)1.313x = 1 \Rightarrow y = \ln(1 + e) \approx 1.313
  • x=1y=ln(1+e1)0.313x = -1 \Rightarrow y = \ln(1 + e^{-1}) \approx 0.313
  • x=5y5.007x = 5 \Rightarrow y \approx 5.007

The ReLU max(0,x)\max(0, x), common in machine learning, has a corner at the origin where it is not differentiable; softplus is a smooth approximation that rounds off that corner, staying rounded near the origin while nearly coinciding with ReLU far away. It is used as an activation function in neural networks and to parametrize quantities that must stay positive, such as a variance or a population count. Because its derivative is the sigmoid — equivalently, softplus is the antiderivative (integral) of the sigmoid — this elegant relationship also simplifies gradient computations.