scieee AI-readable full text Open interactive document viewer

ENN: a neural network with DCT adaptive activation functions

Martínez Gost, Marc,Pérez Neira, Ana Isabel,Lagunas Hernandez, Miguel A.

Abstract

The expressiveness of neural networks highly depends on the nature of the activation function, although these are usually assumed predefined and fixed during the training stage. Under a signal processing perspective, in this paper we present Expressive Neural Network (ENN), a novel model in which the non-linear activation functions are modeled using the Discrete Cosine Transform (DCT) and adapted using backpropagation during training. This parametrization keeps the number of trainable parameters low, is appropriate for gradient-based schemes, and adapts to different learning tasks. This is the first non-linear model for activation functions that relies on a signal processing perspective, providing high flexibility and expressiveness to the network. We contribute with insights in the explainability of the network at convergence by recovering the concept of bump, this is, the response of each activation function in the output space. Finally, through exhaustive experiments we show that the model can adapt to classification and regression tasks. The performance of ENN outperforms state of the art benchmarks, providing above a 40% gap in accuracy in some scenarios.

Full text

232 IEEE JOURNAL OF SELECTED TOPICS IN SIGNAL PROCESSING, VOL. 18, NO. 2, MARCH 2024 ENN: A Neural Network With DCT Adaptive Activation Functions Marc Martinez-Gost , Graduate Student Member, IEEE, Ana Pérez-Neira , Fellow, IEEE, and Miguel Ángel Lagunas , Life Fellow, IEEE Abstract—The expressiveness of neural networks highly depends on the nature of the activation function, although these are usually assumed predefined and fixed during the training stage. Under a signal processing perspective, in this article we present Expressive Neural Network (ENN), a novel model in which the non-linear activation functions are modeled using the Discrete Cosine Transform (DCT) and adapted using backpropagation during training. This parametrization keeps the number of trainable parameters low, is appropriate for gradient-based schemes, and adapts to different learning tasks. This is the first non-linear model for activation functions that relies on a signal processing perspective, providing high flexibility and expressiveness to the network. We contribute with insights in the explainability of the network at convergence by recovering the concept of bump, this is, the response of each activation function in the output space. Finally, through exhaustive experiments we show that the model can adapt to classification and regression tasks. The performance of ENN outperforms state of the art benchmarks, providing above a 40% gap in accuracy in some scenarios. Index Terms—Neural networks, adaptive activation functions, discrete cosine transform, explainable machine learning. I. INTRODUCTION FUNCTIONapproximationisafundamentalproblemacross many domains, such as data analysis, control systems and communications. When the explicit function is not available but input-output data pairs are, the function can be revealed by minimizing a criterion loss in a supervised setting. The problem increases in complexity when the function is non-linear, for which many signal processing techniques have been developed. Manuscript received 30 June 2023; revised 16 January 2024; accepted 19 January 2024. Date of publication 1 February 2024; date of current version 3 July 2024. This work was supported in part by IRENE, funded by MCIN/AEI/10.13039/501100011033, under Grant PID2020-115323RB-C31 and in part by Catalan government through the project SGR-Cat under Grant 2021-01207. The guest editor coordinating the review of this manuscript and approving it for publication was Prof. Maria Sabrina Greco. (Corresponding author: Marc Martinez-Gost.) Marc Martinez-Gost is with the Centre Tecnològic de Telecomunicacions de Catalunya, 08860 Castelldefels, Spain, and also with the Department of Signal Theory, Communications, Universitat Politècnica de Catalunya, 08034 Barcelona, Spain (e-mail: [email protected]). Ana Pérez-Neira is with the Centre Tecnològic de Telecomunicacions de Catalunya, 08860 Castelldefels, Spain, also with the Department of Signal Theory, Communications, Universitat Politècnica de Catalunya, 08034 Barcelona, Spain, and also with ICREA Acadèmia, 08010 Barcelona, Spain (e-mail: [email protected]). Miguel Ángel Lagunas is with the Department of Signal Theory, Communications, Universitat Politècnica de Catalunya, 08034 Barcelona, Spain (e-mail: [email protected]). Digital Object Identifier 10.1109/JSTSP.2024.3361154 For instance, least squares [1], orthogonal function approximation [2],[3], kernel methods [4] and neural networks [5], [6],[7], among others. The last decades have suffered an unprecedented growth in the development of artificial neural networks for function approximation due to its empirical success. The inception of neural networks as universal approximators boosted its development across many fields and applications, with different architectures built according to the task and data types to handle. Nevertheless, the expressiveness of the neural network is related to the non-linear activation function, which is usually assumed fixed. An overlooked field of research is in adaptive activation functions (AAF), where not only the weightsoftheneuralnetworksaretrained,butthenon-linearities too [8]. In our previous work [9] we introduced the Discrete Cosine Transform (DCT) to approximate an univariate non-linear function in a joint communication and computing setting. Further, in [10] we show how a gradient-based algorithm can be used to tune the DCT coefficients to approximate a function in a supervised setting. However, extending the results to multivariate functions is not trivial: The number of required parameters to approximate the function increases exponentially with the number of input variables, and their corresponding indexes are unknown when the explicit function is not available. In other words, it is cumbersome how the top relevant coefficients can be learnt in a supervised fashion using labeled data. In this work we propose to extend the capabilities of the DCT with a novel neural network model that integrates the DCT to represent and adapt the activation functions. We call this model Expressive Neural Network (ENN). We exploit the fact that a 2-layer neural network can theoretically represent any function and expand the representation capabilities of the network by adapting the activation functions at each neuron. The advantage ofapproximatinganunivariatefunctionwiththeDCTistwofold: A small number of coefficients is required due to its high energy compaction, and the approximation error is easily controlled by the magnitude of the disregarded coefficients. In this work we also show that the DCT coefficients can be learnt using backpropagation in a supervised fashion and in the same pass as the standard network linear weights. In this way, the architecture is no different from a standard feed-forward neural network with fixed activation functions. From the learning perspective, using the DCT to model the activation functions brings the following benefits: © 2024 The Authors. This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 License. For more information, see https://creativecommons.org/licenses/by-nc-nd/4.0/ MARTINEZ-GOST et al.: ENN: A NEURAL NETWORK WITH DCT ADAPTIVE ACTIVATION FUNCTIONS 233 rNetwork size: The number of parameters in the network grows linear with the number of neurons, which is small due to energy compaction of DCT. rBackpropagation: The tuning algorithm can be implemented because the DCT coefficients are real and ordered in decreasing magnitude. Besides, there exist analytical closed-form solutions for backpropagation. rGradient behavior: The basis functions (cosines) are real and bounded, which prevents exploding gradients. Likewise, since the Fourier representation creates a periodic function that does not saturate, it also prevents vanishing gradients. rTask adaptability: The output non-linearity is automatically adapted depending on the task (e.g., classification or regression) without changing the loss function. While we provide a general formulation for multivariate real functions, we constrain the analysis to bivariate functions. This allows to visualize the results and intuitively understand how the network is adapting the activation functions. In this respect, we recover the concept of bump, which is the non-linear enclosure that each activation function generates in the output space [11]. The global response of the network corresponds to a weighted sum of all bumps generated at the hidden layer. This concept allows to gain insights in how the network decides to exploit the periodic nature of the DCT model and create the boundaries for classification problems. In this work we focus on two general problems of function approximation, namely classification and regression. In the former there are two hypothesis associated to a function, this is, H0when f(x1,x 2)<0and H1otherwise. In regression thegoal is to approximate the function f(x1,x 2).Our primarygoal isto show theinterpretability andexpressivenessof the DCT-based non-linearities in small networks, which is why we do not consider standard datasets and large models. We leave these considerations for future work, along with other learning aspects, such as overfitting. The source code of this study is openly available on http://github.com/marcmartinezgost/enn. The main contributions of this article are described in the following: 1) We define ENN, a novel neural network model with nonlinearAAFthatareparameterizedbytheDCT.Thisallows toadaptDCT coefficients inasupervised fashionandlearn specific non-linearities according to the task. This results in a highly flexible and expressive model. 2) We develop analytical closed-form expressions to adapt the non-linearities with backpropagation. While we choosetheLeastMeanSquares(LMS)algorithmtoupdate the network parameters, the architecture remains a feedforward neural network and any alternative algorithm can be used. 3) We provide insights in the field of explainable machine learning (XML). We recover the concept of bump, which allows to interpret how the non-linearities are adapted and what is the global response of the neural network. Furthermore,weshowhowthe DCTmodelhelps todimensionthe network width, this is, the number of hidden neurons. Particularly, the network converges to duplicated activation functions with opposed linear weights in the output layer. This is, the network cancels out the information coming from several neurons when the task does not require that many parameters. 4) We provide extensive experiments in both classification and regression setups for which ENN outperforms all the benchmarks. In classification tasks, ENN outperforms fixed activation functions up to 40% in accuracy. With that we show how the expressiveness of network highly depends on the activation function, without the need of increasing the size of the network. The remainder of this article is organized as follows. In Section II, we present a literature review on neural networks for functionapproximation. Fouriermodelsfor non-linearrepresen- tationare presentedin SectionIII.We presentENN inSection IV and propose the learning procedure for supervised tasks in Section V. The simulation results are shown in Section VI and we conclude the paper in Section VII. Notation: Lowercase and uppercase bold symbols correspond to vectors and matrices, respectively; s[m]corresponds to the m-th entry of vector s;Rstands for the set of real numbers and ∇for the gradient. II. LITERATURE REVIEW The universal approximation theorem is a well-known result in mathematics stating that a 2-layer neural network can represent any continuous function with an arbitrary number of neurons [12],[13]. The theory behind neural networks has been further developed, providing bounds on the number of required neurons. In a different line of research, the Kolmogorov-Arnold (KA) representation theorem shows how a multivariate function can be represented by functions of only univariate functions [14]: f(x1,...,x n)= 2n+1  i=1 Φi⎛ ⎝ n  j=1 φij(xj)⎞ ⎠,(1) where Φiand φjare termed the outer and inner functions, respectively. This result seems to be tightly connected to a 2-layer neural network, since the inner functions correspond to the hidden layer transformation and the outer functions to the output neuron. What is more, the inner functions do not depend on the function fto implement, which resembles the activation functions in neural network architectures. However, the formulation is not exactly identical: the KA representation requires ninner functions for each input variable, while a neural network implements a unique function for each linear combination of inputs. In this way, although there is an extensive literature motivating the development of neural networks with the KA theorem [15],[16],[17], there are still many gaps to be resolved. What is more, the theorem is not constructive and the functions in (1) are highly non-linear. Despite its success in many applications, neural networks undergo several shortcomings that limit the interpretability of the results: optimization algorithms are easily trapped in local minima, convergence heavily depends on initialization and fail to converge when high non-linearities exist. Usually, each neuron in feedforward neural networks implements a linear combination and a non-linear mapping. The former is usually trained, 234 IEEE JOURNAL OF SELECTED TOPICS IN SIGNAL PROCESSING, VOL. 18, NO. 2, MARCH 2024 while the latter remains fixed. The non-linear activation function allows to generate non-linear mappings, which increases the expressiveness of the network. A common choice is the sigmoid function, although it exhibits well-known issues in its implementation: since the sigmoid saturates at large magnitudes the propagated gradients vanish, slowing down the learning process. The rectified linear unit (ReLU) replaced the sigmoid activation function because it does not suffer from vanishing gradients and it is computationally efficient, which results in faster convergence. Despite its popularity, ReLU also experiences several weaknesses that hinder the learning capacity of the model: the correspondingneuroncanbecomedeadwhentheoutputremains negative for a long time; likewise, the output is unbounded, which may produce the opposite effect of exploding gradient, making the network unstable. Many variations and novel activation functions have been designed to enhance the performance of neural networks, although this highly depends on the application and the statistics of the data. In this respect, few authors have tackled the problem of AAF, in which the non-linear mapping is also trained to enhance the expressiveness of the network. In [8] the saturation level and slope of an S-shaped activation function can be tuned independently, which increases the expressiveness with respect to the sigmoid function. In a different vein, several authors proposed to approximate an arbitrary activation function using cubic splines [18],[19]. Later on, some authors introduced an activation function as a weighted sum of basis, such as sine, Gaussianorsigmoid[20],[21].Morerecently,theauthorsin[22] propose an asymmetric S-shaped activation function, but only for regression tasks. The issues derived from these perspective is that they either constrain the geometry of the activation function, or the parametrization is too complex. In this work we empirically prove that having pre-specified activation functions result in suboptimal performance. In the context of deep learning, several AAF have been designed as well. In [23] the authors propose a gradient adaptive piecewise linear activation function as a sum of hinge-shaped functions. Although they theoretically prove that any piecewise linear function can be expressed as so, this constrains the function to be linear at both extremes. In other words, it does not prevent the neural network from exploding gradients. In [24] an S-shaped rectified linear activation function is proposed. While this model can learn non-linear and non-convex representations, it is not smooth and still constrains the activation to be defined in a piece-wise fashion. The authors in [25] develop a piecewise polynomial form which can approximate any continuous function. However, the exponential nature of the polynomials may increase the dynamic range of the parameters, which is a non-desirable property for gradient-based procedures. In [26], theReLUissubstitutedbyanS-shapedactivation,whichslightly outperforms the ReLU and its variants in different deep learning tasks. In [27],[28],[29],[30] different authors propose to model the activation as a sum of basis functions for deep learning tasks. There have been also attempts to implement activation functions using Fourier models. In [31] the authors consider a binarized neural network, where tunable parameters only have 1 b. This makes the activation function to be the step function and, therefore, the gradient is zero almost everywhere. To make the modeltrainable, the stepfunction is approximatedwith aFourier series,which preventsthegradient vanishing effect.Other works propose numerical solutions to specific mathematical models by applying Extreme Learning Machines (i.e., feed-forward neural networks)withFourierbasis functions.In[32],theFourierseries basis is used to solve the one-dimensional asset pricing model. In[33] theauthorsextendthe workwitha productof trigonometric functions to cope with the specific multi-dimensional case that solves the generalized Black–Scholes partial differential equation. In the same vein of ELM with trigonometric activation functions is [34], where numerical solution is found to integrodifferential equations for risk theory. However, all these works, which do not resort to gradient-based backpropagation to work, are designed to solve specific numerical system of equations. Conversely, the ENN tries to solve the general problem of multi-dimensional function approximation. In the following section we propose a Fourier-based parametrization for non-linear functions. This is the first approach to model AAF from a signal processing perspective. The proposed model does not constrain the shape of the activation functionand keepsthe numberof trainableparameters lowwhile circumventing the shortcomings of the previously proposed non-linear models. III. FOURIER MODELS FOR NON-LINEAR FUNCTIONS Consider a scalar univariate function f(x)to be approximated over the input variable range x∈[−1,1]. One of the most popular approximations for non-linear systems is the Volterra model. Given the function representation by the inverse Fourier transform, f(x)= 1 2π∞ −∞ F(w)ejwx dw, (2) where wis the frequency variable and F(w)are the Fourier coefficients, the Volterra model is obtained by using the Taylor series expansion of the exponential family: f(x)= 1 2π∞ −∞ F(w)∞  n=0 (jw)n n!xndw =∞  n=0 1 2π 1 n!∞ −∞ F(w)(jw)ndw   cn xn(3) The building blocks of (3) are power functions of the input variable, which generate a polynomial approximation. Notice that the coefficients cncorrespond to the n-th derivative at the origin divided by the factorial of the index. Volterra has not been widely used in practice because the exponential nature of the basis functions heavily increase the dynamic range, even when the input is bounded. Moreover, outside the dynamic range the approximation is unbounded and cannot be controlled. This happens because Volterra is a Taylor approximation and it presents high accuracy near the origin only. Moreover, the coefficients change with respect to how many are preserved, as the kernels MARTINEZ-GOST et al.: ENN: A NEURAL NETWORK WITH DCT ADAPTIVE ACTIVATION FUNCTIONS 235 are not orthogonal. All these concerns make this approximation not suitable for gradient-based learning algorithms [10]. One possible approach to solve these issues is the representation using a finite number of terms in the Fourier approximation in (2), which corresponds to the Discrete Fourier Transform (DFT). Outside the dynamic range of xthe function is periodically extended, generating discontinuities at the border. As a result, the number of coefficients required to approximate the function is highly sensitive to these discontinuities. To prevent this phenomenon the function can be extended with even symmetry and, then, periodically extended. This smooths out the edges and its corresponding derivatives, reducing the number of required coefficients with respect to the DFT. This is known as the Discrete Cosine Transform (DCT), which has the following expression: f(x)≈ Q  q=1 gqFqcos π(q−1)(2z+1) 2N,(4) with z=N 2(1 + x),g1=1/√Nand gq=2/N otherwise. The Fq∈Rare termed the DCT coefficients. Notice that for functions with odd symmetry, only the odd coefficients are retained. In general, the quality of approximation is more than sufficient for Q=12(i.e., 6 coefficients in odd functions). For the sake of brevity, the following definition will be used when needed: cosi(x)=cosπ 2N(2i−1) (N(x+1)+1) (5) In [10] we propose an adaptive design in which the DCT coefficients of (4) are tuned using the LMS algorithm in a supervised setting to approximate an univariate function. There are plenty of advantages in using the DCT representation: The required coefficients to provide the same quality (i.e., approximation error) arefewerandthesearerealandorderedindecreasingmagnitude. Sincethebasisfunctions areorthogonal,theapproximationerror can be easily controlled by the magnitude of the disregarded coefficients, and it simplifies the convergence of the learning procedure. Furthermore, see that the coefficient index appears in the phase of (4), so the approximation is real and bounded, even when the input exceeds the dynamic range. All these features make the DCT an appropriate function approximation, whose coefficients can be learnt by a gradient-based rule. A. Extension of the DCT to Multiple Input Variables The extension of the DCT representation to multiple input variablesisnottrivial.Considerabivariatefunction,whichcould be parameterized by a 2-dimensional (2D) DCT as f(x1,x 2)= N  n=1 N  m=1 Fnm cosn(x1)cos m(x2) ≈ Q  n=1 Q  m=1 Fnm cosn(x1)cos m(x2)(6) Note that this model has the following drawbacks: In general the number of coefficients grows exponentially with the number of inputs, M0,asQM0, as well as the complexity of the DCT; while the coefficients in the DCT are ordered in decreasing magnitude, the structure of the indexes is broken in the 2D-DCT. This is, the location (n, m)of the relevant coefficients changes withthe functionof interest;this implies that,unless thefunction is known a priori, the indexes (n, m)are unknown and a supervised learning procedure is hard to implement. This happens for instance in classification problems, where the function is unknown and to be discovered. Inthe following wewill present ENN,a neural networkmodel integratingtheDCTinasingledimensionandwhosecoefficients can be trained in a supervised fashion. IV. DCT-ADAPTIVE ACTIVATION FUNCTIONS A perceptron (or neuron) is a non-linear processor involving a weighted sum and a non-linear function. It is described by the following expressions: z=a0+ M0  i=1 aixi=aT[1 xT]T(7) z=N 2(z+1) (8) ˆy=σ(z)≈ Q/2  q=1 Fqcos π(2q−1)(2z+1) 2N = Q/2  q=1 Fqcosq(z)(9) In (7),xcontains M0inputs and a 1 is appended for the bias term a0. The normalization in (8) is needed to map the input to [0,N], assuming the input is confined to [−1,1]. Nevertheless, as it will be seen later, the first linear transformation may map zto a different range, providing expressiveness to the network. Finally, the non-linear activation function σ(·)is approximated by the DCT with Q/2coefficients. Without loss of generality, gqis assumed to be integrated in the DCT coefficient Fq.In(9) we assume the non-linearity to have odd symmetry, so that only the odd coefficients are retained. As it will be explained later on in Section IV-B and shown empirically in Section VI,this does not prevent the network from learning only odd activation functions. A total of M0+Q/2+1parameters per perceptron are to be trained, which only represents an increment of Q/2 coefficients with respect to a standard perceptron with a fixed activation functions. As mentioned in the previous section, Qis small due to the energy compaction property of the DCT (e.g., around Q/2=6coefficients). Example 1 (Linear discriminant): Assume M0=2, we want to discriminate when x1>x 2. This can be framed as a classification problem, for which we can take a=a[0 1 −1]T, where ais a positive constant. Then, any odd monotone increasing function will discriminate the two hypothesis. For the sake of simplicity, take a=1and the non-linearity approximated with only one coefficient (i.e., F1=−1). This results in z=x1−x2(10) 236 IEEE JOURNAL OF SELECTED TOPICS IN SIGNAL PROCESSING, VOL. 18, NO. 2, MARCH 2024 z=N 2(x1−x2+1) (11) ˆy=−cos π(2z+1) 2N≈sin π 2(x1−x2)(12) The solution in (12) provides a soft-decision, whereas a harddecision would take the sign, i.e., sign(ˆy). While there are infinite solutions for this example, the proposed scheme only increases the complexity by one extra coefficient (i.e., F1). Implementing a linear σ(·)would require many coefficients and provide no further benefit in terms of performance. In Example 1there are infinite minimums, all optimal. Nevertheless, in more complex problems (e.g., high-order discriminants) the expressiveness of a single perceptron is not enough. In light of the universal approximation theorem, in the following we will increase the capabilities of the network by including a hidden layer of several neurons. This model, termed ENN, will be fully-adaptive as both the linear weights and the activation functions will be trained in a supervised fashion. A. Expressive Neural Network (ENN) As a single layer perceptron limits the capabilities of the network, we will include another processing layer to increase its expressiveness. For a general multi-layer perceptron of L layers, the following expressions show the perceptron signals at the l-th layer: zl=AT l[1 sT l−1]T(13) zl=N 2(zl+1) (14) sl=σl,m(zl)(15) for l=1,...,L. The first input and last output correspond to s0=xand ˆy=sL, respectively. The matrix of linear weights is Al=[a(1) l... a(Ml) l]and Mlstands for the number of perceptrons at layer l, with M0being the number of inputs. The operations in (14) and (15) are performed element-wise. The AAF in the ENN, this is, the m-th element of (15) is computed as sl[m]= Q/2  q=1 F(m) q,l cosq(zl[m]),(16) where F(m) q,l corresponds to the q-th coefficient of the m-th perceptron at the l-th layer. As explicitly shown in (15) and (16) theactivationfunctionisnotnecessarilythesameateachneuron, although the number of DCT coefficients Qis kept constant for the whole network. The last activation function could be substituted by an step function in the classification setup and a linearfor regression.However, thiswillbe maintainedso thatthe network can self-adapt depending on the nature of the problem. Fig. 1. A 2-layer perceptron with M1neurons in the hidden layer. Fig. 2. Sigmoid function (dashed) and its DCT representation in the [−1,1] range (solid). As opposed to the M0-dimensional DCT in Section III-A, the proposed model does not require implementing the DCT in M0dimensions and can be trained in a supervised fashion. Furthermore, the number of coefficients grows linearly as M0Q. Throughout the rest of the paper we assume a two input variable, namelyM0=2, and L=2layers. These layers are sequentially termed hidden and output layer. Fig. 1shows the architecture of the two-layer perceptron with M1neurons in the hidden layer and expression (17) shown at the bottom of this page, shows the input-output relationship. B. Expressiveness of Periodic Activation Functions As it will be shown in the experimental results, the expressiveness of the DCT comes from its periodic nature. Fig. 2 shows the sigmoid function and the corresponding DCT representation in the [−1,1] range using Q/2=6 coefficients. While the sigmoid function saturates outside the range, the DCT approximationoffers aperiodicinfinitenon-linearity.Thisoffers more capacity to the activation function, as the network may ˆy= Q/2  m=1 F(1) m,2cosm⎛ ⎝a(1) 2[0] + M1  k=1 a(1) 2[k] Q/2  q=1 F(k) q,1cosqa(k) 1[0] + a(k) 1[1]x1+a(k) 1[2]x2⎞ ⎠(17) MARTINEZ-GOST et al.: ENN: A NEURAL NETWORK WITH DCT ADAPTIVE ACTIVATION FUNCTIONS 237 Fig. 3. Bump generation. Mapping of a linear combination of two inputs over the response of a non-linear function. choose to work at an increasing range (e.g., [−1,0]), decreasing range (e.g., [−3,−1]), bump range (e.g., [−1,3]), valley range (e.g., [−3,1]), or even with several periods simultaneously (e.g., [−5,3]). Imposing odd symmetry in the DCT representation does not constrain the resulting activation function to be odd. This Fourier model for non-linearities is the first one to provide suchflexibilitytoactivationfunctions,whichis notpossiblewith a fixed non-linearity not implemented with the DCT. Tounderstandhowthenon-linearactivationfunctionmapsthe inputto theoutput space, weuse theconcept ofbump.Considera single neuron with M0=2. Notice that all input pairs satisfying the following equality are mapped to the same non-linear output σ(c): a0+a1x1+a2x2=c, (18) where cis a constant value. Fig. 3(a) shows how expression (18) corresponds to a line in the input space. Fig. 3(b) shows the mapping σ(c)along with the limits of the function in dashed lines, that correspond to extreme values of c.Fig.3(c) shows how all input pairs with σ(c)are mapped in the output space. The bump is generated by evaluating all the input data pairs through the linear transformation and the non-linear mapping. V. SUPERVISED LEARNING A. Backpropagation Rules Consider a dataset D, consisting of (xi,y i)∈D, where the former is a M0-sized vector training sample and the latter is the associated reference (i.e., label in classification, or function valueinneuromorphiccomputing). Givenyiand ˆyi,theerrorcan be computed and propagated throughout the network to adjust the learnable parameters. We assume the loss to be the mean squared error (MSE), ε2=(yi−ˆyi(xi))2,(19) for both classification and regression problems. Notice in (19) we explicitly write the output as a function of the input data. Given a learnable parameter w, the chosen algorithm to update it is LMS. The update rule at a given iteration corresponds to w←w−μ∇ε=w−με −∂˜y ∂w,(20) this is, the parameter is updated by the product of the error by the instantaneous gradient of the output with respect to the parameter. The hyperparameter μis the step size, which controls the convergence speed of LMS. We choose the simplest algorithm to learn the parameters in the neural network because the focus of this work is on the model, not on the training algorithm. In this respect, the experimental results show that even using the instantaneous gradient, LMS converges to a minimum and outperforms state-of-the-art models. Thus, the LMS may be replaced by any other algorithm to speed up convergence, which is out of the scope of this work. Due to the same reason, we do not include the iteration index in the parameter updates. For the 2-layer architecture in Fig. 1, there are 2 set of parameters per layer that need to be updated, namely, the DCT coefficients and the weights from the linear transformation. Starting at the output, the DCT coefficients of the layer l=2 are updated as Fm,2←Fm,2+με ∂˜y ∂Fm,2 =Fm,2+4α1 Qεcosm(z2),(21) for m=1,...,Q/2. The superscript in the parameter is omitted because there is only one perceptron at the output. In general, the step size is modeled as twice the mismatch α1divided by the power of the corresponding input. Since the Q/2cosines used to approximate the non-linearity are orthonormal, the total power is Q/2. This exhibits another advantage of this parametrization as the power remains always constant. In order to update the linear weights from the output layer, the backpropagation procedure allows to propagate the error across the network with respect to previously computed derivatives, which makes it a very efficient algorithm. Therefore, these are updates as a2[k]←a2[k]+με ∂˜y ∂a2[k]=a2[k]+με ∂˜y ∂z2 ∂˜z2 ∂a2[k] =a2[k]−2α3 P1 επ 2s1[k] Q/2  m=1 Fm,2(2m−1) cosm(z2), (22) for k=0,...,M 1, and P1=sT 1s1. The superscript has also been suppressed in this case. Accordingly, the DCT coefficients in the first layer are updated as F(k) q,1←F(k) q,1+με ∂˜y ∂F(k) q,1 =F(k) q,1+με ∂˜y ∂z2 ∂z2 ∂s1[k] ∂s1[k] ∂F(k) q,1 =F(k) q,1 −4α Qεπ 2a2[k]cos q(z1[k]) Q/2  m=1 Fm,2(2m−1) sinm(z2), (23) for q=1,...,Q/2and k=1,...,M 1. And the linear combination of the first layer is updates as a(k) 1[m]←a(k) 1[m]+με ∂˜y ∂a(k) 1[m] =a(k) 1[m]+με ∂˜y ∂z2 ∂z2 ∂s1[k] ∂s1[k] ∂z1[k] ∂z1[k] ∂a(k) 1[m] =a(k) 1[m]+ 238 IEEE JOURNAL OF SELECTED TOPICS IN SIGNAL PROCESSING, VOL. 18, NO. 2, MARCH 2024 2α4 P0 επ2 4a2[k]s0[m] Q/2  p=1 Fp,2(2p−1) sinp(z2) Q/2  q=1 F(k) q,1(2q−1) sinq(z1[k]),(24) for m=1,...,M 0,k=1,...,M 1, and P0=sT 0s0. Without loss of generality, s0[0] = s1[0] = 1, which correspond to the bias terms in the linear combination at each layer. Notice that in all the update rules, the derivative exists and inherits the periodic nature of the cosine transform. To enhance the stability of the convergence, the power of each input, namely P0and P1, can be computed with a damping effect. For instance, P0←βPo+(1−β)sT 0s0(25) at each iteration. The αparameter is set smaller in the output layer, which intuitively reduces the propagation of artifacts to previous layers during training. B. Initialization and Training Procedure The ENN trains all parameters at every backpropagation step, this is, both AAF and linear weights. The AAF are initialized as linear functions, which has shown to provide the best performance. In the hidden layer, the linear weights are initialized to generate bump diversity. As seen in Fig. 3, linear weights can be interpreted as the orientation of the activation functions (or bump) in the output space. For instance, with M1=4the linear weights are initialized to [0, 0, 1], [0, 1, 0], [0,1,−1] and [0,−1,1]. This helps in practice to start the learning process with bumps in different orientations. Finally, the output layer is initialized with linear weights in a uniform distribution in [−0.5,0.5]. This allows to constrain the dynamics and shows that the convergence does not depend on the initialization. Regarding the LMS setup, for the non-linearities we set α1= 10−3in the hidden layer and α2=10 −4in the output layer. For the linear weights we set α3=5·10−3in the hidden layer and α4=5·10−5in the output layer. We keep the step-size constant for all neurons in the same layer. The damping parameter is set to β=0.999 for both layers. Under the assumption that the error between parameters is uncorrelated, this LMS configuration guarantees that 6α1+6α2+α3+α4≈0.01 <0.1,(26) where the right hand side is an upper bound on the error at convergence. Notice that the convergence speed at the output layer is lower than at the hidden layer, which grants an adequate gradient propagation. VI. EXPERIMENTAL RESULTS In the following we will test the ENN for both binary classification and regression problems. As benchmarks, we will test also the following models, in which they all have the same architecture and differ in the activation functions: rReLU: It uses a fixed non-trainable ReLU, this is, σ(z)= max {0,z}. rSigm: It uses a fixed non-trainable sigmoid activation function. Notice that the output saturates for an input of large magnitude. rF-DCT: It uses a fixed non-trainable sigmoid activation function, but modeled with the DCT. Thus, the function does not saturate and it is periodic. Although not an odd function, we include the ReLU because it is the standard activation function in current neural networks. The Sigm model is also included to compare it with F-DCT and assess the gains of a periodic activation function. We acknowledge that the benchmarks have significantly less parameters than the ENN and they will exhibit lower learning capabilities. However, the scope of this work is to show the expressiveness through the adaptability of non-linear functions instead of increasing the width of the architecture. We constrain the number of neurons because we work on interpretability and want to provide a signal processing perspective to the problem. All models are built with M1=6neurons in the hidden layer, and ENN with Q=12parameters in all the non-linearities and N= 512 samples. However, recall that only Q/2coefficients are different from zero because we impose odd symmetry. These are initialized to approximate the identity function. Notice that the output activation function in ReLU and Sigm has to be specifically selected to be either sigmoid in classification or linear (i.e., identity) in regression. Conversely, the ENN will automatically adapt it to approach the required function, which is an advantage of this model with respect to the benchmarks. For both classification and regression problems, a synthetic dataset is generated. All samples come from independent uniform distributions in the [−1,1] range for each input variable. The train and test sets contain 800.000 and 50.000 samples, respectively. A. Classification Table Ishows the different classification problems that have been evaluated. It displays the ideal decision map along with the order of the discriminant. The metric chosen to compare the different models is the test accuracy, this is, the percentage of correctly classified samples in the test set. As expected, the complexity of the problem increases with the order of the discriminant. As seen in Example 1, a single neuron is sufficient to implement a linear discriminant, which results in anexcellentperformanceforallmodelsin(P1).Withnosurprise, for quadratic (P2) and cubic (P3) discriminants all models are capable of finding the appropriate boundary. However, ENN attains almost an excellent performance. This may be claimed due to the larger number of parameters in the proposed model with respect to the benchmarks. When moving to high-order classification problems is when the non-adaptive models are not capable of providing a satisfactory solution. Conversely, the ENNmodelmanagestofindalocalminimumwithhighaccuracy and with very consistent results for a wide variety of problems. Fig. 4shows the AAF for (P7). Notice that only one of the activation functions has been adapted, namely Fig. 4(b), which MARTINEZ-GOST et al.: ENN: A NEURAL NETWORK WITH DCT ADAPTIVE ACTIVATION FUNCTIONS 239 TABLE I ACCURACY FOR DIFFERENT BINARY CLASSIFICATION PROBLEMS Fig. 4. AAF in the hidden layer for (P7). exploits the periodic nature of the DCT. The corresponding bumps are shown in Fig. 5, where we clearly confirm that the other AAF have a dynamic range around [−0.5,0.5], which results in zero bumps and, thus, in non-active neurons. The global response of the ENN is shown in Fig. 6(a).Thisis obtained by adding the bumps weighted by the corresponding linear weights of the output layer and, finally, applying the output AAF. As expected, the output AAF for classification problems is an approximation of the step function and it is shown in Fig. 10(a). Since there is only one neuron active, the global response corresponds to the step (or sign) function applied to the bump in Fig. 4(b). Notice, however, that there is a flip between the bump and the global response, which happens because the corresponding linear weight of the output layer is negative. The fact of constraining the model to Q=12 coefficients makes it infeasible to generate an ideal step function in the output layer. Nevertheless, this solution is steeper than a standard sigmoid function, which reduces the error at data close Fig. 5. Bumps corresponding to the AAF in Fig. 4. Fig. 6. Global response of the ENN for two classification problems. Fig. 7. AAF in the hidden layer for (P8). totheboundaryandincreasestheaccuracy.Fromthisexperiment we can also conclude that another advantage of ENN is that it allows to model the network width, this is, the required number of hidden neurons. In other experiments we found out that the ENNgenerates pairs ofidentical bumpsbutwith oppositesign in the output linear weights. This means that the network neglects the information that comes from these two branches. See that this is impossible for the non-adaptive models, which have a very small accuracy even with 6 neurons. Fig. 7shows the AAF for (P8), along with the corresponding bumps in Fig. 8. As expected, the ENN exploits the periodic nature of the DCT and different orientations to generate diversity. Notice that there is almost no drop in accuracy between (P5) 240 IEEE JOURNAL OF SELECTED TOPICS IN SIGNAL PROCESSING, VOL. 18, NO. 2, MARCH 2024 Fig. 8. Bumps corresponding to the AAF in Fig. 7. Fig. 9. Output decision map of (P8) for each of the models. Fig. 10. Output AAF for classification and regression. and (P8), although the latter is more complex. This is due to the expressiveness of the DCT, which allows to generate several peaks per bump. In other words, by allowing the activation to be non-monotone it reuses non-linearities to approximate the ring and both circles still with 6 neurons. Fig. 6(b) shows the global response of the network and Fig. 9shows the different decision boundaries for the different models. Despite the accuracy of the non-adaptive models in Table Ibeing around 80%, the quality is very poor and only the ENN boundary recovers the ideal map. The output activation function converges to the same configuration for all classification problems and it is shown in Fig. 10(a). B. Regression The network can also be trained for regression problems, this is, to approximate a function. Particularly, we compute bivariate scalar functions. Table II shows the MSE achieved by the four different models for three different experiments. While it may be impractical to implement a sum or product with a neural network as the model itself contains many sums and products, TABLE II MSE IN REGRESSION TASKS Fig. 11. Bumps for the regression problem (x2 1+x2 2)/2. these experiments allow to test the learning capabilities of the ENN with respect to the benchmarks. As expected, the gap in performance with respect to the benchmarks is larger in the second and third problem, since these are non-linear problems. Fig. 11 shows the different bumps for the regression problem (x2 1+x2 2)/2. Since the function is symmetric around the center, the ENN chooses to work with non-periodic ranges of the non-linearities. In fact, all bumps correspond to flat surfaces that curve toward the edges. Recall that the curvature of the bump is undetermined as it also depends on the linear weights of the output layer. In fact, the weights of neurons 2, 4 and 6 are negative, meaning that all bumps are convex functions, as they need to be to generate a convex function. Regarding the output activation, it is adapted to the learning task and different from classification. As seen in Fig. 10(b) the activation function approaches a linear function for all regression problems. The function is not perfectly linear because we constrain the system to Q=12coefficients. We underline the idea that in a non-adaptive setting one needs to choose the last non-linearity according to the task. This represents an improvementwith respectto non-adaptivemodels asit isgeneral enough to encompass different tasks. C. Effect of the Number of Coefficients Increasing the number of coefficients Qin the DCT representation theoretically provides more expressiveness to the network. However, in practice, increasing the number of trainable parameters hinders the convergence of the algorithm because there are more local minima. Fig. 12 shows the output AAF for Q={12,20}. Increasing the number of coefficients allows to create a steeper transition, reducing the number of errors around