## 3 The Proposed Method
### Virtual Sample Generation Method
#### 3.1.1 The Pre-Processing Method
\begin{split} NGA_{NH}&=\left[GA1_{N1}\ldots\ldots GAh_{N 1}\right],\;h=H\\ NGB_{NH}&=\left[GB1_{N1}\ldots\ldots GBh_{N1} \right],\;h=H\\ \end{split}  \tag{3}\]  
Finally, in Equation (4) combined vertically the NA\({}_{IH}\) with NGA\({}_{NH}\) matrices, and NB\({}_{IH}\) with NGB\({}_{NH}\) into a single matrices AA\({}_{(I+N)H}\) and BB\({}_{(I+N)H}\) respectively. These matrices (data) will be used as learning data for the classifier. \[ \begin{split} AA_{(I+N)H}&=\left[NA_{IH}\atop NGA_{ NH}\right]\\ BB_{(I+N)H}&=\left[NB_{IH}\atop NGB_{NH}\right] \\ \end{split}  \tag{4}\]  
```
0: Small number of samples as classes A and B. 0: Hundreds of thousands or millions of samples (N). 1: loop I = 1: number_of_features//number of columns in the matrix
2: [Find the Max, Min, and mean for each feature in classes A and B]
3: [Initialize MaxA = the maximum value in feature I in matrix A]
4: [Initialize MinA = the minimum value in feature I in matrix A]
5: [Initialize MeanA = the mean value for all values in feature I in matrix A]
6: [Initialize MaxB = the maximum value in feature I in matrix B]
7: [Initialize MinB = the minimum value in the feature I in matrix B]
8: [Initialize MeanB = the mean value for all values in feature I in matrix B]
9: [If (MinA >= MaxB) or (MinB >= MaxA) //Ideal cases: see Figure 2
10: [If (MaxA >= MaxB) // Expand the intervals before generating N virtual samples
11: MaxA = MaxA + MeanA
12: else
13: MaxB = MaxB + MeanB
14: if (MinA < MinB) // Expand the intervals
15: MinA = MinA - MeanA
16: else
17: MinB = MinB - MeanB] //Generate N virtual sample with a normal distribution as follows
18: VGA = MinA + (MaxA - MinA)*sum(rand(N, constant), 2)/constant;
19: VGB = MinB + (MaxB - MinB)*sum(rand(N, constant), 2)/constant;
20: else //Not ideal case: see Figure 3
21: call Algorithm 2 // The preprocessing
22: end loop
23: [New samples = small number of samples + N samples]
```  
**Algorithm 1** The algorithm for virtual sample generation. The pre-processing technique primarily grouped samples based on their spatial relationship. The pre-processing algorithm can be summarized as follows:  
Step 1: Find the maximum value, minimum value, and computed arithmetic mean for each feature for each class. Following this, check for any possible overlaps between the maximum values and minimum values for each feature in the first class with the corresponding feature in the second class. It is necessary to exclude possible overlaps (ideal cases, as can be noticed in Figure 2) before generating meaningful virtual samples. Step 2: After having verified the absence of overlaps, expand the sides using the mean for each feature and generating meaningful virtual samples based on a Gaussian distribution, as shown in Figure 4.  
Now, expand the intervals, both right and left sides, by Equations (5) and (6), respectively. \[EMAX(MA_{j},MB_{j})=\left\{ \begin{array}{ll}MA_{j}=MA_{j}+MeA_{j}&,\ MA_{j}>MB_{j}\\ MB_{j}=MB_{j}+MeB_{j}&,\ otherwise\end{array} \right. \tag{5}\]  
Figure 3: Overlapping cases between the feature and the same feature in the corresponding class. Figure 2: Ideal cases where there is no overlapping between the feature and the same feature in the corresponding class. \[EMIN(NA_{j},NB_{j})=\left\{ \begin{array}{ll}NA_{j}=NA_{j}-MeA_{j}&,NA_{j}<NB_{j} \\ NB_{j}=NB_{j}-MeB_{j}&,otherwise\end{array} \right. \tag{6}\]  
Step 3: In the case of overlaps, as in the case depicted in Figure 3 of the process, start removing overlaps by moving the points that are far from the mean. Step 4: Repeat Steps 1-3 until removing all overlaps based on \"Algorithm 2\". After this, the process generated virtual samples based on a Gaussian distribution, Equation (7). During this step, after the collections were formed using the pre-processing method for each discriminative feature, the mean and standard deviation for each group for all discriminative features were recalculated before moving to the next process.