## 4 Fairness-Aware Machine Learning Based Power and RB Allocation with Multiple Relays
### Relays Deployment and Users Association
```
1:\(K\
```
1:\(cnt=0\)
2:for\(k=min_{k}:max_{k}\)do
3:\(cnt=cnt+1\)
4:for\(t=1:max_{t}\)do
5:repeat
6: Randomly choose initial \(k\) centroids \(\mu_{1},\mu_{2},\mu_{3},...,\mu_{k}\)
7:for\(i=1:m\)do
8:\(a^{(i)}=j,\quad 1\leq j\leq k\), such that \(\mu_{j}\) is the centroid closest to \(u^{(i)}\)
9:endfor
10:for\(l=1:k\)do
11:\(\mu_{l}=\) mean of all users/points \(u^{(i)}\) assigned to \(lth\) centroid
12:endfor
13:until converges
14:\(\boldsymbol{\mu}^{(t)}=(\mu_{1},\mu_{2},\mu_{3},\ldots,\mu_{k})\)
15:\(\mathbf{a}^{(t)}=(a^{(1)},a^{(2)},a^{(3)},\ldots,a^{(m)})\)
16:\(c^{(t)}=cost(\mu_{1},\mu_{2},\mu_{3},\ldots,\mu_{k})\)
17:endfor
18:\(idx=\arg_{min}\{c(t),1\leq t\leq max_{t}\}\)
19:\(\boldsymbol{\mu_{k}}^{(k)}=\boldsymbol{\mu}^{(idx)},1\leq idx\leq max_{t}\)
20:\(\mathbf{a_{k}}^{(k)}=\mathbf{a}^{(idx)}\cdot 1\leq idx\leq max_{t}\)
21:\(c_{k}^{(k)}=c^{(idx)},1\leq idx\leq max_{t}\)
22:endfor
23:\(index=\arg_{min}\{c_{k}^{(k)},1\leq k\leq cnt\}\)
24:\(\boldsymbol{\mu}=\boldsymbol{\mu_{k}}^{(index)},1\leq index\leq cnt\)
25:\(\mathbf{a}=\mathbf{a_{k}}^{(index)},1\leq index\leq cnt\)
26:\(n=index\)
```

**Algorithm 2** Users association clustering algorithm

Figure 9: A snapshot of the relay deployment and users’ association algorithm output in a 120 degree sector. ### Resource Allocation by Multiclass Classification

The resource block allocation problem has multiple discrete outputs, i.e., the users, therefore, we use the multiclass classification to classify one out of \(K\) users. The multiclass classification is an extension of One-Vs-All classification. The input of the training network comprises of channel state information in terms of the SNR and the output consists of a particular user that maximizes the utility function (throughput for MT and PF metric for the proportional fairness). The training data is obtained from the implementation of SAMM algorithm of [4] as 25,000 K-dimensional samples of received SNR and the corresponding selected users. The dataset is partitioned into three parts, the training dataset, the validation dataset, and the test dataset. These are divided in 70%, 15%, and 15% ratio, respectively. The Matlab Neural Network Pattern Recognition Apps is used to train and deploy the neural network. It uses Scaled Conjugate Gradient algorithm [27] for training. Our application requires \(K=10\) neurons in input layer and 10 neurons in output layer. A hit and trial choice of eight neurons in hidden layer gave the best result. The neural network architecture is shown in Figure 7:0

The neural network loss function is a generalization of the logistic regression's loss function. In logistic regression classification problem, we try to find the weighted parameter \(\theta\), such that the mean square error between the predicted output and the actual output is minimized. This is called loss function (LF) or the cost function and is given by

Figure 7:1

where the prediction or hypothesis function \(h_{\theta}(x)\) is a sigmoid function, i.e., \(h_{\theta}(x)=\frac{1}{1+e^{-\theta^{2}x}}\). In the above equation, \((x^{(i)},y^{(i)})\) is a training dataset with \(1,...,m\) input-output pairs. However, loss function with sigmoid function leads to a non-convex function, therefore, a cross entropy based loss function is used to make it convex function as,

Figure 7:2

where the second summation is for the regularization of weight or bias units \(\theta_{j}\) and \(\lambda_{R}\) is a regularization parameter.