# Aspect-Based Sentiment Analysis Using Aspect Map
## 4 Learning AMEN and AMSAN  
### Aspect-Map Extraction Network (AMEN)  
The aspect-map extraction network (AMEN) aims to extract an aspect map that indicates which parts of a text are relevant to a given aspect. However, it cannot be trained directly to return the aspect map because the training set for ABSA has only the information about the aspects \(cs\) and their corresponding sentiment polarities \(s\)s of a text \(\mathbf{t}\), but not any information about the relevancy of words in \(\mathbf{t}\) to \(cs\). Therefore, AMEN should learn the relevant words in a weakly supervised manner, while its actual function is to map \(\mathbf{t}\) to \(cs\). Figure 4 depicts the architecture of AMEN. AMEN has four layers of a word embedding layer, a convolutional layer, a global average pooling layer and a classification layer. The word embedding layer maps every word \(w\in\mathbf{t}\) to its corresponding word vector \(\mathbf{v}\in\mathbb{R}^{D}\), where \(D\) is the dimension of word embedding vectors. Because \(\mathbf{t}\) is assumed to have \(N\) words, the word embedding layer returns a matrix \(\mathbf{X}=[\mathbf{v}_{1}^{T},\mathbf{v}_{2}^{T},\ldots,\mathbf{v}_{N}^{T}]\) as its output. After \(\mathbf{X}\) is obtained, the convolutional layer represents it as a matrix of feature values using kernels with various sizes. There are usually \(K\) kernels for every size \(h\in H\) in the convolutional layer, and each kernel \(\mathbf{W}_{h_{k}}\in\mathbb{R}^{D\times h}\) (\(1\leq k\leq K\)) is applied to a window of \(h\) words. Then, the feature value \(z_{i}^{h_{k}}\) for the \(i\)-th word window \(\mathbf{X}_{i:i+h-1}\) by a kernel \(\mathbf{W}_{h_{k}}\) is computed as  
\[z_{i}^{h_{k}}=f(\mathbf{W}_{h_{k}}*\mathbf{X}_{i:i+h-1}+b_{h_{k}}), \tag{1}\]  
where \(f(\cdot)\) is a non-linear function such as tanh or ReLU, \(b_{h_{k}}\in\mathbb{R}\) is a bias and \(*\) denotes the convolution operation. Thus, the feature map obtained by a kernel \(\mathbf{W}_{h_{k}}\) is represented as  
\[\mathbf{z}^{h_{k}}=\langle z_{1}^{h_{k}},z_{2}^{h_{k}},\ldots,z_{N-h+1}^{h_{k} }\rangle. \tag{2}\]  
Because there are \(K\) kernels for every size \(h\), \(K\cdot|H|\) feature maps are produced from the convolutional layer. To make the length of all feature maps equal to that of the input text \(\mathbf{t}\), the _half padding_[27] is applied for all convolutional operations. As a result, the final output of the convolutional layer is a matrix \(\mathbf{Z}\in\mathbb{R}^{(K\cdot|H|)\times N}\) whose row vector is \(\mathbf{z}^{h_{k}}\). Figure 3: Overall process to determine the aspect-level sentiment polarity by the proposed model. Background colors depict an aspect map that indicates the relevance of each word to the aspect _FOOD_. Blue color means that a word is almost irrelevant to \(c\). Red colors mean that a word is relevant to \(c\) as strong as the color strength. The global average pooling (GAP) is then applied to each row vector \(\mathbf{z}^{h_{k}}\) of \(\mathbf{Z}\), and a feature value \(\hat{z}^{h_{k}}\) is produced for every \(\mathbf{z}^{h_{k}}\) by summing all \(z_{i}^{h_{k}}\)s. That is,  
\[\hat{z}^{h_{k}}=\sum_{i=1}^{N}z_{i}^{h_{k}}. \tag{3}\]  
Because \(K\cdot|H|\) feature values are generated by GAP, the final feature vector \(\mathbf{g}\) has \(K\cdot|H|\) dimensions. Then, the classification layer finally predicts the vector of aspect categories by  
\[\mathbf{y}=f(\mathbf{W}_{y}\cdot\mathbf{g}+\mathbf{b}_{y}), \tag{4}\]  
where \(\mathbf{W}_{y}\in\mathbb{R}^{C\times(K\cdot|H|)}\) is a weight matrix and \(\mathbf{b}_{y}\in\mathbb{R}^{C}\) is a bias vector. AMEN is trained with a dataset \(\mathcal{D}_{a}=\{(\mathbf{t},\mathbf{c}^{\mathbf{t}})\}\) extracted from the ABSA dataset \(\mathcal{D}_{s}\). Figure 5 shows how to prepare \(\mathcal{D}_{a}\) from \(\mathcal{D}_{s}\). Note that a text \(\mathbf{t}\) can appear several times in \(\mathcal{D}_{s}\) with different aspects. On the other hand, \(\mathcal{D}_{a}\) represents \(\mathbf{t}\) only once.