# Improving Steerability Detection via an Aggregate Class Distribution Neural Network
## 2 Preliminaries
### AGGNN Model
After normalizing the features extracted from the feature extraction layer, we calculate the similarity measure function of the features of the same batch of data to obtain a similarity matrix. Then we normalize the similarity matrix by the Softmax function. The calculation process is as follows  
\[\textbf{A}=\text{Softmax}\Big{(}\textbf{V}^{\prime}\textbf{V}^{\prime\text{T} }/\sqrt{d_{v}}\ \Big{)}, \tag{11}\]  
where \(\textbf{A}\in\mathbb{R}^{n\times n}\) is the feature similarity matrix of the samples, and the superscript T denotes transpose of matrices. A class distribution independently predicted from an individual sample often contains ambiguous values and often generates erroneous labels. To remedy this, the AggMatch algorithm [49] uses the aggregate class distribution of a sample to refine the ambiguous or noisy class distributions utilizing the relationship between other confidence-aware samples. Specifically, a class distribution \(p_{b}\) for \(v_{b}\) is aggregated by \(p_{l}\) of other samples \(v_{l}\) from the set of \(B\), by considering the similarity between them as  
\[\bar{p}_{b}=\sum_{l}\left(\frac{\exp(S(v^{\prime}{}_{b},v^{\prime}{}_{l})/ \tau_{sim})}{\sum\limits_{j}\exp\big{(}S(v^{\prime}{}_{b},v^{\prime}{}_{j})/ \tau_{sim}\big{)}}\right)p_{l}, \tag{12}\]  
where \(l\) and \(j\) are indexes for all samples in the set of \(B\), and \(\tau_{sim}\) is a temperature. In particular, the similarity function \(S\) measures the similarity weights between the samples. The performance of the aggregate class distribution of the samples is highly dependent on the class distribution of the batch data; therefore, we set the class distribution of our batch data as a uniform distribution. This raises another problem, for the aggregate class distribution of a sample, the similarity weights of samples of different classes from the sample in a batch is close to zero, which is not significant in calculating the gradient in the training process. **Weight adjustment. ** In order to solve the above problems, we adjusted the similarity weights to better adapt to the training process. We subtract \(\textbf{I}/n\) (the average weight of the same batch of data) from the similarity matrix so that the similarity weights of the features similar to the samples in the same batch are positively correlated, and the similarity weights of the features dissimilar to the samples are negatively correlated. As shown in Figure 2, by adjusting the similarity weights, training the aggregate class distribution of a sample can strengthen both the features of samples similar to the sample and those dissimilar to the sample simultaneously and enlarge the difference between different class sample features extracted by the model to improve the model's robustness and prediction ability. The calculation process can be written as  
\[\textbf{B}=\textbf{A}-\textbf{I}/n, \tag{13}\]  
where \(\textbf{B}\in\mathbb{R}^{n\times n}\) is a positive and negative correlation similarity matrix, and \(\textbf{I}\in\mathbb{R}^{n\times n}\) is the identity matrix. Then we obtain the aggregation distribution by multiplying the similarity matrix and the predicted class distribution,  
\[\bar{\textbf{P}}=\textbf{B}\cdot\textbf{P}, \tag{14}\]  
where \(\textbf{P}\in\mathbb{R}^{n\times 2}\) is the aggregate class distribution. In order to further improve the performance of the aggregate class distribution, we calculate the \(d_{v}\)-dimensional representation \(p_{steerable}\in\mathbb{R}^{d_{v}},p_{unsteerable}\in\mathbb{R}^{d_{v}}\), or prototype, of each class and cosine similarity between the prototypes. We then add the coefficient of similarity between prototypes into the loss function to increase the feature difference between different classes.