# GAO-FCNN-Enabled Beamforming of the RIS-Assisted Intelligent Communication System
## 3 Gao-Fnn
### Fully-Connected Neural Network
The mini-batch gradient descent (MBGD) algorithm is used here to update the transmitter weight \(\mathbf{W}_{T}^{(l)}\), the reflection phase of the RIS \(\mathbf{\Phi}\), and the receiver weight \(\mathbf{W}_{R}^{(l)}\). The gradient of the weight \(\mathbf{W}_{T}^{(l)}\) and the weight \(\mathbf{W}_{R}^{(l)}\) is calculated according to the derivations of the CE loss function. In the subsequent, the FCNN is accomplished based on the connection weights, bias between neurons, and nonlinear properties of the activation function. The complex feature extraction and pattern recognition of the data are performed by the linear combination of weights and bias, as well as the nonlinear transformation provided by the activation function. Consequently, the mapping and learning steps of the input data and the output labels are given in Algorithm 1 to update \(\mathbf{W}_{T}^{(l)}\) and \(\mathbf{W}_{R}^{(l)}\) for all layers \(L\). Firstly, errors of the output layer are  
\[\vartheta^{(L)}=\
abla_{\mathbf{\alpha}^{(L)}}\times(\theta)\times sig^{\prime }(\mathbf{\xi}^{(L)}), \tag{15}\]  
where \(\vartheta^{(L)}\) is the error of the \(L\)-th layer, \(\
abla_{a^{(L)}}\) is the gradient vector of \(\mathbf{\alpha}^{(L)}\), \(\mathbf{\alpha}^{(L)}\) is the predicted output of the \(L\)-th layer, \(\theta\) is the target of our model optimization, and \(sig^{\prime}(\mathbf{\xi}^{(L)})\) is the derivative of the \(L\)-th layer activation function. Then, the back-propagation error is subsequently given by  
\[\left\{ \begin{array}{l}\theta_{T}^{(l)}=\left(\left(\mathbf{W}_{T}^{(l+1)} \right)^{\mathrm{T}}\theta_{T}^{(l+1)}\otimes sig^{\prime}(\mathbf{\xi}_{T}^{ (l)}\right)\\ \vartheta_{R}^{(l)}=\left(\left(\mathbf{W}_{R}^{(l+1)}\right)^{\mathrm{T}} \theta_{R}^{(l+1)}\otimes sig^{\prime}(\mathbf{\xi}_{R}^{(l)}\right)\\ \vartheta_{\varphi}^{(l)}=\left(\left(\mathbf{\Phi}^{(l+1)}\right)^{\mathrm{T}} \vartheta_{\varphi}^{(l+1)}\otimes sig^{\prime}(\mathbf{\xi}_{\varphi}^{(l)} \right)\\ \vartheta_{e}^{(l)}=\left(\left(e^{(l+1)}\right)^{\mathrm{T}}\vartheta_{e}^{( l+1)}\otimes sig^{\prime}(\mathbf{\xi}_{e}^{(l)}\right)\end{array} ,\right. \tag{16}\]  
where \(\vartheta_{T}^{(l)}\) is the error of the \(l\)-th layer at the transmitter, \(\mathbf{W}_{T}^{(l+1)}\) is the weight vector of the \((l+1)\)-th layer, \(\otimes\) represents the element multiplying point by point, \(sig^{\prime}(\mathbf{\xi}_{T}^{(l)})\) is the derivative of the \(l\)-th layer activation function, \(\vartheta_{R}^{(l)}\) is the error pertaining of \(l\)-th layer at the receiver, \(\mathbf{W}_{R}^{(l+1)}\) is the weight vector of the \((l+1)\)-th layer, \(sig^{\prime}(\mathbf{\xi}_{R}^{(l)})\) is the derivative of the \(l\)-layer activation function, \(\vartheta_{\varphi}^{(l)}\) is the error of the \(l\)-th layer of reflection phases associated with the RIS, \(\mathbf{\Phi}^{(l+1)}\) is the matrix of the \((l+1)\)-th layer of reflection phases, \(sig^{\prime}(\mathbf{\xi}_{\varphi}^{(l)})\) is the derivative of the \(l\)-th layer activation function at the receiver, \(\vartheta_{e}^{(l)}\) is the error of the \(l\)-th layer, \(e^{(l+1)}\) is the error pertaining to the bias of the \((l+1)\)-th layer, and \(sig^{\prime}(\mathbf{\xi}_{e}^{(l)})\) is the derivative of the \(l\)-th layer activation function at the receiver. Consequently, \(\mathbf{W}_{T}^{(l)}\), \(\mathbf{W}_{R}^{(l)}\), \(\mathbf{\Phi}^{(l)}\) and \(e_{i}^{(l)}\) can be updated as shown below:  
\[\left\{ \begin{array}{l}\mathbf{W}_{T}^{(l+1)}=\mathbf{W}_{T}^{(l)}-\eta \frac{\partial\theta}{\partial\mathbf{W}_{T}^{(l)}}\\ \mathbf{W}_{R}^{(l+1)}=\mathbf{W}_{R}^{(l)}-\eta\frac{\partial\theta}{\partial \mathbf{W}_{R}^{(l)}}\\ \mathbf{\Phi}^{(l+1)}=\mathbf{\Phi}^{(l)}-\eta\frac{\partial\theta}{\partial \mathbf{\Phi}^{(l)}}\\ e^{(l+1)}=e^{(l)}-\eta\frac{\partial\theta}{\partial\mathbf{\Phi}^{(l)}}\end{array}  \right., \tag{17}\]i.e.,  
\[\left\{