# Few-Shot Charge Prediction with Data Augmentation and Feature Augmentation
## 3 Method
### Feature Augmentation
#### 3.2.1 Charge Label Heterogeneous Graph  
As shown in Figure 1 above the structure of the charge label, each category includes a variety of charges (i.e., labels). Each label has a specific definition, which can be used for word segmentation. Therefore, this paper established two types of nodes \(V\), word nodes and label nodes, and establishes edges \(E\) between nodes: word-word edge, word-label edge, and label-label edge. The structure is shown in Figure 4. On the right is the heterogeneous graph schema; on the left is a set of heterogeneous graphs with three labels and K words. Based on different categories, we constructed multiple groups of heterogeneous graphs. The total number of nodes in every graph is the number of labels plus the number of unique words charge information [33]. We considered every word and label as a one-hot vector as the input model and used the identity matrix as the feature matrix [34]. The label-word edges can be built based on word occurrence in labels, and the word-word edges can be built based on word co-occurrence in the whole corpus. Specifically, the weights between two word nodes can be calculated by point-wise mutual information (PMI) [35], which is a common method of word associations. Since the words are specific explanations of labels, the weight of the edge between a label node and a word node is the term frequency-inverse document frequency (TF-IDF) of the word in the label [36]. The same heterogeneous graph of the charges is relevant; we used similarity to define the weights between two label nodes. Formally, we calculated the weights of edge between node \(i\) and node \(j\) as follows:  
\[A_{ij}=\left\{\begin{array}{ll}PMI(i,j)&i\text{ and }j\text{ are words}\\ TFIDF(i,j)&i\text{ is a label and }j\text{ is a word}\\ similarity(i,j)&i\text{ and }j\text{ are labels}\\ 1&i=j\\ 0&\text{ otherwise}\end{array}\right. \tag{8}\]  
where \(PMI(i,j)\) is a word pair \(i,j\) and the PMI value is computed as \(PMI(i,j)=\log\frac{p(i,j)}{p(i)p(i)}\), where \(p(i,j)=\frac{W(i,j)}{W(i)}\), \(p(i)=\frac{W(i)}{|W|}\). \(|W|\) is the total number of sliding windows. \(W(i)\) is the number of sliding windows containing word \(i\) in the corpus and \(W(i,j)\) is the number of sliding windows containing both word \(i\) and \(j\). PMI values reflect the semantic relevance between words; a positive PMI value indicates high semantic relevance and a negative value indicates low or no semantic relevance, so this paper only added edges between word pairs with positive PMI values. In addition, \(TFIDF(i,j)=TF(i,j)\ast IDF(j)\), where \(TF(i,j)\) is the number of times word appears in the label \(i\), \(IDF=\log(\frac{N_{all}}{N_{i}+1})\), \(N_{all}\) is the total number of tags, and \(N_{w}+1\) is the number of labels that contain the word \(j\). We used the cosine similarity of the word vector as the weight between two label nodes, \(similarity(i,j)=\frac{p_{i}\cdot v_{j}}{\left\|v_{i}v_{j}\right\|}\), where \(v_{i}\) and \(v_{j}\) are the vectors of label \(i\) and label \(j\), respectively, and word2 vec was used to calculate the word vector of the label.