# EVM Loss: A Loss Function for Training Neural Networks in Communication Systems
## 2 Materials and Methods
The neural network is designed to be trained on sequences of received QPSK symbols after transmission over a visible light link using SEFDM with a given bandwidth compression factor, or OFDM where \(\alpha=1\). The VLC link is characterized in [17] with a bandwidth of \(>\)50 MHz. We set our signal bandwidth to be 1 MHz to ensure a flat-band response since this paper is not about improving data rates. The signal was dicated at 90 mA with an ac signal voltage of 2 Vpp, i.e., keeping within the linear operating region of the LED. A generalized diagram of the model used in this work can be seen in Figure 2.  
The neural network input layer contains \(2N\) neurons, which allows for separation and concatenation of the real and imaginary components of \(N\) subcarriers. The network requires sufficient neurons in its hidden layers to learn the complexities of the ICI and transmission channel, thus, inspired from [7], we opt for 3 hidden layers with \(4N\), \(8N\) and \(4N\) neurons respectively. Each hidden layer uses the LeakyReLU activation function with the final output layer using a linear activation, and the model was trained with the Nadam optimizer. The initial learning rate was set to \(10^{-3}\) with a reduction of factor \(10^{-1}\) when the validation loss did not decrease over a 5-epoch period. The received symbols are fed through the network until they reach the output layer, which also contains \(2N\) neurons, mirroring the input. The estimate of the originally transmitted QPSK symbols are then obtained by combining the real and imaginary outputs. The EVM loss function will be introduced separately, replacing the typical mean square error which we are comparing against which is given as [18]:  
\[L=\frac{1}{2N}\sum_{i=1}^{2N}(y_{i}-\hat{y}_{i})^{2}. \tag{3}\]where \(N\) in is the number of subcarriers, \(y_{i}\) is the ground truth value and \(\hat{y}_{i}\) is the predicted value. EVM encompasses the effects of both magnitude and phase distortions [19] and represents the difference between a measured signal and a reference signal. This is illustrated in Figure 3. Mathematically, we define the error vector \(E_{k}\) for the \(k^{\text{th}}\) input as:  
\[E_{k}=\big{(}I_{k}-\hat{I}_{k}\big{)}^{2}+\big{(}Q_{k}-\hat{Q}_{k}\big{)}^{2}, \tag{4}\]  
where \(I_{k}\) and \(Q_{k}\) are the \(k^{\text{th}}\) ideal in-phase and quadrature component respectively, and \(\hat{I}_{k}\) and \(\hat{Q}_{k}\) are the measured versions. This allows for the calculation of the EVM as [20]:  
\[\mathbf{E}=\sqrt{\frac{\frac{\frac{1}{N}\sum\limits_{k=1}^{N}E_{k}}{\frac{1}{ N}\sum\limits_{k=1}^{N}\big{(}I_{k}^{2}+Q_{k}^{2}\big{)}}}{\sqrt{\frac{1}{N} \sum\limits_{k=1}^{N}\big{(}I_{k}^{2}+Q_{k}^{2}\big{)}}}}. \tag{5}\]  
We incorporate this into the loss function when training the neural network receiver, instead of the mean square error. As is clear from the above, this requires the loss function to have knowledge of both the real and imaginary constituents of the input signal, therefore the design of the neural network has to take this into consideration. This is a simple modification that requires increasing the number of neurons of the input layer by a factor of 2. Whilst this does increase the complexity of the individual network, the overall complexity is maintained by the fact only a single network is required, rather than each one for in-phase and quadrature signal components. A second advantage of doing this is by enabling the neural network to observe both signal components, it is better able to learn how to recover the signal. This is because there is additional co-information embedded in the Cartesian form of the constellation without splitting, such as combined phase information that can lead to a more accurate joint recovery of symbols. If two neural networks are trained separately for each signal component, this information would remain unknown to the other and hence performance deteriorates comparatively. Figure 2: Block diagram of the neural network.