# Improving Steerability Detection via an Aggregate Class Distribution Neural Network
## 2 Preliminaries
### AGGNN Model
The calculation process can be written as  
\[p_{unsteerable}=\frac{1}{n/2}\sum\limits_{i\in\{1,...,n/2\}}v^{ \prime}{}_{i}, \tag{15}\] \[p_{steerable}=\frac{1}{n/2}\sum\limits_{i\in\{(n/2)+1,...,n\}}v^{ \prime}{}_{i},\] \[ps=(p_{steerable}\cdot p_{unsteerable})/\|p_{steerable}\|\|p_{ unsteerable}\|,\]  
where \(ps\) is the cosine similarity between the prototypes. **Loss function. ** The loss function consists of three parts: the first part is the cross-entropy loss of the aggregate class distribution \(\bar{\textbf{P}}\), and the second part is the cross-entropy  
Figure 2: Illustration of weight adjustment. \(a_{ij}\) is the element of the \(i\)th row and \(j\)th column of the similarity matrix **A**, and \(b_{ij}\) is the element of the \(i\)th row and \(j\)th column of the positive and negative correlation similarity matrix **B**. By adjusting the similarity weights, the aggregate class distribution of samples can sufficiently combine the class distribution of samples with similar and dissimilar features. loss of \(\mathbf{P}\) obtained by the classification layer, and the third part is the cosine similarity between the prototypes _ps_. \[\text{Loss}=\lambda\cdot\frac{1}{n}\sum\limits_{i=1}^{n}D(y_{i},\bar{p}_{i})+ \mu\cdot\frac{1}{n}\sum\limits_{i=1}^{n}D(y_{i},p_{i})+\gamma\cdot ps, \tag{16}\]  
where \(\bar{p}_{i}\) and \(p_{i}\) are the aggregate and predicted class distribution of the \(i\)th sample, respectively, \(\lambda\), \(\mu\) and \(\gamma\) both are weight parameters, and \(D\) is the cross-entropy loss function. **Training and validation. ** In the training process, the data pass through the feature extraction layer, classification layer and aggregate class distribution layer to obtain the loss. In the verification process, the data pass through the feature extraction layer and classification layer to obtain the final prediction result. **Workflow of the AGGNN algorithm. ** In summary, we show the workflow of the AGGNN algorithm in Algorithm 1. For each batch of training examples, the AGGNN algorithm performs the following operations. First of all, the algorithm obtains the features and the class distribution of the batch examples. Then the network computes the feature similarity matrix and transforms the weights into a positive and negative correlation similarity matrix, obtaining the aggregation distribution for each sample. Finally, the model parameters are optimized by reducing the loss of the model. ```
0: batch \(B=\{(x_{i},y_{i})\}_{i=1}^{n}\)
```
0:\(y_{i\in\{1,\dots,n/2\}}=1\), \(y_{i\in\{(n/2)+1,\dots,n\}}=0\) for\(t\) in [1, num_epochs] do for each minibatch \(B\)do \(\mathbf{X}\leftarrow[x_{1},x_{2},\dots,x_{n}]^{\text{T}}\) \(\mathbf{V},\mathbf{P}\leftarrow p\mod_{\text{ }d}(\mathbf{X};\theta)\) \(\mu\leftarrow\frac{1}{n\times d_{c}}\sum\limits_{i=1}^{n}\frac{d_{c}}{\sqrt{d_{ c}}}\
u_{ij}\) \(\sigma\leftarrow\sqrt{\frac{1}{n\times d_{c}}\sum\limits_{i=1}^{n}\frac{d_{c}}{ \sqrt{d_{c}}}\left(v_{ij}-\mu\right)^{2}}\) \(v^{\prime}_{ij}\leftarrow\frac{v_{ij}-\mu}{\sqrt{\sigma^{2}+t}}*\delta+k\) \(\mathbf{A}\leftarrow\text{Softmax}\big{(}\mathbf{V}\mathbf{V}^{\text{T}}/\sqrt{d _{v}}\big{)}\) \(\mathbf{B}\leftarrow\mathbf{A}-\mathbf{I}/n\) \(\mathbf{P}\leftarrow\mathbf{B}\cdot\mathbf{P}\) \(\textit{Punstearable}\leftarrow\frac{1}{n/2}\sum\limits_{i\in\{1,\dots,n/2\}}v ^{\prime}_{i}\) \(\textit{Psterable}\leftarrow\frac{1}{n/2}\sum\limits_{i\in\{(n/2)+1,\dots,n\}}v ^{\prime}_{i}\) \(\textit{ps}\leftarrow(\textit{psterable}\cdot\textit{punstearable})/\|\textit{ psterable}\|\ \|\textit{punstearable}\|\) \(\text{Loss}\leftarrow\lambda\cdot\frac{1}{n}\sum\limits_{i=1}^{n}D(y_{i},\bar{p }_{i})+\mu\cdot\frac{1}{n}\sum\limits_{i=1}^{n}D(y_{i},p_{i})+\gamma\cdot ps\)  Update \(\theta\) with Adam to minimize Loss endfor endfor Return:\(\theta\) ```  
**Algorithm 1** The AGGNN algorithm.