# Effect of Probabilistic Similarity Measure on Metric-Based Few-Shot Classification
## 3 Probabilistic Similarity Measure  
In the probabilistic similarity measure [26; 27; 28; 29], the similarity is defined as the probability that two data \(\mathbf{x}\) and \(\mathbf{x}^{\prime}\) belong to the same class \(\epsilon_{k}\), which can be written as:  
\[S\big{(}\mathbf{x},\,\mathbf{x}^{\prime}\big{)}=prob\big{[}\mathbf{x}\in\mathbf{\epsilon}_{k},\,\mathbf{x}^{\prime}\in\epsilon_{k}\big{]}. \tag{1}\]  
An explicit function of the probability can be obtained by defining a generation model of data \(\mathbf{x}\) with two components [28]: class component \(\mathbf{c}\) and environmental component \(\mathbf{\varepsilon}\) such as:  
\[\mathbf{x}=\mathbf{c}+\mathbf{\varepsilon} \tag{2}\]  
The environmental components \(\mathbf{\varepsilon}\) originates from some environmental variations such as illuminations and is assumed to be independent of the class source. On the contrary, the class component \(\mathbf{\varepsilon}\) is originated from a class-specific source determined differently for each class. Additionally, Ref. [28] further assumes that the class-specific component \(\mathbf{\epsilon}_{k}\) for each class \(\mathbf{\epsilon}_{k}\) can be regarded as a unique prototype, and the intra-class variations are caused by the environmental component \(\mathbf{\varepsilon}\). The environmental component is also assumed to be independent of the class and be identical regardless of the class-label. Although these assumptions may be considered rather strict for application in real data, they are consistent with the assumption placed on the classifier of the prototypical network. More precisely, the simple classifier used in the prototypical network can be regarded as a particular case of the distance-based classifier using the probabilistic similarity used in [26; 27; 28; 29]. In order to obtain an explicit form of the probabilistic similarity, let us consider a difference vector between two samples \(\mathbf{x}\) and \(\mathbf{x}^{\prime}\) belonging to a single class \(\mathbf{\epsilon}_{k}\), which can be written as:  
\[\delta=\mathbf{x}-\mathbf{x}^{\prime}=\left(\mathbf{\epsilon}_{k}+\mathbf{\varepsilon}\right) -\left(\mathbf{\epsilon}_{k}+\mathbf{\varepsilon}^{\prime}\right)=\mathbf{\varepsilon}- \mathbf{\varepsilon}^{\prime}. \tag{3}\]  
By subtracting two vectors belonging to the same class, we can infer that the class-specific component disappears and only the environmental component \(\mathbf{\varepsilon}\) remains in the intra-class difference vector. Then, the probability that the two data belong to the same class can be obtained by estimating the probability density function \(p(\delta)\). According to the assumption in [28], all classes have the same environmental component \(\epsilon\). Therefore, all of the difference vectors will follow a single distribution regardless of class-labels. We can specify the distribution using this set of difference vectors and the characteristics of the environmental component \(\epsilon\). Noting that the environmental component \(\epsilon\) is caused by diverse sources, we can assume that \(\epsilon\) is subject to Gaussian distribution, and so does the difference vector \(\delta=\epsilon-\epsilon^{\prime}\).