Aspect category detection (ACD) in sentiment analysis aims to identify the aspect categories mentioned in a sentence. In this paper, we formulate ACD in the few-shot learning scenario. However, existing few-shot learning approaches mainly focus on single-label predictions. These methods can not work well for the ACD task since a sentence may contain multiple aspect categories. Therefore, we propose a multi-label few-shot learning method based on the prototypical network. To alleviate the noise, we design two effective attention mechanisms. The support-set attention aims to extract better prototypes by removing irrelevant aspects. The query-set attention computes multiple prototype-specific representations for each query instance, which are then used to compute accurate distances with the corresponding prototypes. To achieve multi-label inference, we further learn a dynamic threshold per instance by a policy network. Extensive experimental results on three datasets demonstrate that the proposed method significantly outperforms strong baselines. Aspect category detection (ACD) (Pontiki et al., 2014, 2015) is an important task in sentiment analysis. It aims to identify the aspect categories mentioned in a given sentence from a predefined set of aspect categories. For example, in the sentence the cheesecake is tasty and the staffs are friendly , two aspect categories, i.e. food and service , are mentioned. The performance of existing approaches for the ACD task (Zhou et al., 2015; Schouten et al., 2018; Hu et al., 2019) relies heavily on the scale of the labeled dataset. They usually suffer from limited data and fail to generalize well to novel aspect categories with only a few labeled  Shiwan Zhao is the corresponding author. instances. On the one hand, it is time-consuming and labor-intensive to annotate large-scale datasets. On the other hand, given a large dataset, many long-tail aspects still suffer from data sparsity. Few-shot learning (FSL) provides a solution to address the above challenges. FSL learns like a human, identifying novel classes with limited supervised information by exploiting prior knowledge. Many efforts have been devoted to FSL (Ravi and Larochelle, 2017; Finn et al., 2017; Snell et al., 2017; Wang et al., 2018; Gao et al., 2019). Among these methods, the prototypical network (Snell et al., 2017) is a promising approach, which is simple but effective. It follows the meta-learning paradigm by building a collection of N -way K shot meta-tasks. A meta-task aims to infer a query set with the help of a small labeled support set. It first learns a prototype for each class in the support set. Then the query instance is predicted by measuring the distance with N prototypes in the embedding space. scenario, which aims to detect aspect categories accurately with limited training instances. However, ACD is a multi-label classification problem since a sentence may contain multiple aspect categories. Most FSL works learn a single-label classifier and can not work well to address the ACD task. The reasons are two-fold. Firstly, the sentences of each class (i.e., aspect category) in the support set are diverse and contain noise from irrelevant aspects. As displayed in Figure 1, there are three classes in the support set, and each class has two instances. The aspect categories food and salon tend to be noise for this meta-task, making it hard to learn a good prototype for each class in the support set. Secondly, the query set is also noisy. Figure 1 demonstrates three different cases. The first sentence mentions two aspects hotel and room cleanliness out of the support set. We need to detect both aspects accurately as multi-label classification. When detecting each of them, the other aspect acts as noise and makes the task hard. The second sentence is an easy case with a single aspect staff owner . The third sentence mentions the aspect staff owner out of the support set, while the aspect service is noise for this meta-task. In summary, the noise from both the support set and query set makes the few-shot ACD a challenging task. To this end, we propose a multi-label FSL method based on the prototypical network (Snell et al., 2017). We alleviate the noise in the support set and query set by two effective attention mechanisms. Concretely, the support-set attention tries to extract the common aspect of each class. By removing the noise (i.e., irrelevant aspects), the support-set attention can yield better prototypes. Then for a query instance, the query-set attention utilizes the prototypes to compute multiple prototype-specific query representations, in which the irrelevant aspects are removed. Given the better prototypes and the corresponding prototype-specific query representations, we can compute accurate distances between the query instance and the prototypes in the embedding space. We detect the aspect categories in the query instance by ranking the distances. To select the positive aspects from the ranking, we design a policy network (Williams, 1992) to learn a dynamic threshold for each instance. The threshold is modeled as the action of the policy network with continuous action space. We formulate ACD as a multi-label FSL problem and design a multi-label FSL method based on the prototypical network to solve the problem. To the best of our knowledge, we are the first to address ACD in the few-shot scenario. To alleviate the noise from the support set and query set, we design two effective attention mechanisms, i.e., support-set attention and query-set attention. Experimental results on the three datasets demonstrate that our method outperforms strong baselines significantly. Aspect Category Detection Previous works for ACD can mainly be divided into two types: unsupervised and supervised methods. Unsupervised approaches extract aspects by mining semantic association (Su et al., 2006) or co-occurrence frequency (Hai et al., 2011; Schouten et al., 2018). These methods require a large corpus to mine aspect knowledge and have limited performance. Supervised methods address this task via hand-crafted features (Kiritchenko et al., 2014), automatically learning useful representations (Zhou et al., 2015), multi-task learning (Xue et al., 2017; Hu et al., 2019), or topic-attention model (Movahedi et al., 2019). The above methods detect aspect categories out of a pre-defined set, which cannot handle the unseen classes. These challenges motivate us to investigate this task in the few-shot scenario. Few-Shot Learning Few-shot learning (FSL) (Fe-Fei et al., 2003; Fei-Fei et al., 2006) is close to real artificial intelligence, which borrows the learning process from the human. By incorporating the prior knowledge, it obtains new knowledge fast with limited supervised information. Many works have been proposed for FSL, which can be mainly divided into four research directions. One promising direction is distance-based methods. These methods measure the distance between instances in the feature embedding space. The siamese network (Koch et al., 2015) infers the similarity score between an instance pair. Others compare the cosine similarity (Vinyals et al., 2016) or Euclidean distance (Snell et al., 2017). The relation network (Sung et al., 2018) exploits a neural network to learn the distance metric. Afterward, SA E query Softmax Label of query MSE Loss 1 1 0 0.5 0.5 0 Normalize Support-set Attention SA E SA E E QA QA QAH i 1 Support set Aspect category 1 Aspect category 2 Aspect category 3 H i 2 H i 1 H i 2 H i 1 H i 2 i = 1 i = 2 i = 3 H q H i 1 H i 2 v i attention matrix W i aspect-wise attention r i 1 r i 2 E SA QA Encoder Support-set Attention Query-set Attention Euclidean distance prototype r i K-shot instances of aspect i common aspect vector Figure 2: The left part depicts the main network for an example N -way K -shot meta-task with a query instance ( N = 3 , K = 2 ). Garcia and Bruna (2018) utilize graph convolution network to extract the structural information of classes. The second direction focuses on the optimization of networks. Model-agnostic meta-learning (MAML) algorithm (Finn et al., 2017) learns a good initialization of the model and updates the model by a few labeled examples. Meta networks (Munkhdalai and Yu, 2017) achieve rapid generalization via fast parameterization. The third type is based on hallucination (Wang et al., 2018; Li et al., 2020). This research line directly deals with data deficiency by learning to augment, which designs a generator on the base classes and then hallucinates novel class data to augment few-shot samples. The last direction introduces a weight generator to predict classification weight given a few novel class samples, either based on attention mechanism (Gidaris and Komodakis, 2018) or Gaussian distribution (Guo and Cheung, 2020). A recent work Proto-HATT (Gao et al., 2019) is similar to ours. Proto-HATT is based on the prototypical network (Snell et al., 2017), which deals with the text noise in the relation classification task by employing hybrid attention at both the instance-level and the feature-level. This method is designed for single-label FSL. Compared with it, our method designs two attention mechanisms to alleviate the noise on the support set and query set, respectively. The collaboration of two attentions helps compute accurate distances between the query instance and prototypes, and then improves multi-label FSL. with single-label FSL, the multi-label FSL has been underexplored. Previous works focus on image synthesis (Alfassy et al., 2019) and signal processing (Cheng et al., 2019). Rios and Kavuluru (2018) develop few-shot and zero-shot methods for multi-label text classification when there is a known structure over the label space. Their approach relies on label descriptors and the hierarchical structure of the label spaces, which limits its application in practice. Hou et al. (2020) propose to address the multi-label intent detection task in the FSL scenario. It calibrates the threshold by kernel regression. Different from this work, we learn a dynamic threshold per instance in a reinforced manner. In the few-shot ACD scenario, each meta-task contains a support set S and a query set Q . The meta-task is to assign the query instance to the class(es) of the support set. An instance may be a multi-aspect sentence. Thus a query sentence may describe more than one class out of the support set 1 . Therefore, we define the few-shot ACD as a multi-label few-shot classification problem. Suppose in an N -way K -shot meta-task, the support set is S = { ( x i 1 , ...x iK ) , y i } N i =1 , where each x i 1 We found that the probability of a query instance belonging to more than one class is around 4.5% in the ACD dataset, i.e. FewAsp, by randomly sampling 10,000 5-way 5-shot meta-tasks with 5 query sentences for each class. is a sentence and ( x i 1 , ..., x iK ) all contain the aspect category y i . A query instance is ( x q , y q ) , where y q is a binary label vector indicating the aspects in x q out of N classes. Figure 2 presents the main network by an example 3-way 2-shot meta-task. It is composed of three modules, i.e., encoder, support-set attention (SA) and query-set attention (QA). Each class in the support set contains K instances, which are fed into the encoder to obtain K encoded sequences. Next, SA module extracts a prototype for this class from the encoded sequences. After obtaining N prototypes, we feed a query instance into the QA module to compute multiple prototype-specific query representations, which are then used to compute the Euclidean distances with the corresponding prototypes. Finally, we normalize the negative distances to obtain the ranking of prototypes and then select the positive predictions (i.e., aspect categories) by a dynamic threshold. Next, we will introduce the modules of our method in detail. Given an input sentence x = { w 1 , w 2 , ..., w n } , we first map it into an embedding sequence { e 1 , e 2 , ..., e n } by looking up the pre-trained GloVe embeddings (Pennington et al., 2014). Then we encode the embedding sequence by a convolutional neural network (CNN) (Zeng et al., 2014; Gao et al., 2019). The convolution kernel slides with the window size m over the embedding sequence. We gain the contextual sequence H = { h 1 , h 2 , ..., h n } , H  R n  d : h i = CNN( e i  m  1 2 , ..., e i + m  1 2 ) (1) where CNN(  ) is a convolution operation. The advantages of CNN are two-fold: first, the convolution kernel can extract n-gram features on the receptive field. For example, the bi-gram feature of hot dog could help detect the aspect category food ; second, CNN enables parallel computing over inputs, which is more efficient (Xue and Li, 2018). In each class of the support set, the K -shot instances describe a common aspect, i.e., the target aspect of interest 2 . As shown in Figure 1, two 2 In almost all cases, there is only one common aspect in the K instances. We randomly sample 10,000 5-way 5-shot meta-tasks, and found that the probability of containing more than one common aspect in each class is less than 0.086%. The probability will be much lower in the 10-way scenario. sentences, Cleanliness was great, and the food was really good and People have mentioned, bed bugs on yelp!! , share the common aspect room cleanliness . The former contains two aspect categories room cleanliness and food . In this example meta-task, it is an instance of the class room cleanliness . However, when sampling other meta-tasks, the instance may be used to represent the class food . This leads to confusion and makes learning a good prototype difficult. To deal with the issue brought by multi-aspect sentences, we first need to identify the common aspect. As depicted in the right part of Figure 2, we compute the common aspect vector by the combination of the K -shot instances. We then regard the vector as a condition and inject it into the attention mechanism to make our attention mechanism aspect-wise. Common Aspect Vector The encoded K -shot instances of a class contain one common aspect and some irrelevant aspects. Among these aspects, the common aspect is the majority. Thus, we simply conduct a word-level average to extract the common aspect vector v i  R d . The average operation highlights the common aspect, but cannot completely eliminate noisy aspects. To further reduce the noise of irrelevant aspects in each instance, we use the common aspect as the condition in the attention mechanism. Aspect-Wise Attention To make the attention mechanism adapt to the condition, we have two designs. First, we directly use the common aspect vector to compute the attention with each instance (see Eq. 4), which filters out the irrelevant aspects of each instance to some extent. Second, we exploit the idea of dynamic conditional network, which has been demonstrated effective in FSL (Zhao et al., 2018). By predicting a dynamic attention matrix with the common aspect vector, our attention mechanism can further adapt to the condition, i.e., the common aspect vector of the class. Specifically, we learn different perspectives of the condition by simply repeating the common aspect vector (Vaswani et al., 2017). Then it is fed into a linear layer to obtain the attention matrix W i for class i . where ( v i  e M )  R e M  d is the operation repeatedly concatenating v i for e M times. The linear layer has parameter matrix W  R d  e M and bias b  R d . This layer is shared in the classes of all meta-tasks, which is learned to be class-agnostic. Thus in the testing phase, it can generate aspect-wise attention for a novel class. Then in class i of the support set, we exploit the common aspect vector and attention matrix to calculate a denoised representation for every instance. The denoised representation r ij for the j -th instance is computed as below. In this way, the support-set attention is adapted to the condition and is also class-specific. Thus it tends to focus on the correct aspect even for a multi-aspect sentence representing different classes. Finally, the average of denoised representations for K -shot instances is the prototype of this class. r i = avg( r i 1 , r i 2 , ..., r iK ) (5) After processing all classes in the support set, we obtain N prototypes { r 1 , r 2 , ..., r N } . A query instance may also contain multiple aspects, making the sentence noisy. To deal with the noise in a query instance, we select the relevant aspects from the query instance by the QA module. Specifically, we first process the query instance by the encoder and obtain the encoded instance H q . Then we feed H q into the QA module to obtain multiple prototype-specific query representations r iq by the N prototypes. The QA module tries to focus on the aspect category which is similar to the prototype. In Eq. 6, the attention is non-parametric. It can reduce the dependence on parameters and can accelerate the adaptation to unseen classes. For a query instance, we compute the Euclidean distance (ED) between each prototype and its prototype-specific query representation, and we obtain N distances. Next, we normalize the negative distances as the final prediction, which is a ranking of the prototypes. where y q is the ground-truth. We also normalize y q to ensure the consistency between the prediction and the ground-truth. Learning Dynamic Threshold (DT) To select the positive aspects from the ranking (see Eq. 7) for a query instance, we further learn a dynamic threshold. The threshold is modeled by a policy network (Williams, 1992), which has a continuous action space following Beta distribution (Chou et al., 2017). Given a query instance, we define the state as [( r 1  r 1 q ) 2 ; ... ; ( r N  r Nq ) 2 ;  y ] . We feed the state into the policy network and obtain the parameters a and b of a Beta distribution. Then we sample a threshold  from Beta (  | a, b ) . The reward score is the F1 score for this instance based on  . We also introduce a reference score  , which is the F1 score based on a baseline action, i.e., the mode of Beta (  | a, b ) : a  1 a + b  2 . The training objective is defined as below to minimize the negative expected reward. We construct three few-shot ACD datasets from Yelp aspect (Bauman et al., 2017), which is a large-scale multi-domain dataset for aspect recommendation. We group all instances by aspects and choose 100 aspect categories. Following Han et al. (2018), we split the 100 aspects without intersection into 64 aspects for training, 16 aspects for validation, and 20 aspects for testing. According to the sentence type, i.e., single-aspect or multi-aspect 3 , we sample different types of sentences from each group and construct three datasets: FewAsp(single), FewAsp(multi), and FewAsp, which are composed of single-aspect, multi-aspect, and both types of sentences, respectively. Note that FewAsp is randomly sampled from the original set of each class, which can better reflect the data distribution in real applications. The statistics of the three datasets are shown in Table 1. Evaluation Metrics Previous single-label FSL (Snell et al., 2017) usually evaluates performance by accuracy. In the multi-label setting, we choose AUC (Area Under Curve) and macro-f1 as the evaluation metrics. AUC is utilized for model selection and macro-f1 is computed with a threshold. In our experiments, we found that for all methods in three datasets, the overall best thresholds are 0.3 in the 5-way setting and 0.2 in the 10-way setting. Thus we choose them for evaluating the baselines. Training Details We first train the main network with MSE loss L (Eq. 8). Then we initialize the main network with the learned parameters and jointly train the policy network with L t (Eq. 9). The implementation details are described in the appendix. 3 A sentence contains a single aspect or multiple aspects. Our approach is named as Proto-AWATT (aspect-wise attention). We validate the effectiveness of the proposed method by comparing with the following popular approaches. Matching Network (Vinyals et al., 2016): It is a metric-based attention method, where distance is measured by cosine similarity. Prototypical Network (Snell et al., 2017): It computes the average of embedded support examples for each class as the prototype, and then measures the distance between the embedded query instance and each prototype. Relation Network (Sung et al., 2018): It utilizes a neural network to learn the relation metric. Graph Network (Garcia and Bruna, 2018): It casts FSL as a supervised message passing task by graph neural network. IMP (Allen et al., 2019): It proposes infinite mixture prototypes to represent each class by a set of clusters, with the number of clusters determined directly from the data. noise with hybrid instance-level and feature-level attention mechanisms. We report the experimental results of various methods in Table 2, Table 3, Table 4 and Table 5. The best scores on each metric are marked in bold. The experimental results demonstrate the effectiveness of our method. Overall Performance AUC and macro-f1 scores of all the methods are shown in Table 2, Table 3 and Table 4. Firstly, we observe that our method Proto-AWATT achieves the best results on almost all evaluation metrics of the three datasets. This reveals the effectiveness of the proposed method. Secondly, compared to Proto-HATT, Proto-AWATT achieves significant improvement. It is worth noting that the average improvement of macro-f1 on three datasets is 4.99%. This exhibits that the SA and QA modules successfully reduce noise for few-shot ACD. Meanwhile, accurate distance measurement between prototypes and the prototype-specific query representations can facilitate the detection of multiple aspects in the query instance. Then we found that all methods on Fe-wAsp(multi) perform consistently worse than the counterparts on FewAsp(single) and FewAsp. This is because more aspects increase the complexity of the dataset. On FewAsp(multi), Proto-AWATT still outperforms other methods in most settings, Models Proto-HATT Proto-AWATT AUC F1 AUC F1 GloVe + CNN 0.9063 57.26 0.9206 65.65 GloVe + LSTM 0.9137 59.46 0.9357 66.86 BERT 0.8971 57.33 0.9459 70.09 DistilBERT 0.9067 59.57 0.9451 70.23 Table 6: Ablation study of using different encoders in the 10-way 5-shot scenario on FewAsp. In general, the 10-way scenario contains much more noise than the 5-way. We observe that compared to Proto-HATT, Proto-AWATT achieves more significant improvements in the 10-way scenario than the 5-way. The results further indicate that Proto-AWATT can really alleviate the noise. Ablation Study Table 5 depicts the results of ablation study. Firstly, without the SA module, the performances of Proto-AWATT drop a lot. In particular, AUC drops by 3.43%, and macro-f1 drops by 17.23% relatively. This verifies that the SA module helps reduce noise and extract better prototypes. We can also see that without attention matrix W i in SA causes consistent decreases on all metrics. This suggests that predicting dynamic attention matrix for each class is effective, which makes the SA module extract better prototypes. Then we found that without the QA module, Proto-AWATT significantly performs worse. This validates that for a query instance, computing multiple prototype-specific query representations helps obtain accurate distances for ranking, which facilitates the multi-label predictions. Finally, when removing DT and using a static threshold (  = 0 . 2 in the 10-way setting), it causes a slight decrease. This shows that learning dynamic threshold is effective. We further compare DT with two alternative dynamic threshold methods: (1) MS (mean  standard deviation of the threshold by cross-validation); (2) a kernel regression (KR) 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 Threshold 0 10 20 30 40 50 60 M a c r o F 1 Proto-HATT Proto-AWATT w/o DT Proto-AWATT Proto-AWATT w/o DT w/ KR Figure 3: Macro-f1 scores for different thresholds on 10-way 5-shot setting of FewAsp. approach which is proposed by Hou et al. (2020) to calibrate the threshold. Comparing with MS and KR, our method slightly outperforms them. This is because DT benefits from reinforcement learning and directly optimizes the evaluation metrics. Different Encoders We also compare the performances of our method with a strong baseline Proto-HATT when using different encoders to obtain the contextual sequence H . The results are reported in Table 6. The output of pre-trained encoders, i.e., BERT (Devlin et al., 2019) or DistilBERT (Sanh et al., 2019), are directly used as the contextual sequence. We observe that Proto-AWATT significantly outperforms the strong baseline Proto-HATT on all encoders. Effects of Thresholds As depicted in Figure 3, we analyze the impact of different thresholds on the macro-f1 score during inference. We can see that Proto-AWATT without DT consistently outperforms Proto-HATT in various thresholds. Macro-f1 scores of the two methods are getting worse as  grows. However, the declines in Proto-HATT are more significant. At  = 0 . 9 , the macro-f1 of Proto-HATT drops nearly to 0. Proto-AWATT without DT still achieves much higher macro-f1. This indicates that the proposed two attention mechanisms help extract an accurate ranking of prototypes. The ranking is less sensitive to the threshold, which makes our method robust and stable. We also found that learning threshold by DT benefits from a reinforced way, which slightly outperforms KR and the best static threshold. We further analyze Proto-AWATT by visualizing the extracted representations from the support set and query set, respectively. The representations are visualized by t-SNE (Maaten and Hinton, 2008). To observe the performance in a challenging situation, we choose the testing set from FewAsp(multi) as an example. Support Set Figure 4 presents the visualization of extracted prototypes from two methods. We randomly sample 5 classes and then sample 50 times of 5-way 5-shot meta-tasks for the five classes. Then for each class, we have 50 prototype vectors. We observe that prototype vectors from our approach are more separable than those from Proto-HATT. This further indicates that the SA module can alleviate noise and thus yield better prototypes. Query Set We randomly sample 5 classes and then sample 20 times of 5-way 5-shot meta-tasks for these classes. Each meta-task has 5 query instances per class. Thus we have 25  20 = 500 query instances. It is worth noting that our model learns N prototype-specific query representations for each query instance. We choose the representations according to the ground-truth label. However, Proto-HATT only outputs a single representation for a query instance. As depicted in Figure 5, we can see that the representations learned by our method are obviously more separable than those by Proto-HATT. This further reveals that Proto-AWATT can obtain accurate prototype-specific query representations, which contributes to computing accurate distances. In this paper, we formulate the aspect category detection (ACD) task in the few-shot learning (FSL) scenario. Existing FSL methods mainly focus on single-label predictions. They can not work well for the ACD task since a sentence may contain multiple aspect categories. Therefore, we propose a multi-label FSL method based on the prototypical network. Specifically, we design two effective attention mechanisms for the support set and query set to alleviate the noise from both sets. To achieve multi-label inference, we further learn a dynamic threshold per instance by a policy network with continuous action space. Extensive experimental results in three datasets demonstrate that our method outperforms strong baselines significantly. We sincerely thank all the anonymous reviewers for providing valuable feedback. This work is supported by the National Science and Technology Major Project, China (Grant No. 2018YFB0204304).
abstain method abstain abstain objective method abstain abstain result abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain method abstain method abstain objective objective method objective other other other other other objective other other other other other other other other other other other other other other other other other other other method other other other other other other other abstain abstain abstain abstain abstain method abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain method abstain abstain abstain abstain abstain abstain method abstain abstain abstain abstain abstain abstain method method method abstain abstain method abstain method abstain abstain abstain method abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain method method method abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain method abstain method abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain result abstain abstain abstain abstain abstain method method abstain abstain abstain abstain abstain abstain result abstain abstain abstain result abstain abstain abstain abstain abstain result abstain abstain abstain result abstain abstain abstain abstain abstain result abstain result abstain abstain abstain other abstain result abstain result abstain abstain result abstain result abstain abstain abstain abstain abstain abstain abstain result abstain abstain abstain result abstain abstain abstain result abstain abstain abstain abstain abstain abstain abstain result abstain method abstain abstain objective method result objective other other