## 3 The Closest Resemblance Algorithm
### Phase 2: Classification Phase  
The classification phase of the \(CR\) classifier is outlined in Algorithm 2. ```
1:Input: Test set \(S=\{s_{1},s_{2},\ldots,s_{n}\}\): where each data point \(s_{i}\) is presented by the profile \(f(s_{i})=\{f_{1}(s_{i}),f_{2}(s_{i}),\ldots,f_{i}(s_{i})\}\) where \(f_{i}(s_{i})\) is the value of the feature \(f_{j}\) for the sample \(s_{i};w_{j}:j=1,\ldots,n\) a list of features' weights; A set of prototype: \(P=\{P(\text{C}^{1}),P(\text{C}^{2}),\ldots,P(\text{C}^{1}),\ldots,P(\text{C}^{ K})\}\) obtained from Algorithm 1
2:Output: Predicted class label for each test data point \(s_{i}\in S\)
3:for each sample \(s_{i}\)do
4:for each class C\({}^{\text{h}}\)do
5:for each feature \(f_{j}\)do
6: Calculate the partial distance: Equation (4)
7:endfor
8:endfor
9:for each feature \(f_{j}\)do
10:for each class C\({}^{\text{h}}\)do
11:for all Classes C\({}^{\text{t}}\), \(t\
eq h\)do
12: Calculate partial resemblance: \(R_{j}^{s_{i}}(p(\text{C}^{\text{h}}),p(\text{C}^{\text{t}}))\): Equation (5)
13:endfor
14:endfor
15:endfor
16:for Each class C\({}^{\text{h}}\)do
17:for all Classes C\({}^{\text{t}}\), \(t\
eq h\)do
18: Calculate weighted resemblance matrix \(R^{s_{i}}(p(\text{C}^{\text{h}}),p(\text{C}^{\text{t}}))\): Equation (6)
19:endfor
20:endfor
21:for Each class C\({}^{\text{h}}\)do
22: Calculate global score: Equation (9)
23:endfor
24: Predict class label for the sample \(s_{i}\): Equation (10)
25:endfor
26:return Class labels for \(s_{i},i=\{1,2,\ldots\}\)
```  
**Algorithm 2** Prototype-based classification with reference intervals: Classification phase First, for each testing data point \(s\), \(CR\) determines a performance matrix of prototypes, as presented in Table 1, where each component of the matrix corresponds to the absolute distance between the data point \(s\) to be classified and the prototype of the class according to the feature \(f_{j}\). Each class \(C^{h},h=1,\ldots,k\) is represented by one prototype \(p(C^{h})\). The absolute distance between the prototype \(p(C^{h})\) of the class \(C^{h}\) and the data point \(s\) according to the feature \(f_{j}\) is calculated by Equation (4). This function essentially measures the maximum deviation of the data point from the interval bounds. A value of 0 indicates perfect alignment, while higher values indicate greater deviation. \[d_{j}^{h}(s,p(C^{h}))=max\Big{\{}0,I_{j,h}^{1}-f_{j}(s)),f_{j}(s)-I_{j,h}^{2} \Big{\}} \tag{4}\]  
where \(f_{j}(s)\) is the feature \(f_{j}\) value of the testing data point \(s\). \(p(C^{h})\) is the prototype of the class \(C^{h}\). The interval \(\Big{[}I^{1}(f_{j},C^{h}),I^{2}j(f_{j},C^{h})\Big{]}\) presents the score of the prototype \(p(C^{h})\) according to feature \(f_{j^{\prime}}\) as presented in the learning phase in Section 3.1  
Based on this performance matrix, the prototype nearest to the sample \(s\) is selected by calculating the weighted average mean of the partial preference relationship between the sample \(s\) and the prototype of different classes [26]. The preference relation between the different prototypes, also called the outranking relation, can be defined as follows. **Definition 1**. : _The prototype \(p(C^{h})\) outranks the prototype \(p(C^{h})\) \"\(p(C^{h})R^{s}p(C^{l})\)\" if and only if the resemblance between the sample \(s\) and the prototype \(p(C^{h})\) is stronger than the resemblance between \(s\) and the prototype \(p(C^{l})\) on the whole set of features._  
The outranking relation is based on the introduction of the partial outranking indices \(R^{s}_{j}\)[10; 16]. Each index indicates whether the following statement is true or false: \"The resemblance between the data point \(s\) and a given prototype is at least as strong as the resemblance between data point \(s\) and the another prototype according to feature \(f_{j}\)\". The \(R^{s}_{j}\) outranking index according to feature \(f_{j}\) is given by Equation (5).