scieee AI-readable full text Open interactive document viewer

Occult mathematics under the learning process in convolutional neural networks

Borja Robalino, Ricardo Stalin,Monleón Getino, Antonio,Rodellar Benedé, José

Abstract

In the last decade, artificial intelligence has transformed the world. Big Data and large software companies are prompting researchers to create new algorithms that surpass human intelligence more quickly and efficiently. In 2012 convolutional neural networks (CNN) captured the attention of researchers on the subject of image recognition; becoming popular and efficient. However, the lack of information on a meticulous mathematical process and the tendency of authors to describe this method as a black box, implied that a defined architecture, parameters and hyperparameters generate results with an unknown internal process. The present study develops the detailed mathematical model of forward and backward propagation in a CNN for three-dimensional images (in color), providing researchers with solid tools when developing optimizations in the algorithm. In addition, the models were applied to a proposed architecture that allowed recognizing the stages of the process, the number of network learning parameters and complexity focused on computational expenditure. Finally, tables are included with the most used cost, activation and optimization functions that allow the reader to formulate their own model depending on the architecture, functions and hyperparameters chosen.

Full text

Ciencia Latina Revista Científica Multidisciplinar, Ciudad de México, México. ISN 2707-2207/ISSN 2707-2215 (en línea),septiembre-octubre,2022,Volumen 6,Número 5 p 1031 DOI: https://doi.org/10.37811/cl_rcm.v6i5.3158 Occult mathematics under the learning process in convolutional neural networks Ricardo Borja-Robalino [email protected] https://orcid.org/0000-0002-3899-1140 Antonio Monleón-Getino [email protected] https://orcid.org/0000-0001-8214-3205 José Rodellar jose.rodell[email protected] https://orcid.org/0000-0002-1514-7713 ABSTRACT In the last decade, artificial intelligence has transformed the world. Big Data and large software companies are prompting researchers to create new algorithms that surpass human intelligence more quickly and efficiently. In 2012 convolutional neural networks (CNN) captured the attention of researchers on the subject of image recognition; becoming popular and efficient. However, the lack of information on a meticulous mathematical process and the tendency of authors to describe this method as a black box, implied that a defined architecture, parameters and hyperparameters generate results with an unknown internal process. The present study develops the detailed mathematical model of forward and backward propagation in a CNN for threedimensional images (in color), providing researchers with solid tools when developing optimizations in the algorithm. In addition, the models were applied to a proposed architecture that allowed recognizing the stages of the process, the number of network learning parameters and complexity focused on computational expenditure. Finally, tables are included with the most used cost, activation and optimization functions that allow the reader to formulate their own model depending on the architecture, functions and hyperparameters chosen. Keywords: convolutional neural networks; mathematical model; forward and backward propagation; cost function; optimization function. Correspondencia: [email protected] Artículo recibido 10 agosto 2022 Aceptado para publicación: 10 septiembre 2022 Conflictos de Interés: Ninguna que declarar Todo el contenido de Ciencia Latina Revista Científica Multidisciplinar, publicados en este sitio están disponibles bajo Licencia Creative Commons . Cómo citar Borja Robalino, R., Monleón Getino, A., & Rodellar, J. (2022). Matemática oculta bajo el proceso de aprendizaje en redes neuronales convolucionales. Ciencia Latina Revista Científica Multidisciplinar, 6(5), 1031-1063. https://doi.org/10.37811/cl_rcm.v6i5.3158 Occult mathematics under the learning process in convolutional neural networks Ciencia Latina Revista Científica Multidisciplinar, Ciudad de México, México. ISN 2707-2207/ISSN 2707-2215 (en línea),septiembre-octubre,2022,Volumen 6,Número 5 p 1032 Matemática oculta bajo el proceso de aprendizaje en redes neuronales convolucionales RESUMEN En la última década la inteligencia artificial ha transformado el mundo. El Big Data y grandes empresas de software impulsan a investigadores a crear nuevos algoritmos que superan la inteligencia humana con mayor rapidez y eficiencia. En el año 2012 las redes neuronales convolucionales (CNN) captaron la atención de investigadores en el tema del reconocimiento de imágenes; volviéndose populares y eficientes. Sin embargo, la falta de información de un proceso matemático minucioso y la tendencia de autores a describir este método como una caja negra, implicaron que una arquitectura, parámetros e hiperparámetros definidos generen resultados con un proceso interno desconocido. El presente estudio desarrolló un modelo matemático detallado de forward y backward propagation en una CNN para imágenes tridimensionales (a color), dotando a investigadores de herramientas solidas al momento de generar optimizaciones en el algoritmo. Además, los modelos se aplicaron a una arquitectura planteada que permitió reconocer las etapas del proceso, cantidad de parámetros de aprendizaje de la red y complejidad enfocada al gasto computacional. Se incluye tablas con funciones de costo, activación y optimización más utilizadas que permitan al lector formular su propio modelo dependiendo de la arquitectura, funciones e hiperparámetros seleccionados. Palabras clave: redes neuronales convolucionales; modelo matemático; propagación hacia adelante y atrás; función de costo; función de optimización. Borja-Robalino, Monleón-Getino, Rodellar Ciencia Latina Revista Científica Multidisciplinar, Ciudad de México, México. ISN 2707-2207/ISSN 2707-2215 (en línea),septiembre-octubre,2022,Volumen 6,Número 5 p 1033 INTRODUCTION The rapid technological growth has become the artificial intelligence (AI) and its machine learning algorithms in the best option when developing systems which executes actions of decision, reasoning, problem solving and pattern learning or characteristics in similar pattern to the human brain even with greater precision (Namikawa et al., 2020),(Pesapane et al., 2020),(Ghosh & Kandasamy, 2020). One of the algorithms currently blooming is the artificial neural networks (ANN) and especially the convolutional neural networks (CNN) as the result of highly efficiency and effectiveness (LeCun et al., 2015). The ANN and CNN usage became popular in the tech giants such as Google, Facebook, Amazon, Microsoft and others. Since 2009, Google has used ANN in the captchas problems through the reCAPTCHA application. Stanford University managed to generate captions automatically meanwhile Microsoft developed BrainMaker application to attract future buyer customers (Van Houdt et al., 2020). Additionally, there are applications addressed to translations, personal assistants, freelance vehicles among others (Perconti & Plebe, 2020). The existence of various classification algorithms such as: logistic regression, support vector machine, decision trees, XGBoost, random forests, neural networks and deep learning, offers numerous alternatives to researches depending on the type of problem to be solved (Lazzeri, 2020). However, CNN's (deep learning) epic breakthrough in the computer area by vision was in 2012 where a contestants group led by Geoffrey Hinton won first place in the “ImageNet” image classification contest using the AlexNet architecture and achieving results that once again captured the attention of researchers in this algorithm (Krizhevsky et al., 2017). Various authors describe the CNN as algorithms whose process based on logic and mathematical models are presented as a kind of black box where their responses must be accepted regardless of unfamiliarity of their process (Buhrmester et al., 2019)(Sturm et al., 2016)(Baselli et al., 2020). From the mathematical and scientific perspective, it is important the researcher possesses the necessary tools and information in relation to this type of network, in such a way that it allows them to analyze the architecture and its established learning process; recognizing critical points of failure in the algorithm and allowing the possibility of optimizing the posed methodology and programming. Occult mathematics under the learning process in convolutional neural networks Ciencia Latina Revista Científica Multidisciplinar, Ciudad de México, México. ISN 2707-2207/ISSN 2707-2215 (en línea),septiembre-octubre,2022,Volumen 6,Número 5 p 1034 The present research aims to demystify CNNs as black boxes, through the detailed mathematical development of learning process of a network (forward and backward propagation), providing researchers with a solid and complete mathematical knowledge of this type of networks developed for the three-dimensional case, considering that there is no detailed information only for the two-dimensional case. In addition, the approach of the models on an architecture of a CNN is exemplified; applying a standard activation, cost and optimization function. Finally, tables are presented with the most used functions, easing readers the possibility of introducing any of them to the model depending on the need. THEORETICAL BACKGROUND For the mathematical development, the basic knowledge about: convolutional neural network, mathematical formulas for the convolution process, introduction of nonlinearity, loss functions, optimization and network learning process were considered. Convolutional Neural Networks (CNN) Convolutional neural networks (CNN) seek to imitate the behavior of the human visual cortex, which processes simple and highly complex images at extraordinary speed (Asghar et al., 2019). CNNs are quite similar to artificial neural networks with the following differences: the network assumes an image directly as input, a convolution operation is executed between the input matrix and the established kernel, there is a pooling layer that allows reducing the dimension and thus the number of parameters (Wadawadagi & Pagi, 2020). CNNs are generally composed of three essential layers allowing the network to learn different levels of abstraction. The first is a convolution layer, in many cases followed by a pooling layer and finally a fully connected layer (exactly the same as an ANN). Layers Convolutional Layer The convolution operation (Equation 1) allows the network to learn spatial hierarchies of local patterns, working under regions of established dimensions by the user, which facilitates the detection of certain visual features such as contours, edges, color drops, lines, etc.(Dhillon & Verma, 2020). This process allows recognizing a certain characteristic in a specific place in the image and then being able to detect it in any location it is being found, unlike ANNs that only learn global patterns. In this layer the parameters are a set Borja-Robalino, Monleón-Getino, Rodellar Ciencia Latina Revista Científica Multidisciplinar, Ciudad de México, México. ISN 2707-2207/ISSN 2707-2215 (en línea),septiembre-octubre,2022,Volumen 6,Número 5 p 1035 of three-dimensional filters that are adjusted as the network learns, allowing data to be transformed in such a way that certain characteristics become more dominant in the output image (Minaee et al., 2020). Its mathematical formulation is presented in the following equation: 𝐶=𝑔 [𝑊 ∗ 𝑋+ 𝑏] where: W = weight or kernel; X = input matrix; b = bias; ∗ = convolution operation; g = activation function. Pooling layer They are often located after a convolutional layer and their function is to generate a simplification process or parameters reduction progressively, avoiding over-fitting the network. As a result, a region with condensed information is obtained, maintaining the input spatial relationship (Lopez-Pinaya et al., 2020). This type of layer generally works under two possible options:  Max-pooling (Equation 2). - It is the most widely used, the size of the subregion is variable for convenience, its objective is to find the maximum value a twodimensional window sample and pass it as a result. Its process is very similar to that used by the human visual cortex (Wu, 2017). 𝑃𝑚𝑎𝑥=max(𝐶𝑖,𝑗) ; 𝐶𝑖,𝑗= two-dimensional window in C output.  Average-pooling (Equation 3). – unlike max-pooling, its result comes from the mean (average) value within the two-dimensional window (Lee et al., 2009; Wu, 2017). 𝑃𝑎𝑣𝑒𝑟𝑎𝑔𝑒=1 𝑃𝑜∑(𝐶𝑖,𝑗) where: Po = pooling window size; Fully or densely connected layer In this layer, the operating process is similar to an artificial neural network (Equation 4), using the perceptron as the fundamental unit. The sum of inputs multiplied by the associated weights and added a bias (polarization) constitutes the neuron linear activation (Martineau et al., 2020). The non-linearity to the system is introduced through an activation function, becoming in this case (CNN) in the final phase of image classification. A convolutional network architecture can contain one or more fully connected layers. The convolutional layer as well as the densely connected one have an identical functional form which allows conversions between them, taking into account (2) Occult mathematics under the learning process in convolutional neural networks Ciencia Latina Revista Científica Multidisciplinar, Ciudad de México, México. ISN 2707-2207/ISSN 2707-2215 (en línea),septiembre-octubre,2022,Volumen 6,Número 5 p 1036 that in the first case the connections are made to a local region in the input while in the second one works with the global region (Dhillon & Verma, 2020)(Kim, 2014). 𝑌=𝑔[𝑊∙𝑋+𝑏] ; ∙ = matrix product Parameters and hyperparameters In a CNN, the parameters constitute those variables internal to the mathematical model of the network (weights and biases), which can be estimated or learned from the input data. Hyper-parameters are external elements configuration adjusting the learning process and are established by the programmer through experience and intuition depending on the type of architecture or problem to be analyzed. Among the best known hyper-parameters at the structure, topology or algorithm level we have: number of layers, function activation functions, loss functions, neurons number, learning rate, decay, momentum, nesterov, epochs, batch size, dilation, dropout, normalization, kernel size, filter numbers, padding, stride, etc (Rawat & Wang, 2017). Funciones de costo It allows to quantify the error (cost) coming between the expected and predicted output during the network learning process, in short; assesses how well the algorithm predicts (Janocha & Czarnecki, 2017). Loss functions can be regression or classification; among the most used are (See Table 1): Borja-Robalino, Monleón-Getino, Rodellar Ciencia Latina Revista Científica Multidisciplinar, Ciudad de México, México. ISN 2707-2207/ISSN 2707-2215 (en línea),septiembre-octubre,2022,Volumen 6,Número 5 p 1037 Table 1. Cost Functions. Identification Formula Characteristics Regression Mean squared errors (MSE)(Parmar, 2018) 𝐸= ∑(𝑌𝑖 −𝑌𝑖)2 𝑛𝐼=12𝑛 𝑌𝑖 =𝑝𝑟𝑒𝑑𝑖𝑐𝑡𝑒𝑑 ; 𝑌𝑖=𝑟𝑒𝑎𝑙 It is the average of the squared difference between the predicted and actual values. Mean absolute errors (MAE)(Parmar, 2018) 𝐸= ∑|𝑌𝑖 −𝑌𝑖| 𝑛𝑖=1𝑛 𝑌𝑖 =𝑝𝑟𝑒𝑑𝑖𝑐𝑡𝑒𝑑 ; 𝑌𝑖=𝑟𝑒𝑎𝑙 It is the average of the absolute differences between the predicted and actual values. Binary classification Binary crossentropy (Log loss) (Parmar, 2018). 𝐸=−∑[𝑌𝑖∙log(𝑌𝑖 )+(1−𝑌𝑖)∙log(1−𝑌𝑖 )] 𝑛 𝑖=1 𝑌𝑖=𝑟𝑒𝑎𝑙 ;𝑌𝑖 =𝑝𝑟𝑒𝑑𝑖𝑐𝑡𝑒𝑑 It is commonly used where the loss increases as the predicted probability differs from the real one, also called negative logarithmic probability. Multiclass classification Multi-class cross entropy (categoricalcrossentropy) (Haykin, 2009). 𝐸=− ∑∑𝑌𝑖𝑗∙log (𝑌𝑖𝑗 ) 𝑐 𝑗=1 𝑛 𝑖=1 𝑌𝑖𝑗 = Probability of ith element in j. It is a generalization of binary cross entropy. 𝑌𝑖𝑗 = 1 If the ith element is in j 𝑌𝑖𝑗= 0 other case. Kullbackleibler divergence (𝐷𝐾𝐿(𝑃‖𝑄)) (Kullback & Leibler, 1951). −∑∑[𝑃(𝑌𝑖𝑗)∙logQ(𝑌𝑖𝑗)−𝑃(𝑌𝑖𝑗) 𝑐 𝑗=1 𝑛 𝑖=1 ∙log𝑃(𝑌𝑖𝑗)] 𝑃(𝑌𝑖𝑗)= Real probability of ith element in j. 𝑄(𝑌𝑖𝑗)= Predicted probability of ith element in j. Similar to multi-class entropy and is called relative entropy of P with respect to Q. If the divergence is 0, distributions are equal. Activation functions (FA) The activation functions are used in each convolutional and densely connected layer, introducing non-linearity to the mathematical model (activation potential z) of the posed architecture [26]. The process is necessary knowing that an image has many non-linear elements. This type of model is not subject to the superposition principle, where a linear problem might be decomposed into 2 or more simpler sub-problems (Berzal, 2018). FAs are chosen depending on the task that the neurons must perform; Among the widely used are (See Table 2): (9) (5) (6) (7) (8) Occult mathematics under the learning process in convolutional neural networks Ciencia Latina Revista Científica Multidisciplinar, Ciudad de México, México. ISN 2707-2207/ISSN 2707-2215 (en línea),septiembre-octubre,2022,Volumen 6,Número 5 p 1038 Table 2. Activation functions. Identification Formula Derivative Characteristics Sigmoid(Berzal , 2018). 𝑔(𝑧)=1 1+𝑒−𝑧 𝑔′(𝑧) =𝑔(𝑧)[1−𝑔(𝑧)] g(z) tends to 0 when z tends to −∞ and tends to 1 when tends to +∞. The function range is: (0,1). Hyperbolic tangent (TanH)(Berzal, 2018). 𝑔(𝑧)=𝑒𝑧−𝑒−𝑧 𝑒𝑧+ 𝑒−𝑧 𝑔′(𝑧)=1−𝑔(𝑧)2 It is a Sigmoid’s re-scaled version and has higher derivatives, which contributes to learning. The function range is: [−1,1]. Rectified linear unit (ReLU)(Gu et al., 2018). 𝑔(𝑧)=max (0,𝑧) (14) 𝑔(𝑧) = {0; 𝑓𝑜𝑟 𝑧<0 𝑧; 𝑓𝑜𝑟 𝑧≥0 𝑔′(𝑧) = {0,𝑓𝑜𝑟 𝑧<0 1,𝑓𝑜𝑟 𝑧≥0 (15) It is the most used in Deep Learning. The function range is:[0,∞). LeakyReLU (Gu et al., 2018). 𝑔(𝑧)=max(𝜖𝑧,𝑧) (16) 𝜖≪1 𝑔(𝑧){0.01𝑧; 𝑓𝑜𝑟 𝑧<0 𝑧 ; 𝑓𝑜𝑟 𝑧≥0 𝑔′(𝑧){0.01,𝑓𝑜𝑟 𝑧<0 1 ,𝑓𝑜𝑟 𝑧≥0 (17) It is similar to ReLU, with the difference that for negative values there is a constant slope (generally 0.01). The function range is:[0,∞). SoftPlus(Gloro t et al., 2011). 𝑔(𝑧)=ln (1 + 𝑒𝑧) (18) 𝑔′(𝑧)=1 1+𝑒−𝑧 (19) It is a ReLU’s smooth approximation and is distinguishable throughout. In some cases, it is used in the last layer. The function range is: (−∞,+∞). Softmax(Zhang et al., 2018). 𝑔𝑖(𝑧)= 𝑒𝑧𝑖 ∑𝑒𝑧𝑗 𝐽𝑗=1 (20) J = number of classes. ∀𝑖 ∈1….𝐽 𝑔′(𝑧) =𝑔(𝑧)[1−𝑔(𝑧)] 𝑖𝑓 𝑖=𝑗 (21) 𝑔′(𝑧) =𝑔𝑖(𝑧)[1−𝑔𝑗(𝑧)] 𝑖𝑓 𝑖≠𝑗 It takes as input a vector z and normalizes it to a probability distribution. The function range is: (0,1). Optimization functions (FO) The network optimization goal is to minimize the cost function, reducing the error between the desired and predicted output; by estimating and adjusting the model parameters (architecture) (Rao et al., 2018). The FO uses the partial derivatives (gradient) of the loss function evaluated with respect to the current weight 𝐸(𝑊), getting iteratively and gradually to determine the best combinations of weights 𝑊∗ and biases 𝑏∗ that allows reaching the global minimum of the function where 𝐸(𝑊∗)≼𝐸(𝑊) and 𝐸(𝑏∗)≼ (11) (12) (10) (13) Borja-Robalino, Monleón-Getino, Rodellar Ciencia Latina Revista Científica Multidisciplinar, Ciudad de México, México. ISN 2707-2207/ISSN 2707-2215 (en línea),septiembre-octubre,2022,Volumen 6,Número 5 p 1039 𝐸(𝑏); fulfilling the optimality condition [∇𝐸 (𝑊∗)=0] where ∇ = [𝜕 𝜕𝑊1,𝜕 𝜕𝑊2,.. 𝜕 𝜕𝑊𝑛]𝑇. The main algorithm used for optimization in convolutional neural networks is the Stochastic Descending Gradient (Bottou, 2012) (See Table 3). Table 3. Stochastic gradient. Identification Formula Characteristics Stochastic gradient descent (SGD)(Bottou, 2012) 𝑊𝑡+1=𝑊𝑡− 𝜂 ∇(𝑊𝑡) (22) 𝜂=𝑙𝑒𝑎𝑟𝑛𝑖𝑛𝑔 𝑟𝑎𝑡𝑒 ; ∇ =𝑔𝑟𝑎𝑑𝑖𝑒𝑛𝑡 ∇(𝑊𝑡)=𝜕𝐸 𝜕𝑊𝑡 ;𝑡=𝑖𝑡𝑒𝑟𝑎𝑡𝑖𝑜𝑛 (𝑒𝑝𝑜𝑐ℎ) Similar to the descending gradient, with the difference it is updated by small random samples of the training set (mini batches), which allows it to be more scalable and faster. There are different optimization algorithms for the stochastic descending gradient, among the best known are the following (See Table 4): Table 4. Optimization function of SGD. Identification Formula Characteristics Momentum (M)(Ruder, 2017) 𝑀𝑡=𝛾𝑊𝑡−1− 𝜂 ∇(𝑊𝑡) (23) ∴ 𝑊𝑡+1=𝑊𝑡−𝑀𝑡 𝛾=𝑖𝑚𝑝𝑢𝑙𝑠𝑒 ; 𝛾<1 Speed SGD in the convergence direction and dampen oscillations Generally 𝛾=0.9 Nesterov accelerated gradient (NAG)(Ruder, 2017) 𝑀𝑡=𝛾𝑊𝑡−1− 𝜂 ∇(𝑊𝑡−𝛾𝑀𝑡−1) (24) ∴ 𝑊𝑡+1=𝑊𝑡−𝑀𝑡 Optimizes SGD with moments, avoiding very long jumps through a correction in the previous gradient 𝛾𝑀𝑡−1. Avoid going too fast and reaching a divergence. Gradient based algorithm (Adagrad)(Ruder , 2017) 𝑊𝑡+1=𝑊𝑡−𝜂 √𝜀𝐼+𝑑𝑖𝑎𝑔(𝐺𝑡)∙∇𝑡 (25) ∇𝑡=1𝑛∑∇(𝑊𝑡) 𝑛 𝑖=1 ; 𝐺𝑡= ∑∇𝑡∇𝑡𝑇 𝑡 𝜏=1 𝜂=𝑖𝑛𝑖𝑡𝑖𝑎𝑙 𝑙𝑒𝑎𝑟𝑛𝑖𝑛𝑔 𝑟𝑎𝑡𝑒; 𝜀 ≪1 ∇𝑡 =𝑔𝑟𝑎𝑑𝑖𝑒𝑛𝑡 𝑒𝑠𝑡𝑖𝑚𝑎𝑡𝑖𝑜𝑛 𝑖𝑛 𝑡ℎ𝑒 𝑖𝑛𝑡𝑒𝑟𝑣𝑎𝑙 𝑡 𝐺𝑡 =𝑔𝑟𝑎𝑑𝑖𝑒𝑛𝑡 𝑒𝑠𝑡𝑖𝑚𝑎𝑡𝑖𝑜𝑛 𝑖𝑛 𝑡ℎ𝑒 𝑖𝑛𝑡𝑒𝑟𝑣𝑎𝑙 𝑡 Adapt the learning rate through small updates in parameters that act within common and unusual image characteristics. Scales with respect to the accumulated square gradient in each iteration t in each dimension. 𝜖≈1−8 Adadelta(Ruder, 2017) 𝑊𝑡+1=𝑊𝑡−𝜂 √𝜀 𝐼+𝐸[∇2]𝑡∙∇𝑡 (26) 𝐸[∇2]𝑡=𝛾𝐸[∇2]𝑡−1+(1−𝛾)∇𝑡2 𝛾=𝐼𝑚𝑝𝑢𝑙𝑠𝑒 It is an Adagrad extension that reduces the monotonically and decreasing aggressive learning rate. Adadelta restricts the accumulated past gradients to a fixed size of the last 𝐸[∇2]𝑡−1 gradients. Occult mathematics under the learning process in convolutional neural networks Ciencia Latina Revista Científica Multidisciplinar, Ciudad de México, México. ISN 2707-2207/ISSN 2707-2215 (en línea),septiembre-octubre,2022,Volumen 6,Número 5 p 1046 The input spread 𝑋𝐹𝐶 𝐿 is: 𝑋𝐹𝐶.𝑎𝑐𝑡𝑢𝑎𝑙 𝐿= 𝑋𝐹𝐶.𝑖𝑛𝑖𝑡𝑖𝑎𝑙 𝐿− 𝜂∇(𝑋𝐹𝐶 𝐿) The input updating 𝑋𝐹𝐶 in a densely connected layer would be: 𝑋𝐹𝐶.𝑎𝑐𝑡𝑢𝑎𝑙 𝐿= 𝑋𝐹𝐶.𝑖𝑛𝑖𝑡𝑖𝑎𝑙 𝐿− 𝜂[∆𝑒∙𝑊𝑇] Hidden or intermediate densely connected layers Weigh updating 𝑾𝒊,𝒋 in densely connected layer. 𝑊𝑎𝑐𝑡𝑢𝑎𝑙= 𝑊𝑖𝑛𝑖𝑐𝑖𝑎𝑙− 𝜂∇(𝑊) Whereby. ∇𝑊𝑖,𝑗=𝜕𝐸 𝜕𝑊𝑖,𝑗 Applying the chain rule. ∇𝑊𝑖,𝑗=∑∑𝜕𝐸 𝜕𝑌𝑖𝜕𝑌𝑖 𝜕𝑊𝑖,𝑗 𝑣 𝑗=1 𝑢 𝑖=1 ; 𝑤ℎ𝑒𝑟𝑒: 𝑌𝑖= 𝑋𝐹𝐶 𝐿 ∇𝑊𝑖,𝑗=∑∑∇𝑋𝐹𝐶 𝐿𝜕 𝜕𝑊𝑖,𝑗𝑔(∑∑𝑊𝑖,𝑗𝑋𝑖,𝑗 𝐿−1 𝑣 𝑗=1 +𝑏𝑖 𝑢 𝑖=1 ) 𝑣 𝑗=1 𝑢 𝑖=1 ∇𝑊𝑖,𝑗=∑∑∇𝑋𝐹𝐶 𝐿 𝑑(𝑔)𝑋𝑖,𝑗 𝐿 𝑣 𝑗=1 𝑢 𝑖=1 ; 𝑤ℎ𝑒𝑟𝑒: ∇𝑋𝐹𝐶 𝐿= ∆𝑒∙(𝑊𝑖,𝑗 𝐿)𝑇 ∇𝑊𝑖,𝑗=∆𝑒∙(𝑊𝑖,𝑗 𝐿)𝑇 𝑑(𝑔)𝑋𝑖,𝑗 𝐿−1 The actual weigh spread 𝑊𝑎𝑐𝑡𝑢𝑎𝑙 is: 𝑊𝑎𝑐𝑡𝑢𝑎𝑙= 𝑊𝑖𝑛𝑖𝑡𝑖𝑎𝑙− 𝜂∇(𝑊) Borja-Robalino, Monleón-Getino, Rodellar Ciencia Latina Revista Científica Multidisciplinar, Ciudad de México, México. ISN 2707-2207/ISSN 2707-2215 (en línea),septiembre-octubre,2022,Volumen 6,Número 5 p 1047 Therefore, the weigh updating in a densely connected layer would be: 𝑊𝑎𝑐𝑡𝑢𝑎𝑙= 𝑊𝑖𝑛𝑖𝑡𝑖𝑎𝑙− 𝜂 [∆𝑒 ∙(𝑊𝑖,𝑗 𝐿)𝑇 𝑑(𝑔)𝑋𝑖,𝑗 𝐿−1] 1. Bias updating 𝒃𝒋 densely connected layer. 𝑏𝑎𝑐𝑡𝑢𝑎𝑙= 𝑏𝑖𝑛𝑖𝑡𝑖𝑎𝑙− 𝜂∇(𝑏) Whereby. ∇𝑏𝑖=𝜕𝐸 𝜕𝑏𝑖 Applying the chain rule, it is: ∇𝑏𝑖=∑∑𝜕𝐸 𝜕𝑌𝑖𝜕𝑌𝑖 𝜕𝑏𝑖 𝑣 𝑗=1 𝑢 𝑖=1 ∇𝑏𝑖=∑∑∇𝑋𝐹𝐶 𝐿𝜕 𝜕𝑏𝑖𝑔(∑∑𝑊𝑖,𝑗𝑋𝑗𝐿 𝑣 𝑗=1 +𝑏𝑖 𝑢 𝑖=1 ) 𝑣 𝑗=1 𝑢 𝑖=1 ∇𝑏𝑖=∑∑∆𝑒∙(𝑊𝑖,𝑗 𝐿)𝑇 𝑑(𝑔) 𝑣 𝑗=1 𝑢 𝑖=1 The actual bias spread 𝑏𝑎𝑐𝑡𝑢𝑎𝑙 is: 𝑏𝑎𝑐𝑡𝑢𝑎𝑙= 𝑏𝑖𝑛𝑖𝑡𝑖𝑎𝑙− 𝜂∇(𝑏) Therefore, bias updating in a densely connected layer would be: 𝑏𝑎𝑐𝑡𝑢𝑎𝑙= 𝑏𝑖𝑛𝑖𝑡𝑖𝑎𝑙− 𝜂[∆𝑒∙ (𝑊𝑖,𝑗 𝐿)𝑇 𝑑(𝑔)] Input updating 𝑿𝑭𝑪 𝑳 in the densely connected layer. In the backpropagation process, the last convolution or pooling layer becomes the input of the densely connected layer; therefore, updating this input 𝑋𝐹𝐶 𝐿 would be: 𝑋𝐹𝐶.𝑎𝑐𝑡𝑢𝑎𝑙 𝐿= 𝑋𝐹𝐶.𝑖𝑛𝑖𝑡𝑖𝑎𝑙 𝐿− 𝜂∇(𝑋𝐹𝐶 𝐿) Occult mathematics under the learning process in convolutional neural networks Ciencia Latina Revista Científica Multidisciplinar, Ciudad de México, México. ISN 2707-2207/ISSN 2707-2215 (en línea),septiembre-octubre,2022,Volumen 6,Número 5 p 1048 ∇𝑋𝐹𝐶 𝐿=𝜕𝐸 𝜕𝑋𝐹𝐶 𝐿 Applying the chain rule, it is: ∇𝑋𝐹𝐶 𝐿=∑∑𝜕𝐸 𝜕𝑌𝑖𝜕𝑌𝑖 𝜕𝑋𝐹𝐶 𝐿 𝑣 𝑗=1 𝑢 𝑖=1 ∇𝑋𝐹𝐶 𝐿=∑∑∇𝑋𝐹𝐶 𝐿𝜕 𝜕𝑋𝐹𝐶 𝐿𝑔(∑∑𝑊𝑖,𝑗𝑋𝑗𝐿−1 𝑣 𝑗=1 +𝑏𝑖 𝑢 𝑖=1 ) 𝑣 𝑗=1 𝑢 𝑖=1 ∇𝑋𝐹𝐶 𝐿=∑∑∇𝑋𝐹𝐶 𝐿 𝑑(𝑔)(𝑊𝑖,𝑗)𝑇 𝑣 𝑗=1 𝑢 𝑖=1 The spread to the input ∇𝑋𝐹𝐶 𝐿 of a densely connected hidden or intermediate layer is: 𝑋𝐹𝐶.𝑎𝑐𝑡𝑢𝑎𝑙 𝐿= 𝑋𝐹𝐶.𝑖𝑛𝑖𝑡𝑖𝑎𝑙 𝐿− 𝜂∇(𝑋𝐹𝐶 𝐿) Therefore, the input updating 𝑋𝐹𝐶 e in a densely connected layer would be: 𝑋𝐹𝐶.𝑎𝑐𝑡𝑢𝑎𝑙 𝐿= 𝑋𝐹𝐶.𝑖𝑛𝑖𝑡𝑖𝑎𝑙 𝐿− 𝜂[∆𝑋𝐹𝐶 𝐿 𝑑(𝑔)(𝑊𝑖,𝑗)𝑇] Vector 𝑿𝑭𝑪 to matrix 𝑿𝑵(𝒊,𝒋) 𝑳 When considering a pooling layer localization before a densely connected one; the values of 𝑋𝐹𝐶 𝐿 are the result of vectorization and concatenation in the forward propagation process. Executing the inverse process, it obtains a matrix XN(i,j) L that represents pooling layer output. 𝑋𝑁(𝑖,𝑗) 𝐿= ∑( ∑∑𝑋𝐹𝐶 (𝑁∙𝑋𝑏+𝑖) 𝑋𝑏−1 𝑗=0 𝑋𝑎−1 𝑖=0 ) 𝑋𝑐 𝑁=1 ;𝐿=1,2,…𝑀 ; 𝑁=1,2…𝑠 ; 𝑋𝑐=1,2…𝑠 Pooling layer  For average pooling case, each average 𝑋𝑁(𝑖,𝑗) 𝐿 returns to all matrix size cells 𝑃𝑜 (𝑃𝑥,𝑃𝑦): 𝑃𝑁(𝑖,𝑗,𝑘) 𝐿= ∑ ( ∑∑𝑋𝐹𝐶(𝑖,𝑗) 𝐿 𝑃𝑦−1 𝑗=0 𝑃𝑥−1 𝑖=0 ) 𝑋𝑐 𝑘=1 ;𝐿=1,2,…𝑀 ; 𝑁=1,2…𝑠  In the case, it is a max-pooling, the maximum will be placed in the position that was extracted in the forward propagation, while the other cells will take a value of zero: (40) (41) (39) Borja-Robalino, Monleón-Getino, Rodellar Ciencia Latina Revista Científica Multidisciplinar, Ciudad de México, México. ISN 2707-2207/ISSN 2707-2215 (en línea),septiembre-octubre,2022,Volumen 6,Número 5 p 1049 𝑃𝑁(𝑖,𝑗,𝑘) 𝐿=∑(∑ ∑𝑋𝐹𝐶(𝑖,𝑗) 𝐿 𝑋𝑏−1 𝑗=0 𝑋𝑎−1 𝑖=0 ) = 𝑋𝑁(𝑖,𝑗,𝑘) 𝐿 𝑋𝑐 𝑘=1 where: 𝑋𝑁(𝑖,𝑗,𝑘) 𝐿= extraction position in forward; 𝑋𝐹𝐶(𝑖,𝑗) 𝐿= maximum value to spread. By propagating the pooling layer, 𝑃𝑁(𝑖,𝑗,𝑘) 𝐿 becomes the convolutional layer output (𝑋𝑁(𝑖,𝑗,𝑘) 𝐿=∇𝑋𝑁(𝑖,𝑗,𝑘) 𝐿) Convolutional layer 1. Weight updating (Kernel). 𝑊𝑁(𝑝,𝑞,𝑟)𝑎𝑐𝑡𝑢𝑎𝑙 𝐿= 𝑊𝑁(𝑝,𝑞,𝑟)𝑖𝑛𝑖𝑡𝑖𝑎𝑙 𝐿− 𝜂 ∇𝑊𝑁(𝑝,𝑞,𝑟) 𝐿 Whereby: ∇𝑊𝑁(𝑝,𝑞,𝑟) 𝐿=𝜕𝐸 𝜕𝑊𝑁(𝑝,𝑞,𝑟) 𝐿 ∇𝑊𝑁(𝑝,𝑞,𝑟) 𝐿= 𝜕𝐸 𝜕𝑋𝑁 (𝑖,𝑗) 𝐿𝜕𝑋𝑁 (𝑖,𝑗) 𝐿 𝜕𝑊𝑁(𝑝,𝑞,𝑟) 𝐿 Using a triple summation so that the weight slides over the entire characteristics map, the following is posed: ∇𝑊𝑁(𝑝,𝑞,𝑟) 𝐿= ∑(∑ ∑ 𝜕𝐸 𝜕𝑋𝑁 (𝑖,𝑗) 𝐿𝜕𝑋𝑁 (𝑖,𝑗) 𝐿 𝜕𝑊𝑁(𝑝,𝑞,𝑟) 𝐿 𝑋𝑏−𝑘𝑏 𝑗=0 𝑋𝑎−𝐾𝑎 𝑖=0 ) 𝑋𝑐 𝑁=1 ∇𝑊𝑁(𝑝,𝑞,𝑟) 𝐿= ∑(∑ ∑ ∇𝑋𝑁(𝑖,𝑗) 𝐿𝜕 𝜕𝑊𝑁(𝑝,𝑞,𝑟) 𝐿𝑔[∑∑∑𝑊𝑁(𝑝,𝑞,𝑟) 𝐿 𝑟𝑞𝑝 𝑋𝑏−𝑘𝑏 𝑗=0 𝑋𝑎−𝐾𝑎 𝑖=0 𝑋𝑐 𝑁=1 ∗𝑋𝑁(𝑖−𝑝,𝑗−𝑞) 𝐿−1 +𝑏𝑁 𝐿]) ∇𝑊𝑁(𝑝,𝑞,𝑟) 𝐿= ∑(∑ ∑ ∇𝑋𝑁(𝑖,𝑗) 𝐿∙𝑑(𝑔)∗ 𝑋𝑁(𝑖−𝑝,𝑗−𝑞) 𝐿−1 𝑋𝑏−𝑘𝑏 𝑗=0 𝑋𝑎−𝐾𝑎 𝑖=0 ) 𝑋𝑐 𝑁=1 Convolution is an operation that turns two functions into a third one, representing a magnitude that superimposes both. When becoming a translated and inverted version, in backpropagation the weight (kernel) must rotate 180 degrees (in theory translate rows and columns) to return to the original matrix. Therefore, weight updating 𝑊𝑁(𝑝,𝑞,𝑟) 𝐿 is: (42) Occult mathematics under the learning process in convolutional neural networks Ciencia Latina Revista Científica Multidisciplinar, Ciudad de México, México. ISN 2707-2207/ISSN 2707-2215 (en línea),septiembre-octubre,2022,Volumen 6,Número 5 p 1050 𝑊𝑁(𝑝,𝑞,𝑟)𝑎𝑐𝑡𝑢𝑎𝑙 𝐿= 𝑊𝑁(𝑝,𝑞,𝑟)𝑖𝑛𝑖𝑡𝑖𝑎𝑙 𝐿 − 𝜂 [∑(∑ ∑ ∇𝑋𝑁(𝑖,𝑗) 𝐿∙𝑑(𝑔)∙𝑟𝑜𝑡 180(𝑋𝑁(𝑖−𝑝,𝑗−𝑞) 𝐿−1 ) 𝑋𝑏−𝑘𝑏 𝑗=0 𝑋𝑎−𝐾𝑎 𝑖=0 ) 𝑋𝑐 𝑁=1 ] 2. Bias updating 𝑏𝑁 𝐿. 𝑏𝑁.𝑎𝑐𝑡𝑢𝑎𝑙 𝐿= 𝑏𝑁.𝑖𝑛𝑖𝑡𝑖𝑎𝑙 𝐿− 𝜂 ∇𝑏𝑁 𝐿 Whereby: ∇𝑏𝑁 𝐿=𝜕𝐸 𝜕𝑏𝑁 𝐿 Applying the chain rule: ∇𝑏𝑁 𝐿= ∑(∑ ∑ 𝜕𝐸 𝜕𝑋𝑁 (𝑖,𝑗) 𝐿𝜕𝑋𝑁 (𝑖,𝑗) 𝐿 𝜕𝑏𝑁 𝐿 𝑋𝑏−1 𝑗=0 𝑋𝑎−1 𝑖=0 ) 𝑋𝑐 𝑁=1 ∇𝑏𝑁 𝐿= ∑(∑ ∑∇𝑋𝑁(𝑖,𝑗) 𝐿𝜕 𝜕𝑏𝑁 𝐿 𝑔 [∑∑∑𝑊𝑁(𝑝,𝑞,𝑟) 𝐿 𝑟∗ 𝑞𝑋𝑁(𝑖−𝑝,𝑗−𝑞) 𝐿−1 +𝑏𝑁 𝐿 𝑝] 𝑋𝑏−1 𝑗=0 𝑋𝑎−1 𝑖=0 ) 𝑋𝑐 𝑁=1 ∇𝑏𝑁 𝐿= ∑ (∑ ∑∇𝑋𝑁(𝑖,𝑗) 𝐿 𝑑(𝑔) 𝑋𝑏−1 𝑗=0 𝑋𝑎−1 𝑖=0 ) 𝑋𝑐 𝑁=1 The bias updating is: 𝑏𝑁.𝑎𝑐𝑡𝑢𝑎𝑙 𝐿= 𝑏𝑁.𝑖𝑛𝑖𝑡𝑖𝑎𝑙 𝐿−𝜂[∑(∑ ∑∇𝑋𝑁(𝑖,𝑗) 𝐿 𝑑(𝑔) 𝑋𝑏−1 𝑗=0 𝑋𝑎−1 𝑖=0 ) 𝑋𝑐 𝑁=1 ] 3. Updating inputs in convolutional layers 𝑋𝑁(𝑖,𝑗,𝑘) 𝐿−1 . If it works with several convolutional layers, it is necessary to update the input 𝑋𝑁(𝑖,𝑗) 𝐿−1 ; solving the problem of obtaining the desired output 𝑌𝑖 in intermediate layers for the error calculation. However, if it is the first layer, only weights and biases will be updated. 𝑋𝑁(𝑖,𝑗,𝑘)𝑎𝑐𝑡𝑢𝑎𝑙 𝐿−1 = 𝑋𝑁(𝑖,𝑗,𝑘)𝑖𝑛𝑖𝑡𝑖𝑎𝑙 𝐿−1 −𝜂 ∇𝑋𝑁(𝑖,𝑗,𝑘) 𝐿−1 Whereby: (43) (44) Borja-Robalino, Monleón-Getino, Rodellar Ciencia Latina Revista Científica Multidisciplinar, Ciudad de México, México. ISN 2707-2207/ISSN 2707-2215 (en línea),septiembre-octubre,2022,Volumen 6,Número 5 p 1051 ∇𝑋𝑁(𝑖,𝑗,𝑘) 𝐿−1 =∑(∑ ∑ 𝜕𝐸 𝜕𝑋𝑁(𝑖−𝑝,𝑗−𝑞,𝑘) 𝐿𝜕𝑋𝑁(𝑖−𝑝,𝑗−𝑞,𝑘) 𝐿 𝜕𝑋𝑁(𝑖,𝑗,𝑘) 𝐿−1 𝐾𝑏−1 𝑞=0 𝐾𝑎−1 𝑝=0 ) 𝑋𝑐 𝑁=1 𝑖=0,1..(𝑋𝑎−1); 𝑗= 0,1…(𝐾𝑏−1); 𝑘=𝑁=1,2…𝑠 Considering that: 𝜕𝐸 𝜕𝑋𝑁(𝑖−𝑝,𝑗−𝑞,𝑘) 𝐿= ∇𝑋𝑁(𝑖−𝑝,𝑗−𝑞,𝑘) 𝐿=∑∑∑𝑋𝑁(𝑖−𝑝,𝑗−𝑞,𝑘) 𝐿−1 ∗ 𝑟𝑞 𝑊𝑁(𝑝,𝑞,𝑟) 𝐿+𝑏𝑁 𝐿 𝑝 Replacing in the equation, it would have: ∇𝑋𝑁(𝑖,𝑗,𝑘) 𝐿−1 =∑(∑ ∑∇𝑋𝑁(𝑖−𝑝,𝑗−𝑞,𝑘) 𝐿𝜕 𝜕𝑋𝑁(𝑖,𝑗,𝑘) 𝐿−1 𝑔 [∑∑∑𝑊𝑁(𝑝,𝑞,𝑟) 𝐿 𝑟𝑞𝑝 𝐾𝑏−1 𝑞=0 𝐾𝑎−1 𝑝=0 𝑋𝑐 𝑁=1 ∗𝑋𝑁(𝑖−𝑝,𝑗−𝑞,𝑘) 𝐿−1 +𝑏𝑁 𝐿]) ∇𝑋𝑁(𝑖,𝑗,𝑘) 𝐿−1 =∑(∑ ∑∇𝑋𝑁(𝑖−𝑝,𝑗−𝑞,𝑘) 𝐿 ∙ 𝑑(𝑔) ∗ 𝑊𝑁(𝑝,𝑞,𝑟) 𝐿 𝐾𝑏−1 𝑞=0 𝐾𝑎−1 𝑝=0 ) 𝑋𝑐 𝑁=1 When having a convolution, we must rotate 𝑊𝑁(𝑝,𝑞,𝑟) 𝐿 to 𝑟𝑜𝑡 180 (𝑊𝑁(𝑝,𝑞,𝑟) 𝐿). ∇𝑋𝑁(𝑖,𝑗,𝑘) 𝐿−1 =∑(∑ ∑[(𝑟𝑜𝑡 180 𝑊𝑁(𝑝,𝑞,𝑟) 𝐿)∙∇𝑋𝑁(𝑖−𝑝,𝑗−𝑞,𝑘) 𝐿 ∙ 𝑑(𝑔)] 𝐾𝑏−1 𝑞=0 𝐾𝑎−1 𝑝=0 ) 𝑋𝑐 𝑁=1 The input updating ∇𝑋𝑁(𝑖,𝑗,𝑘) 𝐿−1 is: 𝑋𝑁(𝑖,𝑗,𝑘)𝑎𝑐𝑡𝑢𝑎𝑙 𝐿−1 = 𝑋𝑁(𝑖,𝑗,𝑘)𝑖𝑛𝑖𝑡𝑖𝑎𝑙 𝐿−1 − 𝜂 [∑(∑ ∑[(𝑟𝑜𝑡 180 𝑊𝑁(𝑝,𝑞,𝑟) 𝐿)∙∇𝑋𝑁(𝑖−𝑝,𝑗−𝑞) 𝐿 ∙ 𝑑(𝑔)] 𝐾𝑏−1 𝑞=0 𝐾𝑎−1 𝑝=0 ) 𝑋𝑐 𝑁=1 ] Application of mathematical modeling to an architecture CNN To exemplify the mathematical modeling backpropagation, an architecture with two convolutional layers, two Pooling layers, a densely connected layer and an output layer was designed. The following was used: Binary cross-entropy as cost function, tanh and sigmoid as activation functions (FA), learning rate 𝜂=0.0001 and the stochastic (45) Occult mathematics under the learning process in convolutional neural networks Ciencia Latina Revista Científica Multidisciplinar, Ciudad de México, México. ISN 2707-2207/ISSN 2707-2215 (en línea),septiembre-octubre,2022,Volumen 6,Número 5 p 1052 descending gradient SGD as optimization function. The network aimed to classify images of motorcycles and planes (binary classification) (See Figure 2). Figure 2. Architecture of a CNN with two convolutions, two pooling, connected and an output layer. In each phase the number of layers, filters and dimensionality (twodimensional or three-dimensional) are indicated. Based on equations 29,30 and 32, the simplified mathematical model of the architecture proposed in Figure 2 is represented by: 𝐶=𝑃[𝑔(∑∑∑[𝑃[𝑔(∑∑∑𝑋𝑁(𝑖−𝑝,𝑗−𝑞,𝑘) 𝐿∗𝑊𝑁(𝑝,𝑞,𝑟) 𝐿+𝑏𝑁 𝐿 𝐾𝑐 𝑟=1 𝐾𝑏 𝑞=1 𝐾𝑎 𝑝=1 )]max (2𝑖,2𝑗,𝑘)] 𝐾𝑐 𝑟=1 𝐾𝑏 𝑞=1 𝐾𝑎 𝑝=1 ∗𝑊𝑁(𝑝,𝑞,𝑟) 𝐿+𝑏𝑁 𝐿)]max (2𝑖,2𝑗,𝑘) Where:  C = two-layer convolutional and two-layer pooling process.  P = application of the pooling layer.  g = activation function. Whereby: 𝑦=𝑠𝑖𝑔𝑚𝑜𝑖𝑑 [∑𝐶𝑎∙ 𝑊𝑖,𝑗 𝑇+𝑏𝑖 500 𝑗=1 ] Borja-Robalino, Monleón-Getino, Rodellar Ciencia Latina Revista Científica Multidisciplinar, Ciudad de México, México. ISN 2707-2207/ISSN 2707-2215 (en línea),septiembre-octubre,2022,Volumen 6,Número 5 p 1053 Where:  𝐶𝑎=flattening process of phase C.  𝑗= corresponds to the number of neurons in the hidden layer.  𝑦= a single target (motorcycle or plane). The step-by-step process of forward and backward propagation is presented below in sections 3.2.1 and 3.2.2. Forward propagation Convolution layer C1 Considering that input images are of three channels RGB (red, green, blue) 𝑋𝑐=3, with a dimension 𝑋=(28𝑥28𝑥3). The first convolutional layer has a kernel =5x5x3, FA= tanh and 64 output filters. Using the equations 12 and 29, it is: 𝐶𝑁 (𝑖,𝑗,𝑘) 1=𝑔 [∑ ∑∑𝑊𝑁 (𝑝,𝑞,𝑟) 1𝑋𝑁 (𝑖−𝑝,𝑗−𝑞,𝑘) 1 3−1 𝑟=0 +𝑏𝑁 1 5−1 𝑞=0 5−1 𝑝=0 ] 𝑤ℎ𝑒𝑟𝑒: 𝑁=1,2….64 ; 𝑖,𝑗=1,2…28;𝑘=1,2,3 𝐶64 (28,28,3) 1=𝑔[𝑧] 𝐶64 (28,28,3) 1= 𝑒𝑧−𝑒−𝑧 𝑒𝑧+ 𝑒−𝑧 Pooling layer P1 Size 2x2, Pr=2 and Max-pooling. With an input of (24x24x64), getting an output of (12x12x64). Basing on the Equation 30, it is. 𝑃64 (24,24) 1(max)= 𝑚𝑎𝑥[∑∑𝐶𝑁[2𝑖−𝑃𝑥,2𝑗−𝑃𝑦,𝑘] 1 2−1 𝑃𝑦=0 2−1 𝑃𝑥=0 ] ;𝑖=1,2….24 2 ; 𝑗 =1,2….24 2;𝑠=1,2,…64 Convolutional layer C2 With a dimension 𝑋=(12𝑥12𝑥64), a kernel=5x5x64, FA= tanh and 128 output filter. Using Equations 12 and 29. 𝐶𝑁 (𝑖,𝑗,𝑘) 2=𝑔 [∑ ∑∑𝑊𝑁 (𝑝,𝑞,𝑟) 1∗𝑋𝑁 (𝑖−𝑝,𝑗−𝑞,𝑘) 1 64−1 𝑟=0 +𝑏𝑁 1 5−1 𝑞=0 5−1 𝑝=0 ] 𝑤ℎ𝑒𝑟𝑒: 𝑁=1,2….128 ; 𝑖,𝑗=1,2…12;𝑘=1,2….64 𝐶128 (12,12,64) 2=𝑔[𝑧] Occult mathematics under the learning process in convolutional neural networks Ciencia Latina Revista Científica Multidisciplinar, Ciudad de México, México. ISN 2707-2207/ISSN 2707-2215 (en línea),septiembre-octubre,2022,Volumen 6,Número 5 p 1054 𝐶128 (12,12,64) 2= 𝑒𝑧−𝑒−𝑧 𝑒𝑧+ 𝑒−𝑧 Pooling layer P2 From size 2x2, Pr=2 and Max-pooling. With an input of (8x8x128), getting an output of (4x4x128). Basing in Equation 30, it is. 𝑃128 (8,8) 2(max)= 𝑚𝑎𝑥[∑∑𝐶𝑠[2𝑖−𝑃𝑥,2𝑗−𝑃𝑦,𝑘] 2 2−1 𝑃𝑦=0 2−1 𝑃𝑥=0 ] ;𝑖=1,2….82 ; 𝑗 =1,2….82;𝑘=1,2,…128 Vectorization and concatenation. If leaving the second pooling layer the input size is X = (4x4x128), the flattening to one dimension becomes in (2048,1). Densely connected layer C3. The entry X is a matrix (2048,1) and the weight W (1,2048), the activation function is tanh, 2048 neurons come in and 500 out. Applying Equations 12 and 32 it is: 𝑌𝑖=𝑔 [𝑋∙𝑊𝑇+𝑏]=𝑔[𝑧] Output layer C4. The entry X is a matrix (500,1) and the weight W (1,500), the activation function is Sigmoid which allows to perform a binary classification, with an input of 500 and output of a neuron. Applying Equations 10 and 32. 𝑌𝑖=𝑔 [𝑋∙ 𝑊𝑖,𝑗 𝑇+𝑏]=𝑔[𝑧] 𝑌𝑖=1 1+𝑒−𝑧 Cost function Equation 7 of the Binary cross-entropy cost function is commonly used in binary classification problems as in this case. 𝐸=−∑[𝑌𝑖∙log(𝑌𝑖 )+(1−𝑌𝑖)∙log(1−𝑌𝑖 )] 𝑛 𝑖=1 Deriving as a function of the predicted output by the network 𝑌𝑖: 𝜕𝐸 𝜕𝑌𝑖 =𝑌𝑖 𝑌𝑖 +(1−𝑌𝑖) (−1) (1−𝑌𝑖)= 𝑌𝑖 𝑌𝑖 +(𝑌𝑖−1) (1−𝑌𝑖)=𝑌𝑖−𝑌𝑖𝑌𝑖+𝑌𝑖𝑌𝑖−𝑌𝑖 𝑌𝑖(1−𝑌𝑖)= 𝑌𝑖−𝑌𝑖 𝑌𝑖(1−𝑌𝑖) (46) Borja-Robalino, Monleón-Getino, Rodellar Ciencia Latina Revista Científica Multidisciplinar, Ciudad de México, México. ISN 2707-2207/ISSN 2707-2215 (en línea),septiembre-octubre,2022,Volumen 6,Número 5 p 1055 Backward propagation Backpropagation process updates the following parameters number in each network layer (See Table 5). Table 5. Parameters network numbers calculation. Layer Calculation Total c/layer Weight Bias Convolutional C1 [(5𝑥5𝑥3)+1]64 4864 4800 64 Convolutional C2 [(5𝑥5𝑥64)+1]128 204928 204800 128 Densely connected C3 [2048+1]500 1024500 1024000 500 Densely connected C4 – output [500+1]1 501 500 1 Total - parameters 1234793 1234100 693 Densely connected layer C4 Weigh updating 𝑊1,500 4 through Equations 11, 34 and 46. 𝑊𝑎𝑐𝑡𝑢𝑎𝑙= 𝑊𝑖𝑛𝑖𝑡𝑖𝑎𝑙− 𝜂 [𝜕𝐸 𝜕𝑌𝑖 𝑑(𝑔) ∙ 𝑋𝑇] 𝑊𝑎𝑐𝑡𝑢𝑎𝑙= 𝑊𝑖𝑛𝑖𝑡𝑖𝑎𝑙− 0.0001[ 𝑌𝑖−𝑌𝑖 𝑌𝑖(1−𝑌𝑖)𝑔(𝑧)[1−𝑔(𝑧)] ∙𝑋𝑇] If 𝑔(𝑧)= 𝑌𝑖 𝑊𝑖,𝑗 𝐿= 𝑊𝑖𝑛𝑖𝑡𝑖𝑎𝑙− 0.0001[𝑌𝑖−𝑌𝑖 𝑌𝑖(1−𝑌𝑖)𝑌𝑖[1−𝑌𝑖] ∙ 𝑋𝑇] 𝑊1,500 4= 𝑊1,500.𝑖𝑛𝑖𝑡𝑖𝑎𝑙 4− 0.0001[[𝑌𝑖−𝑌𝑖] ∙ 𝑋𝑇] ;𝑖=1 ;𝑗=1,2….500 Bias updating 𝑏14 through Equations 11, 35 and 46. 𝑏𝑎𝑐𝑡𝑢𝑎𝑙= 𝑏𝑖𝑛𝑖𝑡𝑖𝑎𝑙− 𝜂∇𝑒 𝑏𝑖𝐿= 𝑏𝑖𝑛𝑖𝑡𝑖𝑎𝑙− 𝜂 [𝜕𝐸 𝜕𝑌𝑖 𝑑(𝑔)] 𝑏𝑖𝐿= 𝑏𝑖𝑛𝑖𝑡𝑖𝑎𝑙− 𝜂 𝑌𝑖−𝑌𝑖 𝑌𝑖(1−𝑌𝑖)𝑔(𝑧)[1−𝑔(𝑧)] 𝑏𝑖𝐿= 𝑏𝑖𝑛𝑖𝑡𝑖𝑎𝑙− 0.0001[𝑌𝑖−𝑌𝑖 𝑌𝑖(1−𝑌𝑖)𝑌𝑖[1−𝑌𝑖]] 𝑏14= 𝑏1.𝑖𝑛𝑖𝑡𝑖𝑎𝑙 4− 0.0001[[𝑌𝑖−𝑌𝑖]] ;𝑖=1 Input updating 𝑋500 4, replacing the former values getting in 𝑊1,500 4 𝑎𝑛𝑑 𝑏14 using Equation 36. Occult mathematics under the learning process in convolutional neural networks Ciencia Latina Revista Científica Multidisciplinar, Ciudad de México, México. ISN 2707-2207/ISSN 2707-2215 (en línea),septiembre-octubre,2022,Volumen 6,Número 5 p 1062 Lazzeri, F. (2020, May 7). Selección de un algoritmo de Machine Learning. Azzure Machine Learning. https://docs.microsoft.com/es-es/azure/machine-learning/how-to- select-algorithms LeCun, Y., Bengio, Y., & Hinton, G. (2015). Deep learning. Nature, 521(7553), 436–444. https://doi.org/10.1038/nature14539 Lee, H., Grosse, R., Ranganath, R., & Ng, A. Y. (2009). Convolutional deep belief networks for scalable unsupervised learning of hierarchical representations. Proceedings of the 26th Annual International Conference on Machine Learning - ICML ’09, 1–8. https://doi.org/10.1145/1553374.1553453 Liu, T., Fang, S., Zhao, Y., Wang, P., & Zhang, J. (2015). Implementation of Training Convolutional Neural Networks. ArXiv:1506.01195-Computer Vision and Pattern Recognition, 10. arXiv:1506.01195. Lopez-Pinaya, W., Vieira, S., Garcia-Dias, R., & Mechelli, A. (2020). Chapter 10— Convolutional neural networks. In A. Mechelli & S. Vieira (Eds.), Machine Learning (pp. 173–191). Academic Press. https://doi.org/10.1016/B978-0-12-815739- 8.00010-9 Martineau, M., Raveaux, R., Conte, D., & Venturini, G. (2020). A Convolutional Neural Network into graph space. ArXiv:2002.09285 [Cs]. http://arxiv.org/abs/2002.09285 Minaee, S., Kalchbrenner, N., Cambria, E., Nikzad, N., Chenaghlu, M., & Gao, J. (2020). Deep Learning Based Text Classification: A Comprehensive Review. ArXiv:2004.03705. http://arxiv.org/abs/2004.03705 Namikawa, K., Hirasawa, T., Yoshio, T., Fujisaki, J., Ozawa, T., Ishihara, S., Aoki, T., Yamada, A., Koike, K., Suzuki, H., & Tada, T. (2020). Utilizing artificial intelligence in endoscopy: A clinician’s guide. Expert Review of Gastroenterology & Hepatology, 1–18. https://doi.org/10.1080/17474124.2020.1779058 Parmar, R. (2018, September 2). Common Loss functions in machine learning. Medium. https://towardsdatascience.com/common-loss-functions-in-machine-learning- 46af0ffc4d23 Perconti, P., & Plebe, A. (2020). Deep learning and cognitive science. Cognition, 203, 104365. https://doi.org/10.1016/j.cognition.2020.104365 Borja-Robalino, Monleón-Getino, Rodellar Ciencia Latina Revista Científica Multidisciplinar, Ciudad de México, México. ISN 2707-2207/ISSN 2707-2215 (en línea),septiembre-octubre,2022,Volumen 6,Número 5 p 1063 Pesapane, F., Tantrige, P., Patella, F., Biondetti, P., Nicosia, L., Ianniello, A., Rossi, U. G., Carrafiello, G., & Ierardi, A. M. (2020). Myths and facts about artificial intelligence: Why machine- and deep-learning will not replace interventional radiologists. Medical Oncology, 37(5), 40. https://doi.org/10.1007/s12032-020-01368-8 Rao, G. A., Syamala, K., Kishore, P. V. V., & Sastry, A. S. C. S. (2018). Deep convolutional neural networks for sign language recognition. 2018 Conference on Signal Processing And Communication Engineering Systems (SPACES), 194–197. https://doi.org/10.1109/SPACES.2018.8316344 Rawat, W., & Wang, Z. (2017). Deep Convolutional Neural Networks for Image Classification: A Comprehensive Review. Neural Computation, 29(9), 2352–2449. https://doi.org/10.1162/neco_a_00990 Ruder, S. (2017). An overview of gradient descent optimization algorithms. ArXiv:1609.04747 [Cs]. http://arxiv.org/abs/1609.04747 Sturm, I., Lapuschkin, S., Samek, W., & Müller, K.-R. (2016). Interpretable deep neural networks for single-trial EEG classification. Journal of Neuroscience Methods, 274, 141–145. https://doi.org/10.1016/j.jneumeth.2016.10.008 Van Houdt, G., Mosquera, C., & Napoles, G. (2020). A review on the long short-term memory model. Artificial Intelligence Review. https://doi.org/10.1007/s10462- 020-09838-1 Wadawadagi, R., & Pagi, V. (2020). Sentiment analysis with deep neural networks: Comparative study and performance assessment. Artificial Intelligence Review. https://doi.org/10.1007/s10462-020-09845-2 Wu, J. (2017). Introduction to Convolutional Neural Networks. 2–28. https://cs.nju.edu.cn/wujx/paper/CNN.pdf Zhang, L., Wang, S., & Liu, B. (2018). Deep learning for sentiment analysis: A survey. Wiley Interdisciplinary Reviews: Data Mining and Knowledge Discovery, 8(4). https://doi.org/10.1002/widm.1253