## 4 Convolutional/LSTM-Based Resource Allocation Framework  
The loss function depends on two factors: The first one is the cloud resource allocation cost; the second one is the QoS degradation cost which occurs when the resources are under-allocated and QoS degradation is introduced for a fraction of the offered traffic.  
To express the allocation cost we introduce the parameter \(C^{a}_{RA,j}\) (\(i\in[1..Q];\bar{u}\in\bar{\mathcal{U}}_{NP}\)) which is referred to as allocation cost per Mb of traffic, it is expressed in (\(\$/\)Mb) and it characterizes the cost of processing one Mb of traffic for the \(i\)-th type VNFI in the NFVI-PoP \(\bar{u}\in\bar{\mathcal{U}}_{NP}\); its expression is given by:  
\[C^{\bar{u}}_{RA,i}=c^{\bar{u}}_{core}\frac{n^{c}_{i}}{C^{pr,max}_{i}}\;\;\;i \in[1..Q]\;\;\bar{u}\in\bar{\mathcal{U}}_{NP} \tag{1}\]  
The QoS degradation cost characterizes the compensation cost due to a user when the processing resources are under-allocated; the QoS degradation may involve the loss and/or the delay of processing tasks and the service providers have to compensate a user when the task average delay, a given delay percentile or the loss are increased with respect to the ones agreed in the Service Level Agreement; the expression of the QoS degradation cost is complex and depends on the several factors: (i) The chosen task queuing model; (ii) the traffic model at packet level that is trivial to assume, as often done in the literature, according to exponential distributions; (iii) a cost model which translates the QoS degradation in a monetary cost. The definition of these aspects is out of the scope of the paper and we assume a simple cost model in which the QoS degradation cost in an allocation interval depends linearly on the following parameters: (i) the unallocated processing capacity (Mbps); (ii) the duration of the interval; (iii) the degradation cost \(C_{QoS}\) per Mbit of traffic which is expressed in (\(\$/\)Mb) and characterizes a compensation cost due to a user when one Mb of traffic does not receive the agreed QoS. We will carry out an analysis in which the parameter \(C_{QoS}\) is varied so as to evaluate scenarios with more or less monetary penalty when QoS constrains are not satisfied. Finally we point out that the solution can easily be extended to the case where more sophisticated QoS cost models are used.  
Next we propose a neural network trained with a loss function that takes into account both resource allocation and QoS degradation costs. The inputs of the neural network are the measured VNFI processing capacities in an NFVI-PoP. The outputs are the processing capacities to be allocated in an allocation period. These capacities will be supported by allocating a sufficient number of cores to the VNFIs.  
The considered neural network is composed by two main stages: (i) a convolutional layer able to handle the spatial correlations among the processing capacities required by the VNFIs running in a same NFVI-PoPs; (ii) an LSTM layer able to handle the temporal correlation of processing capacities of a same VNFI in different monitoring periods.  
We describe the neural network architecture in Section 4.1, while the structure of the loss function used for the training is described in Section 4.2.