## 4 The Proposed Framework
### Supervised Learning  
Training our framework for ephemeral group recommendations necessitates the utilization of supervised signals. The most direct form of supervision in this context is derived from the group-item interaction matrix \(Q\). Given the sparse nature of group-item interactions, the user-item interaction matrix \(R\) is employed as an auxiliary supervised signal to augment the training process. To encapsulate the preference distributions inferred by the predictor, we introduce the following formulation:  
\[\text{Output}=\text{softmax}(\text{MLP}(\text{Input})), \tag{1}\]when \(P\), \(Z\) and \(Z^{m}\) are input variables, and the output variables correspond to \(Y\), \(X\) and \(X^{m}\), where \(Y\) and \(X\) represent the preference distributions of groups and users, respectively. \(X^{m}\) represents the user preference distribution obtained from the intermediate variable \(Z^{m}\) produced by our disentangled self-attention mechanism. It is important to note that Equation (1) is applied on a per-row basis, enabling the computation of individual preference probabilities for each group and user.  
To align these inferred distributions with their historical counterparts, we define normalized distributions \(\hat{Q}\) and \(\hat{R}\) for the supervised signals \(Q\) and \(R\), respectively, as follows:  
\[\hat{\mathbf{q}}_{i} =\mathbf{q}_{i}/||\mathbf{q}_{i}||_{1},\quad\forall i\in[0,| \mathcal{G}|), \tag{2}\] \[\hat{\mathbf{r}}_{i} =\mathbf{r}_{i}/||\mathbf{r}_{i}||_{1},\quad\forall i\in[0,| \mathcal{U}|), \tag{3}\]  
where \(\hat{\mathbf{q}}_{i}\) and \(\hat{\mathbf{r}}_{i}\) denote the normalized historical preference distributions of groups and users, respectively, choosing among candidate items.  
To quantify the congruence between these distributions, we employ the KL divergence, defined as  
\[D_{KL}(A||B)=\sum_{i}A(x_{i})\log\frac{A(x_{i})}{B(x_{i})}, \tag{4}\]  
which can be decomposed into  
\[D_{KL}(A||B)=H(A,B)-H(A), \tag{5}\]  
where  
\[H(A)=\sum_{i}A(x_{i})\log\frac{1}{A(x_{i})}=-\sum_{i}A(x_{i})\log A(x_{i}) \tag{6}\]  
represents the information entropy, and  
\[H(A,B)= \sum_{i}A(x_{i})\log\frac{1}{B(x_{i})} \tag{7}\] \[= -\sum_{i}A(x_{i})\log B(x_{i}).\]  
\(H(A)\) represents the entropy of distribution \(A\), and \(H(A,B)\) denotes the cross-entropy between distributions \(A\) and \(B\). Given that \(H(A,B)\) encapsulates the dissimilarity between \(A\) and \(B\) within the context of KL divergence, we adopt the cross-entropy form to articulate the loss functions, assessing the alignment between \(\hat{Q}\) and \(Y\), \(\hat{R}\) and \(X\) and \(\hat{R}\) and \(X^{m}\), respectively. These are expressed as:  
\[\mathcal{L}_{group}=-\sum_{i\in[0,|\mathcal{G}|)}\sum_{j\in[0,|\mathcal{I}|)} \hat{q}_{ij}\log y_{ij}, \tag{8}\]  
\[\mathcal{L}_{user}=-\sum_{i\in[0,|\mathcal{U}|)}\sum_{j\in[0,|\mathcal{I}|)} \hat{n}_{ij}\log x_{ij}, \tag{9}\]  
while \(\mathcal{L}_{user^{\prime}}\) can also be represented by Equation (9) by replacing the input with \(x_{ij}^{m}\), where \(\hat{q}_{ij}\), \(y_{ij}\), \(\hat{r}_{ij}\), \(x_{ij}\) and \(x_{ij}^{m}\) correspond to the elements within \(\hat{\mathbf{q}}_{i}\), \(\mathbf{y}_{i}\), \(\hat{\mathbf{r}}_{i}\), \(\mathbf{x_{i}}\) and \(\mathbf{x_{i}^{m}}\), respectively. Equation (8) encapsulates the loss function associated with group-item interactions, pivotal in the principal training phase of DAGA, while \(\mathcal{L}_{user}\) and \(\mathcal{L}_{user^{\prime}}\) pertain to the user-item interaction loss. Actually, in order to train our framework more efficiently, in practice, a pre-training phase is conducted to train the disentangled multi-head self-attention encoder with \(\mathcal{L}_{user^{\prime}}\) in an auto-regressive manner. In the subsequent training phase (called fine-tuning and primary training in this paper), the loss function \(\mathcal{L}_{group}\) and \(\mathcal{L}_{user}\) are applied to train the end-to-end framework. Our experiments indicate that this method can produce the model with the best performance.