# A Classification Method for Incomplete Mixed Data Using Imputation and Feature Selection
## 2 Method
### Procedure of PSOFI  
The pseudo-code of the proposed PSOFI is shown in Algorithm 3. ```
0: population size \(N\), max iterations \(T\), parameters \(\alpha\) and \(\beta\), training dataset and testing dataset;
0: global optimal particle \(g^{*}\) and its fitness value \(F_{g^{*}}\);
1: classify the types of all features, initialize population based on the encoding pattern;
2: evaluate the fitness values of all particles by Algorithm 1 and update their individual best position;
3: update \(g^{*}\) and \(F_{g^{*}}\);
4: store all particles in legacy archive \(LA\);
5:while current iteration \(t<T\)do
6:if\(g^{*}\) is not changed at last iteration then
7: merge \(LA\) into population;
8:endif
9:for each particle \(i\) in population do
10: update its speed: \(v_{i}^{t}\gets v_{i}^{t-1}\), update its position: \(x_{i}^{t}\gets x_{i}^{t-1}\);
11: obtain its fitness \(F_{i}\) by Algorithm 1;
12: update its best position \(x_{i}^{*}\) and time weight;
13: carry out \(LA\) update procedure by Algorithm 2;
14:endfor
15: update \(g^{*}\) and \(F_{g^{*}}\);
16:if the population size exceeds \(N\)then
17: arrange the particles in descending order according to the fitness values, and take the first \(N\) particles to construct new population;
18:endif
19:endwhile
```  
**Algorithm 3** Pseudo-code of PSOFI. The initialization process in Line 1 comprises the subsequent steps: first, to classify the feature types in the dataset, we manually categorize them as quantitative or categorical features based on the distribution of existing data from the data source. If the data are non-repetitive and can be fitted using a curve, then the feature can be identified as quantitative. If the data are only repeated several times among a few values, then the feature can be identified as categorical. Thereafter, the maximum and minimum values of the quantitative features are extracted, while only distinct values of the categorical features are considered. Finally, particles are initialized to construct the particle population based on the earlier information. The length of each particle is determined by the following formula: \(2\times l+\sum_{k=1}^{u}h_{k}+d\), where \(l\) and \(u\) denote the number of quantitative features and categorical features that contain missing values, respectively; \(d\) corresponds to the dataset's dimension; \(h_{k}\) represents the number of distinct values that the categorical feature \(k\) comprises. Furthermore, we limit the mean and standard deviation values to between maximum and minimum values of corresponding quantitative features to achieve reasonable outcomes. Line 2 calculates the particle's fitness value through Algorithm 1. Line 3 involves copying all particles to the legacy archive, thus initializing it. The main body of PSOFI encompasses Lines 4 to 18. If the global optimal solution remains unchanged in the last iteration, Lines 5 to 7 ensure that PSOFI merges legacy archives into population to invoke legacy learning mechanisms to add more search agents to this iteration. In Line 9, the speed of the current particle \(i\) is updated as in (2). \[v_{i}^{t}=wv_{i}^{t-1}+\alpha r_{1}(g^{*}-x_{i}^{t-1})+\beta r_{2}(x_{i}^{*}- x_{i}^{t-1}) \tag{2}\]where \(v_{i}^{t-1}\) represents the speed of particle \(i\) in the previous iteration. \(w\) is inertia weight, which controls the search range of particles in space. \(\alpha\) and \(\beta\) are acceleration constants, which manage the influence of group and particle information on the current particle. \(g^{*}\) stands for the global optimal solution, \(x_{i}^{*}\) is the best solution of particle \(i\) in history, and \(x_{i-1}^{t-1}\) indicates its present position. \(r_{1}\) and \(r_{2}\) are two random vectors, and each entry takes values between 0 and 1. Then, current particle \(i\) moves to its new position through (3). \[x_{i}^{t}=x_{i}^{t-1}+v_{i}^{t} \tag{3}\]  
Line 10 assesses its fitness value utilizing Algorithm 1. Line 11 updates the current particle's optimal position and its associated time weight.