# Transfer Incremental Learning Using Data Augmentation
## 3 Proposed Method
### Details of the Proposed Method
#### 3.2.2 Projection to Low Dimensional Subspaces  
Feature extraction allows us to consider the feature vector \(\mathbf{x}^{m}\) instead of the input signal \(\mathbf{s}^{m}\). Formally, let us denote \(\mathbf{x}_{c}^{m}\) the fact that feature vector \(\mathbf{x}^{m}\) belongs to class \(c\). We split each \(\mathbf{x}_{c}^{m}\) into \(P\) parts, denoted \(\left(\mathbf{x}_{c,p}^{m}\right)_{1\leq p\leq P}\). For each class and each subspace, we create \(k\) anchor vectors initialised with \(0\), each of them associated with a counter, also initialised by \(0\). Considering the \(p\)-th subspace and the \(c\)-th class, we denote by \(Y_{c,p}=[\mathbf{y}_{c,p,1},...,\mathbf{y}_{c,p,k}]\) the corresponding anchor vectors and \(N_{c,p}=[n_{c,p,1},\ldots,n_{c,p,k}]\) their associated counters.  
For each \(c\) and \(p\), we aim at using the corresponding anchor vectors as centroids of a clustering of \(\{\mathbf{x}_{c,p}^{m}\}\). To this end, at each step of the training process, we ensure that each anchor vector is a centroid of a clustering of already processed input subvectors, and the associated counter accounts for the cardinality of the corresponding cluster.  
Then, each time an input training vector is processed, we identify an anchor vector to be updated. The update simply consists of computing a new anchor vector obtained as a barycenter of the old one with weight given by its counter and the input subvector with weight \(1\), then incrementing the counter. This procedure is detailed in Algorithm 1. Namely, rather than simply associating the new subvector with the closest anchor vector, which would inevitably lead to unbalanced counters and thus poor performance in prediction, we prefer to take into account counters while performing this association. More precisely, we linearly penalize anchor vectors that are already made of the combination of many subvectors. Note that when two or more anchor vectors gives the same results (distances multiplied by counters), we choose uniformly, at random, one of these anchor vectors.  
Figure 1: Overview of the proposed method. Given an input signal \(\mathbf{s}\), we first use data augmentation to generate a multiple version of the input signal \(\left(\mathbf{s}_{r}\right)_{1\leq r\leq R}\). Then we use a pre-trained DNN for feature extraction and obtain the corresponding feature vectors \(\left(\mathbf{x}_{r}\right)_{1\leq r\leq R}\). Subsequently, we split each feature vector \(\mathbf{x}_{r}\) into \(P\) equal parts \(\left(\mathbf{x}_{r,p}\right)_{1\leq p\leq P}\), and classify each part \(\mathbf{x}_{r,p}\) using a NCM-inspired classifiers (NCMC) containing anchor vectors \(\left(\mathbf{Y}_{c,p}\right)_{1\leq c\leq C}\). We obtain a class for each part \(c_{r,p}\) and do a majority vote to get the class of \(\mathbf{x}_{r}\). Finally, a second majority vote is done thanks to the obtained classes \(\left(c_{r}\right)_{1\leq r\leq R}\) of all generated signals to get assigned class \(\tilde{C}\) to the original input signal \(s\).  
Note that the learning process is independent on the order of streaming data, and is performed one example at a time, thus enforcing criterion 1 of incremental learning methods described in the introduction.  
```
0: streaming feature vector \(\mathbf{x}_{c}^{m}\) for\(p:=1\) to \(P\)do for\(i:=1\) to \(k\)do \(d_{i}=\|\mathbf{x}_{p}-\mathbf{y}_{c,p,i}\|_{2}\) \(R_{i}=d_{i}n_{c,p,i}\) endfor \(\tilde{k}=\underset{i}{\text{arg min }}R_{i}\) \(\mathbf{y}_{c,p,\tilde{k}}\leftarrow\mathbf{y}_{c,p,\tilde{k}}n_{c,p,\tilde{k }}+\mathbf{x}_{c,p}^{m}\) \(n_{c,p,\tilde{k}}\gets n_{c,p,\tilde{k}}+1\) \(\mathbf{y}_{c,p,\tilde{k}}\leftarrow\mathbf{y}_{c,p,\tilde{k}}/n_{c,p,\tilde{ k}}\) endfor
```  
**Algorithm 1** Incremental Learning of Anchor Subvectors