# ReliaMatch: Semi-Supervised Classification with Reliable Match
## 3 Method
### Dynamic Allocation Pseudo Lables  
In the pseudo-labeling strategy, threshold selection is an important issue. Traditional semi-supervised classification methods usually use a fixed threshold to predict the class of unlabeled samples and assign pseudo-labels to high-confidence samples above this threshold for training. However, this method may not adapt well to changes in the data distribution, and may either filter out useful samples excessively or add unreliable pseudo-labels, leading to classification errors due to samples of different classification difficulties. To address these issues, the pseudo-label filtering module in ReliaMatch adopts a global dynamic threshold to filter reliable samples. Specifically, in each iteration, the module sets the confidence threshold for predicting probability based on the average confidence of unlabeled samples for the entire dataset. If the average confidence of unlabeled samples is high, it indicates that the algorithm has good classification performance for unlabeled samples, and the threshold can be increased. If the change in labels between two iterations is significant, it indicates that the algorithm has not yet converged and the threshold should be appropriately lowered to ensure the accuracy of the model. For each unlabeled sample \(x^{t}_{i,u1}\), its predicted probabilities \(P(x^{t}_{i,u1})=\{p^{t}_{i,u1,j}\}_{j=1}^{K}\) can be converted into a hard label by creating a vector of length \(K\), denoted as \(O^{it}=\{o^{t}_{i,j}\}_{j=1}^{K}\), as follows:  
\[o^{t}_{i,j}= \begin{cases}1,&\text{if }j=\arg\max(p^{t}_{i,u1,j})\\ 0,&\text{otherwise},\end{cases}  \tag{5}\]  
where \(o^{t}_{i,j}\) indicates the label assigned to sample \(x^{t}_{i,u1}\) for the \(j\)th class. Specifically, the class with the highest predicted probability is assigned a label of 1 and the others are assigned a label of 0. Next, the average confidence score \(p^{t}_{u}\) can be obtained by computing the average of the maximum predicted probability values for all unlabeled samples, i.e.,  
\[p^{t}_{u}=\frac{1}{|X^{t}_{i11}|}\sum_{x_{i,u1}\in X^{t}_{i11}}\max(P(x^{t}_{i,u1})), \tag{6}\]where \(X_{U1}\) denotes the unlabeled dataset after feature filtering, and \(P(x_{i,u1}^{t})\) represents the predicted probabilities of sample \(x_{i,u1}\) in the \(t\)thtraining round. ReliaMatch uses the value of \(p_{u}^{t}\) as the confidence level of unlabeled data to adjust the credibility threshold of pseudo labels to ensure the quality of pseudo labels. Therefore, the global dynamic threshold \(\tau_{Pre}^{t}\) in round \(t\) can be represented as:  
\[\tau_{Pre}^{t}=\left\{ \begin{array}{l}\max\left(\frac{1}{1+\epsilon^{-}\tau_ {u}^{t}},\tau_{Pre}^{0}\right),t=1\\ \max\left(\frac{1}{1+\epsilon^{-}\tau_{u}^{t}},\frac{p_{u}^{t}\cdot\left|y_{u 1}^{t}-y_{u1}^{t-1}\right|}{\left\|p_{u}^{t}\left(x_{u1}^{t}\right)-p_{u}^{t-1 }\left(x_{u1}^{t-1}\right)\right\|_{F}+\epsilon}\right)\end{array} \right.,t>1, \tag{7}\]  
where \(\tau_{Pre}^{0}\) is the initial threshold. \(\epsilon\) is a very small constant to avoid division by zero. \(||\cdot||F\) denotes matrix norm, and \(p_{u}^{t}\) represents the average confidence level in round \(t\). \(\left|\left|y_{i,u1}^{t}-y_{i,u1}^{t-1}\right|\right|_{F}\) represents the size of the difference between the pseudo labels of the unlabeled sample \(i\) in round \(t\) and those in round \(t-1\). \(\left|\left|p_{u}^{t}(x_{i,u1}^{t})-p_{u}^{t-1}(x_{i,u1}^{t-1})\right|\right|_{F}\) represents the difference between the confidence level \(p_{u}^{t}\) of the unlabeled sample \(i\) in round \(t\) and that in round \(t-1\). To select the most reliable pseudo labels, ReliaMatch further filters the unlabeled data in \(X_{U1}^{t}\).