# Squeezing Backbone Feature Distributions to the Max for Efficient Few-Shot Learning
## 3 Materials and Methods
### Boosted Min-Size Sinkhorn
It is initialized as follows:  
\[\mathbf{w}_{j}=\mathbf{W}[:,j]=\mathbf{c}_{j}/\|\mathbf{c}_{j}\|_{2}, \tag{6}\]  
where  
\[\mathbf{c}_{j}=\frac{1}{s}\sum_{\mathbf{x}\in\mathbf{S},\ell(\mathbf{x})=j}f_ {\varphi}(\mathbf{x}). \tag{7}\]  
We can see that \(\mathbf{W}\) contains the average of feature vectors in the support set for each class, followed by a L2-normalization on each column so that \(\|\mathbf{w}_{j}\|_{2}=1,\forall j\). Then, we iterate multiple steps that we describe thereafter. * Computing costs As previously stated, the proposed algorithm is an _EM_-like one that iteratively updates model parameters for optimal estimates. Therefore, this step, along with Min-size Sinkhorn presented in the next step, is considered as the \(E\)-step of our proposed method. The goal is to find membership probabilities for the input samples; namely, we compute \(\mathbf{P}\) that minimizes Equation (5). Here, we assume Gaussian distributions, and features in each class have the same variance and are independent from one another (covariance matrix \(\mathbf{\Sigma}=\mathbf{I}\sigma^{2}\)). We observe that, ignoring the marginal probability, Equation (4) can be boiled down to negative L2 distances between extracted samples \(f_{\varphi}(\mathbf{x}_{i}),\forall i\) and \(\mathbf{w}_{j},\forall j\), which is initialized in Equation (6) in our proposed method. Therefore, based on the fact that \(\mathbf{w}_{j}\) and \(f_{\varphi}(\mathbf{x}_{i})\) are both normalized to be unit length vectors (\(f_{\varphi}(\mathbf{x}_{i})\) being preprocessed using PEME introduced in the previous section), here we define the cost between sample \(i\) and class \(j\) to be the following equation:  
\[ \begin{split}\mathbf{C}[i,j]&\propto(f_{\varphi}( \mathbf{x}_{i})-\mathbf{w}_{j})^{2}\\ &=1-\mathbf{w}_{j}^{T}f_{\varphi}(\mathbf{x}_{i}),\end{split}  \tag{8}\]  
which corresponds to the cosine distance. * Min-size Sinkhorn In [1], we proposed a Wasserstein distance-based method in which the Sinkhorn algorithm is applied at each iteration so that the class prototypes are updated iteratively in order to find their best estimates. Although the method showed promising results, it is established on the condition that the distribution of the query set is known, e.g., a uniform distribution among classes on the query set. This is not ideal, given the fact that any priors about \(\mathbf{Q}\) should be supposedly kept unknown when applying a method. The methodology introduced in this paper can be seen as a generalization of that introduced in [1] that does not require priors about \(\mathbf{Q}\). In the classical settings, the Sinkhorn algorithm aims at finding the optimal matrix \(\mathbf{P}\), given the cost matrix \(\mathbf{C}\) and regulation parameter \(\lambda\) presented in Equation (4)). Typically, it initiates \(\mathbf{P}\) from a softmax operation over the rows in \(\mathbf{C}\), then it iterates between normalizingcolumns and rows of \(\mathbf{P}\), until the resulting matrix becomes close to doubly stochastic according to \(\mathbf{p}\) and \(\mathbf{q}\). However, in our case, we do not know the distribution of samples over classes. To address this, we firstly introduce the parameter \(k\), initialized so that \(k\gets s\), meant to track an estimate of the cardinal of the class containing the least number of samples in the considered task. Then, we propose the following modification to be applied to the matrix \(\mathbf{P}\) once initialized: we normalize each row as in the classical case but only normalize the columns of \(\mathbf{P}\) for which the sum is less than the previously computed min-size \(k\)[20]. This ensures at least \(k\) elements are allocated for each class, but not exactly \(k\) samples as in the balanced case. The principle of this modified Sinkhorn solution is presented in Algorithm 1.