## 4 Fairness-Aware Machine Learning Based Power and RB Allocation with Multiple Relays
### Relays Deployment and Users Association
In case of neural networks with multiclass classification, the prediction variable becomes K-dimension, \(h_{\Theta}(x)\in\mathbb{R}^{K}\), therefore, the loss function is given as

\[LF(\Theta)=-\frac{1}{m}\sum_{i=1}^{m}\sum_{k=1}^{K}[y_{k}^{(i)}\log(h_{\Theta} (x^{(i)}))_{k}+(1-y^{(i)})\log(1-(h_{\Theta}(x^{(i)}))_{k})]+\frac{\lambda_{R} }{2m}\sum_{l=1}^{L-1}\sum_{i=1}^{N_{l}}\sum_{j=1}^{N_{l+1}}(\Theta_where \(L\) is the number of layers in neural network, \(s_{l}\) is the number of neurons in layer \(l\), and \(\lambda_{R}=5\times 10^{-4}\) is a regularization parameter to control the tradeoff between fitting the training dataset and keeping the parameter \(\Theta\) small. The neural network is trained using the stochastic gradient descent algorithm. The gradient or partial derivative is calculated by the backpropagation algorithm and weights (\(\theta\)) are updated. The amount at which the weights are updated is called learning rate. It our case, we set learning rate to 0.01. Batch size is a matrix of input (or output) vectors applied to the network simultaneously to produce the update on network weights and biases. In our work, batch size of 128 (MATLAB default), \(10\times 1\) input vectors is used. We use MATLAB 2019a App, Neur al Network Pattern Recognition (nprtool) which is a two-layer (one for hidden layer activation functions and other for output layer activation functions) feedforward network. Lower the cross entropy higher the classification accuracy, zero cross entropy means no error. Figure 11 shows that cross entropy reaches 0.0078318 at iteration 136. Figure 12 shows variation in gradient coefficient with respect to number of epochs. The final value of gradient coefficient at epoch number 142 is 0.001787 which is approximately near to zero. Minimum the value of gradient coefficient better will be training and testing of networks. From the figure, it can be seen that the gradient value is decreasing with the increase in number of epochs. Large number of validation fails indicate the overtraining. In Figure 12 validation fails are the iterations when validation mean square error (MSE) increased its value. A lot of fails means overtraining. MATLAB automatically stops training after 6 fails in a row. Figure 13 shows the error histogram of the trained neural network for the training, validation and testing parts. In this figure we can see that the data fitting errors are minimum and they are distributed within a closed range around zero. The confusion matrix Figure 14 visualizes the performance of supervised learning. The rows correspond to the predicted user (Output Class) and the columns correspond to the true user (Target Class). The diagonal cells correspond to observations that are correctly assigned the user-RB pairs. The off-diagonal cells correspond to incorrectly assigned user-RB pairs. The trained neural network provides 97.5% classification accuracy. The Figure 15 represent the receiver operating characteristics (ROC) curves. The ROC curve plot shows the true positive rate versus the false positive rate as the threshold is varied. A perfect test would show points in the upper-left corner, with 100% sensitivity and 100% specificity [28]. In the RB allocation module, it worked very well. Figure 7:3 The mean-squared-error for the training and testing of the RB allocation module. Figure 7:4 The confusion matrix for test dataset. Figure 7:5 The neural network training states with gradient and validation fail statistics as a function of number of epochs. Figure 7:6 The error histogram of the trained neural network for the training, validation and testing phases. ### Power Allocation through Two-Layer Feedforward Neural Network

In the power allocation problem, we have to map the numeric input dataset (SNR) to the numeric output dataset (allocated power) per user per RB. Therefore, we use neural network curve fitting technique. The training dataset is generated by the Algorithm 2 as input received SNR and output allocated transmit power.