# AFGN: Adaptive Filtering Graph Neural Network for Few-Shot Learning
## 2 Materials and Methods
### The Proposed Method
#### 2.2.4 Graph Convolution of AFGN
Select all labeled nodes of each category from the support set \(S\), aggregate the edge features that are associated with the unlabeled node \(\mathbf{x}_{i}\) and these nodes belonging to the same class, and utilize this aggregation as the comprehensive similarity of the unlabeled node \(\mathbf{x}_{i}\) to that class:  
\[H_{c}(\mathbf{x}_{i})=\sum_{j=1}^{M\times K}\big{(}\bar{H}_{ij}\xi_{j,c}\big{)} \tag{15}\]  
where \(H_{c}(\mathbf{x}_{i})\) denotes the comprehensive similarity of the unlabeled node \(\mathbf{x}_{i}\) belonging to class \(c\), \(\xi_{j,c}\) takes on a value of either 1 or 0. It is 1 when the class of node \(j\) is \(c\), otherwise it is 0. Then, the comprehensive similarity of each class is normalized utilizing the softmax function:  
\[P(\bar{y}_{i}=c\mid\mathbf{x}_{i})=\frac{\exp(H_{c}(\mathbf{x}_{i}))}{\sum_{ m=1}^{M}\exp(H_{m}(\mathbf{x}_{i}))} \tag{16}\]  
where \(\bar{y}_{i}\) represents the predicted label for node \(\mathbf{x}_{i}\), while \(P(\bar{y}_{i}=c\mid\mathbf{x}_{i})\) signifies the probability of node \(\mathbf{x}_{i}\) belonging to class \(c\). Next, the cross-entropy between the predicted label and the true label for \(Q\) is calculated as:  
\[L(\varphi,\eta,W)=-\sum_{i=1}^{q}\sum_{c=1}^{M}\delta(y_{i}==c)\log(P(\bar{y }_{i}=c\mid\mathbf{x}_{i})), \tag{17}\]  
where \(\delta(u)\) is an indicator function where \(\delta(u)=1\) if \(u\) is true, otherwise it is 0. \(y_{i}\) is the ground truth corresponding to node \(\mathbf{x}_{i}\). The 5-way 1-shot task was selected as an illustrative example to explore the correlation between frequency component coefficients and filter properties. In this episodic task, the support set \(S\) comprises 5 samples, the query set \(Q\) comprises 1 sample, and \(n=6\). The frequency component coefficients \(p(\lambda)\) of different filters change with \(\lambda\) is shown in Figure 3. The \(x\)-axis of the graph is \(\lambda\), and \(\Lambda=diag[\lambda_{1},\lambda_{2},...\lambda_{6}]\). Since \(\lambda_{i}\in[0,2]\), set a frequency threshold \(\bar{\lambda}=1\). If \(\lambda_{i}<\bar{\lambda}\), then \(\lambda_{i}\) is considered as a low frequency;otherwise, it is categorized as a high frequency. The discrete points in Figure 3 are the frequency component coefficients \(p(\lambda_{i})\) of each filter corresponding to the frequency \(\lambda_{i}\). GCN is a stationary filter with \(p(\lambda)_{stat}=\lambda\), corresponding to the solid red line in Figure 3. The high and low frequency component coefficients of GCN are neither enhanced nor suppressed. Therefore, we use this red solid line as a reference. In the region to the left of the red solid line in the first quadrant of the coordinate axes, we regard it as the region of frequency enhancement. Correspondingly, the region to the right of the red solid line, we refer to it as the region of frequency suppression. ChebyNet is a high-pass filter, with \(p(\lambda)_{high}=\alpha_{1}\lambda+\alpha_{2}\lambda^{2}+\ldots+\alpha_{k-1 }\lambda^{k-1}\), corresponding to the solid green line in Figure 3. In the low-frequency region where \(0\leq\lambda\leq 1\), \(p(\lambda)_{high}\) is lower than \(p(\lambda)_{stat}\), located in the low-frequency suppression area. while in the high-frequency region where \(1\leq\lambda\leq 2\), \(p(\lambda)_{high}\) is mostly higher than \(p(\lambda)_{stat}\), situated in the high-frequency enhancement area. Therefore, \(p(\lambda)_{high}\) constructs a high-pass filter that suppresses low frequencies and enhances high frequencies for ChebyNet. In addition, HDGN is a low-pass filter, with \(p(\lambda)_{low}=e^{-s\lambda}\), corresponding to the solid blue line in Figure 3. In the low-frequency region where \(0\leq\lambda\leq 1\), \(p(\lambda)_{low}\) is mostly higher than \(p(\lambda)_{stat}\), located in the low-frequency enhancement area. while in the high-frequency region where \(1\leq\lambda\leq 2\), \(p(\lambda)_{low}\) is lower than \(p(\lambda)_{stat}\), situated in the high-frequency suppression area.