# DACSR: Decoupled-Aggregated End-to-End Calibrated Sequential Recommendation
## 4 Methodology
### The Decoupled-Aggregated Framework  
Directly optimizing a sequence encoder by the weighted loss function may lead to a seesaw problem [34, 35]. For example, the performance of calibration increases by sacrificing the recommendation accuracy. This is because optimizing by two objectives based on shared parameters limits the ability of the model to obtain better representations of sequences and items. Therefore, we propose our Decoupled-Aggregated framework, which includes two basic sequence encoders, as shown in Figure 2. The two sequence encoders are optimized separately. One is to accurately predict the next behavior, while the other one is to provide a fully calibrated recommendation list. Formally, this can be represented as:  
\[h_{p} =f_{p}(s\mid E_{p}^{I},\theta_{p},L_{Acc}) \tag{13}\] \[h_{c} =f_{c}(s\mid E_{c}^{I},\theta_{c},L_{Calib}) \tag{14}\]  
where \(f_{p}\) and \(f_{c}\) are two different sequence encoders with different parameters and objective functions. \(E_{p}^{I}\) and \(E_{c}^{I}\) are item embedding matrices of the two sequence encoders. \(\theta_{p}\) and \(\theta_{c}\) are their parameters. Note that the two encoders \(f_{p}\) and \(f_{c}\) do not share the same parameters and item embedding matrices, and are optimized by their unique loss functions \(L_{Acc}\) and \(L_{Calib}\), respectively.  
Next, we use the sequence representations and item embeddings of the two encoders to provide calibrated recommendation list. A direct way is to concatenate the representations of two sequence encoders:  
\[h_{a}=[h_{p},h_{c}] \tag{15}\] \[E_{a}^{I}=[E_{p}^{I},E_{c}^{I}] \tag{16}\]  
where \([,]\) is the concatenation execution of two vectors or matrices. Based on this, we use the concatenated vectors as input to two extractor nets:  
Figure 2: The architecture of our DACSR model.  
\[h_{o} =EX_{seq}(h_{a}) \tag{17}\] \[E_{o}^{I} =EX_{emb}(E_{a}^{I}) \tag{18}\]  
\(EX_{seq}\) and \(EX_{emb}\) are two extractor nets. The extractor net is a feed-forward network which can be defined as follows:  
\[h^{t}=W^{t}ReLU(h^{t-1})+b^{t}\quad(t=1,2,3\dots) \tag{19}\]  
where \(W^{0},W^{1},\dots,W^{t}\) and \(b^{0},b^{1}\dots,b^{t}\) are \(2d\times 2d\) and \(2d\) dimensional parameters need to learn (\(d\) is the dimension of hidden states). \(t\) is the number of layers in the extractor net. \(ReLU\) is the activation function. \(h^{0}\) is the input of the feed-forward network (i.e., \([h_{p},h_{c}]\) and \([E_{p}^{I},E_{c}^{I}]\)). Inspired by [36], we add the original input as the final representation:  
\[h_{out}=h^{t}+h^{0} \tag{20}\]  
where \(h_{out}\) is the final output the extractor network, which can be either sequence representation \(h_{o}\) or item embedding \(E_{o}^{I}\). Finally, the scores of all items can be computed as:  
\[\hat{y}_{o}=E_{o}^{I}h_{o}^{\mathsf{T}} \tag{21}\]  
which is similar to Equation (3). We also use the weighted loss function \(L_{w}\) to optimize the model. In conclusion, the loss function of the DACSR model can be written as:  
\[L=L_{w}(\hat{y}_{o})+L_{Acc}(\hat{y}_{p})+L_{Calib}(\hat{y}_{c}) \tag{22}\]  
where \(\hat{y}_{p}\) and \(\hat{y}_{c}\) are scores of all items generated by \(f_{p}\) and \(f_{c}\).