## 3 Methods
### Overall Framework  
We adopt the general framework illustrated in Figure 1 to accomplish the multi-domain sentiment classification task, which is composed of four components: a word-embedding layer, domain feature representation and sentiment feature layers, an attention layer, and domain and sentiment classifiers. Word-embedding layer:converting words into dense vector representations to reflect semantic and syntactic information between words. Feature representation layer: generating domain features and sentiment features from the obtained word embeddings for domain and sentiment classification. Attention layer: deciding how to extract the features required for the target task, which is a critical mechanism for the attention neural network and directly affects the model performance. Classifiers: categorizing input data into predefined domain and sentiment classes based on learned features. Specifically, we assume that the one-hot vector representations of an input text are represented as \(X=\{x_{1},x_{2},\ldots,x_{n}\}\). Initially, \(X\) is passed through the word-embedding layer to produce a set of embedding vectors, \(E=\{e_{1},e_{2},\ldots,e_{n}\}\), \(E=AX\), and \(A=\in R^{D*V}\). \(A\) is the word-embedding matrix, where \(D\) and \(V\) represent the dimension of the word embedding and the size of the dictionary, respectively. Then, the word-embedding vectors are conveyed to a domain module. In the domain module, inputs are transformed into context-aware vector representations via a bidirectional LSTM (BiLSTM) [39] layer, which can be expressed by the following formulae:  
\[\overleftarrow{H_{d}} =\overleftarrow{LSTM_{d}}(E), \tag{1}\] \[\overrightarrow{H_{d}} =\overleftarrow{LSTM_{d}}(E),\] (2) \[H_{d} =\overleftarrow{H_{d}}+\overrightarrow{H_{d}}. \tag{3}\]  
where \(H_{d}=\{h_{d1},h_{d2},\ldots,h_{dn}\}\) are hidden states consisting of the forward states \(\overleftarrow{H_{d}}\) and backward states \(\overrightarrow{H_{d}}\) from BiLSTM. The internal structure of a cell in LSTM is described by the following formulae:  
\[f_{i} =\sigma(v_{f}\cdot[h_{i-1},e_{i}]+b_{f}), \tag{4}\] \[i_{i} =\sigma(v_{i}\cdot[h_{i-1},e_{i}]+b_{i}),\] (5) \[\widetilde{c_{i}} =tanh(v_{c}\cdot[h_{i-1},e_{i}]+b_{c}),\] (6) \[C_{i} =f_{i}\cdot c_{i-1}+i_{i}\cdot\widetilde{c_{i}},\] (7) \[o_{i} =\sigma(v_{o}\cdot[h_{i-1},e_{i}]+b_{o}),\] (8) \[h_{i} =o_{i}\cdot tanh(C_{i}), \tag{9}\]  
Figure 1: Overall framework of AP-MDSC. In the formulae above, \(f_{i}\), \(i_{i}\), and \(o_{i}\) denote the forget gate, the input gate, and the output gate, which are used to regulate the influence of historical inputs and the current input, as well as the current information output at time \(i\), respectively, according to the previous hidden state \(h_{i-1}\) and present word embbeding \(e_{i}\). \(\bar{c_{i}}\) and \(C_{i}\) are referred to as the unit state. \(\sigma\) denotes the sigmoid function. \(v\) and \(b\) with different subscripts represent the projection matrix and the bias, respectively. At this point, the domain representation of the input text \(h_{d}\) is the last hidden state of the input text, and it is converted to a probability distribution on the domain labels, which is as follows:  
\[\overrightarrow{H_{d}} =\overleftarrow{LSTM_{d}}(E),\]0  
where \(f_{d}\) is the mapping of \(h_{d}\) into a predicted domain label \(\hat{y}_{d}\). Then, the word embeddings and the domain representation are fed into another BiLSTM and the attention layer in the sentiment module. The word embeddings are converted into context-aware hidden states \(H=\{h_{1},h_{2},\ldots,h_{n}\}\) via the BiLSTM, and then the hidden states and the domain representation interact to produce attention weights \(\{\alpha_{1},\alpha_{2},\ldots,\alpha_{n}\}\) at the attention layer as follows:  
\[\overrightarrow{H_{d}} =\overleftarrow{LSTM_{d}}(E),\]1  
where \(f\) is a fusion function. It is defined as a linear projection in DAM. Our work proposes a new method of information interaction, which will be thoroughly introduced in the next subsection.