# ReliaMatch: Semi-Supervised Classification with Reliable Match
## 3 Method
### Feature Anchoring  
Our first contribution is feature anchoring, which uses the features of the labeled data to calculate the average of the features of each category as an anchor. We think that nearby points are likely to have the same labels, and we also agree that points on the same structure (usually called clusters or manifolds) may have the same label. Therefore, our method pays attention to the representation study of images, and we used the similarity of feature level to filter unreliable samples and assigns pseudo labels to each reliable sample. A schematic of filtering poor features out of samples can be seen in Figure 4.  
We first calculated the average feature vectors of each class \(j\) in the labeled feature dataset \(Z_{L}^{t}\) at the \(t\)th iteration to generate \(K\) feature anchor points \(A^{t}=\{a_{j}^{t}\}_{j=1}^{K}\). To do this, we used the following equation:  
\[a_{j}^{t}=\frac{1}{\left|Z_{j,L}^{t}\right|}\sum_{\left(z_{i,j}^{t},a_{j}^{t} \right)\in Z_{j,L}^{t}}z_{i,j}^{t}, \tag{2}\]  
where \(Z_{j,L}^{t}\) represents a subset of feature samples in the feature vector set \(Z_{L}^{t}\), where the label \(y_{i,j}^{t}=j\) in the \(t\)th round of iteration. \(\left|Z_{j,L}^{t}\right|\) denotes the number of samples in the subset \(Z_{j,L}^{t}\). Next, we used cosine similarity to calculate the similarity between the extracted enhanced unlabeled samples' features and feature anchor points:  
\[ \begin{split} f_{SimFaa}^{t}&=s(z_{i,u}^{t},a_{j}^{ t})=\frac{z_{i,u}^{t}\cdot a_{j}^{t}}{|z_{i,u}^{t}|\cdot|a_{j}^{t}|}\\ &=\frac{\sum_{d=1}^{D}z_{i,u,d}^{t}a_{j,d}^{t}}{\sqrt{\sum_{d=1}^ {D}(z_{i,u,d}^{t})^{2}}\cdot\sqrt{\sum_{d=1}^{D}(a_{j,d}^{t})^{2}}},\end{split}  \tag{3}\]  
where \(z_{i,u}^{t}\) represents the feature vector of the unlabeled data, \(a_{j}^{t}\) represents the anchor point, \(\cdot\) represents the dot product of the vector, \(|\cdot|\) represents the norm of the vector, \(D\) is the dimension of the vector. A cosine similarity close to \(1\) indicates that the two vectors are very close in space, while a cosine similarity close to \(-1\) indicates that the two vectors are  
Figure 4: Schematic diagram of anchor generation and feature filtering. In the \(t\)th iteration, five labeled samples and five unlabeled samples are selected, which come from three categories, and the samples with the same color indicate that they belong to the same category. almost opposite in space. A cosine similarity close to 0 indicates that there is no obvious correlation between the two vectors in space. Next, the minimum similarity between labeled sample features and anchor points is used as the threshold for feature similarity, and a hyperparameter is used to dynamically adjust the threshold size of feature similarity:  
\[\tau^{t}_{Fea}=\alpha^{t}_{Fea}\min(s(z^{t}_{i,l},a^{t}_{j}))=\alpha^{t}_{Fea} \min(\frac{z^{t}_{i,l}\cdot a^{t}_{j}}{|z^{t}_{i,l}|\cdot|a^{t}_{j}|}), \tag{4}\]  
where \(\alpha^{t}_{Fea}\in[0,1]\) is a coefficient used to dynamically adjust the threshold of feature similarity, \(z^{t}_{i,l}\) represents the feature vector of the labeled sample, \(a^{t}_{j}\) represents the feature anchor point, \(\cdot\) denotes the dot product of vectors, and \(|\cdot|\) denotes the norm of vectors. The feature similarity threshold \(\tau^{t}_{Fea}\in[-1,1]\). If the similarity \(f^{t}_{SimFea}\) between the feature of an unlabeled sample and the feature anchor point is greater than the feature similarity threshold \(\tau^{t}_{Fea}\), that is, \(f^{t}_{SimFea}>\tau^{t}_{Fea}\), then the pseudo-label of the current sample \(x^{t}_{i,u}\) is considered to be the label \(j\) of the feature anchor point that is most similar to its feature vector. In the feature filtering module, the labeled dataset remains unchanged. In the t-th iteration, pseudo-labels of unlabeled samples can be obtained after feature filtering.