A Note on Link Functions in Generalized Linear Models and Activation Functions in Deep Learning: An Alternative Activation Function ()
1. Introduction
Generalized linear models (GLMs) are widely used for data analysis in econometrics and statistics [1]-[5]. In a GLM, a location parameter (usually the expected value or mean) of a dependent variable is linked to a linear combination of independent variables through a link function. The choice of link function is determined by either the underlying error distribution (such as logistic, Poisson, gamma, or inverse-gamma) or the observational structure (such as censoring or truncation).
In contrast, activation functions are used in deep learning (DL) models [6] [7]. Certain DL architectures typically consist of two types of layers: convolutional and pooling. Nawata [8] [9] proposed the grouping-adjusted median estimator (GAME). However, GAME focuses mainly on the pooling stage, and activation functions in the convolutional stage have not been fully examined. Common activation functions include the step (or indicator) function used in threshold models [10]-[13], the sigmoid function [14]-[17], the rectified linear unit (ReLU) [18]-[23], and the leaky ReLU [24]-[28]. Although the universal approximation theorem [29]-[32] shows that most functions can be approximated using these activation functions in DL models, several major challenges remain, including overfitting, multiple local minima, and substantial computational requirements.
These issues become particularly serious in large language models (LLMs), which may contain trillions of unknown parameters due to their numerous layers and nodes (neurons). Selecting an appropriate activation function is therefore critical. Link functions and activation functions are closely related and often coincide. In this note, we examine the similarities between these functions and propose an alternative activation function derived from the conditional expectation (truncated mean) of a truncated model. Our focus is on the theoretical and methodological aspects rather than practical applications.
2. Link and Activation Functions
In this note, we consider the expected value (hereafter, the mean) and other location parameters, such as the median. Following Nawata [33], the GLM is specified as
, (1)
.
is an unobserved latent variable, and
is an observed dependent variable.
and
are vectors of independent variables (including a constant term) and unknown parameters, respectively, and
is an error term.
is a monotonically increasing function such that
if
. If it is not uniformly monotonically increasing, we consider a local interval in which
is monotonic. If it is monotonically decreasing, we use
. Let
denote a function that gives a suitable location parameter of
.
Usually, we consider the mean,
, (2)
where
denotes the expected value with respect to
, and
depends on the distribution of the error term. However, when the median is used as the location parameter, we obtain
. (3)
denotes the median with respect to the error term. The result does not depend on the distribution of the error term, provided that its median is zero. In this sense, the estimator is robust.
In the binary response model,
takes the value 0 or 1 and is given by
. We obtain
(4)
Here,
is the indicator function, which takes the value 1 if
is true and 0 otherwise, and
is the distribution function of
. Assuming a distribution symmetric about zero, we treat
as the distribution function of
itself. Under the standard logistic distribution,
(5)
we obtain the logit model.
When the median is used, the model becomes semiparametric. No specific distribution function is required, and the resulting estimator is robust. However, Nawata [34] showed that such robust estimators cannot be
-consistent and are less efficient than the maximum likelihood estimator (MLE) in the binary response model.
These link functions are similar to the activation functions
used in DL. The step function in threshold models is equivalent to the indicator function in the median case. However, threshold models and their corresponding activation function have a major drawback: the derivative is zero except at the jump discontinuity, causing backpropagation to fail and making optimization difficult. This is consistent with the inefficiency of the median estimator in the binary response model. The sigmoid function corresponds to the logistic distribution function. Even when the sigmoid function is used as an activation function, the vanishing gradient problem—in which the derivative approaches zero—makes learning extremely slow and computationally expensive.
For censored regression or Tobit models,
and
. (6)
The MLE, which assumes a specific distribution for the error term (usually normal or logistic), is widely used in these models. However, it is inconsistent when the distribution is misspecified. Powell [35] considers the least absolute deviations estimator (PLAD), which minimizes
. (7)
PLAD is the GLM estimator that uses the median as the location parameter and is consistent when the median of the error term is zero. Its drawbacks are that (i) multiple local minima make the estimator difficult to compute (Nawata [36]) and (ii) its asymptotic variance is much larger than that of the MLE, making it inefficient.
In DL, the ReLU function,
, (8)
is widely used as an activation function, corresponding to the GLM link function when the error term has a median of zero. Its derivative satisfies
if
if
; the function is not differentiable at
. This means that (i) information from observations with
is used only through their sign, (ii) the first derivative is discontinuous and jumps at zero, and (iii) the second derivative is zero at any differentiable point. Lin et al. ([37], p. 2) state “ReLU-based functions that eliminate negative values appear to constrain representational capacity in ANNs”. By analogy with PLAD, problems of multiple local minima are expected. These issues make computation difficult, especially during backpropagation. Therefore, alternatives such as sigmoid linear unit (SiLU or Swish) [38], leaky ReLU, softplus [39], and Gaussian error linear units (GELUs) [40] functions are also used, as they have been reported to improve performance [38]. The leaky ReLU function is,
(9)
where
is a small positive constant. The derivative is 1 for
and
for
. However, the modifications (including other functions previously described) are ad hoc and lack theoretical justification. Moreover, the derivative remains discontinuous at zero, and the fundamental problems of the ReLU function persist. As in the binary case, it is natural to consider the mean.
3. Modification of the ReLU Function Based on the Truncated Mean
3.1. Truncated Mean
The ReLU function is closely related to the link function in GLMs that use the median as a location parameter. However, this approach has the limitations described in the previous section. In binary models, taking the mean of a binary variable under a logistic error distribution yields the sigmoid function. We therefore consider the mean of the ReLU function with an error term, given by
, (10)
where
follows the normal distribution with mean zero and variance
,
.
Considering the truncated mean when
(the truncated case in GLMs; Amemiya ([41], pp. 366-373)), we obtain
,
, and
(11)
where
and
are the density and distribution functions of the standard normal distribution, respectively, and
represents the inverse of the Mills ratio. Figure 1 shows
with
. It converges to z and zero as
and
, respectively. Hereafter, we refer to the function in Equation (11) as the truncated mean function (TMF). Signals are often unobservable when they are significantly smaller than the background noise, as in astronomical or medical data, making it natural to consider truncated observations. For instance, in astronomy, a zero value at an observation point can have two different meanings. One is that there are no stars or galaxies at that location. The other is that they are present, but their signals are too weak to be detected. These two situations have very different implications for analyzing the structure of space. Therefore, it is reasonable to use only observations that exceed the observational detection limit. The estimator based on the TMF, known as Heckman’s two-step estimator [42] [43], is widely used in econometrics. The TMF is infinitely differentiable for any real value of z, and its first derivative is given by
,
. (12)
Although multicollinearity can severely affect Heckman’s two-step estimator [44]-[46], this issue does not occur when the TMF is used as an activation function.
Figure 1.
with
.
Figure 2 shows
with
.
converges to 1 and 0 as
and
, respectively. The first derivatives of ReLU and leaky ReLU are discontinuous at zero, and their second derivatives vanish at any differentiable point, hindering optimization. This highlights an advantage of the TMF.
The TMF can approximate a piecewise-linear function or the leaky ReLU function, and vice versa. Figure 3 and Figure 4 show the zero-adjusted TMF with
and 0.5, respectively, together with the corresponding leaky ReLU functions. The zero-adjusted TMF equals zero at
. The correlation coefficients between the paired functions over (−3, 3) are 0.9996 and 0.9957, respectively. Consequently,
or (13)
may serve as better activation functions than the leaky ReLU functions. This fact gives rise to the hypothesis that the leaky ReLU and other alternatives might improve the performance because they are approximations of the TMF.
Figure 2.
with
.
Figure 3. The function
with
and values fitted using the leaky ReLU function.
Figure 4. The function
with
and values fitted using the leaky ReLU function.
3.2. Logistic Distribution
We focus on the normal distribution because of its widespread use and well-established properties. However, the logistic distribution function can also be used. The standard logistic distribution has a standard deviation of 1.814. Figure 5 shows the TMF for the normal distribution with parameter
alongside that for the standard logistic distribution, suggesting that the two functions can be used interchangeably with similar effects.
Figure 5. Truncated mean values for the logistic and normal distributions with scale parameter
.
3.3. Censored Mean
In the previous section, we considered the truncated mean conditional on
. We can also consider the censored mean, or the unconditional expected value in the censored model, given by
. (14)
This formulation is rarely used, and its properties in GLMs have not been fully investigated. Figure 6 shows
and
with
. In the negative domain, the censored mean function declines rapidly, and the value of
becomes extremely close to zero when the function is approximated using a leaky ReLU function. Although this function could be a candidate activation function, we do not analyze its properties further in this note.
Figure 6. Truncated and censored mean values.
4. Conclusions
Link functions in GLMs and activation functions in the convolutional layers of DL share important similarities. In this note, we demonstrated that GLM link functions correspond to the activation functions used in binary models. The step function in threshold models is equivalent to the indicator function in the median case. The sigmoid function represents the mean of the indicator function under the assumption that the error term in the GLM follows a logistic distribution.
When the ReLU function is used, the model corresponds to the median regression model in GLMs. Its disadvantages include the fact that observations in the negative region have no effect and its first derivative takes only the values zero or one, complicating optimization. Powell [35] proposed the least absolute deviations estimator, but estimation remains difficult because of differentiability issues and multiple local minima. Although the leaky ReLU function is also used, it lacks theoretical justification, and computational challenges persist.
To address these issues, we propose using the TMF as an alternative activation function, derived by applying a truncated normal model. The TMF is widely used in GLMs, such as in Heckman’s two-step estimator [42] [43]. It is infinitely differentiable, and its second derivative is non-zero at any point, which may facilitate optimization. It is also well approximated by the leaky ReLU function.
The relationship between link functions and activation functions remains an open question. Evaluating the performance of the TMF in DL models is both necessary and compelling, representing an important direction for future research that will be highly valuable for advancing DL methodology. In this note, we focus on the theoretical and methodological aspects, leaving practical applications for future work.
Acknowledgements
The author would like to thank an anonymous referee for his/her helpful comments and suggestions.