# A Hybrid Intelligent Approach to Predict Discharge Diagnosis in Pediatric Surgical Patients
## 2 Materials and Methods
### Experimental Methodology
#### 2.2.1 Pre-Processing Data  
The preprocessing phase is designed to prepare the medical records to be suitable for the central processing of the proposed system by encoding data and completing missing information.  
Figure 2: Experimental methodology employed to evaluate machine learning algorithms for the proposed system.  
The data coding process consists of two steps: (1) reading the input attributes and categorizing their values; (2) creating a dictionary for each attribute by assigning nominal data to the incoming categorical data. The first step consists of receiving input data in text format from which the attribute values are extracted by eliminating repetitions. In the next step, the attribute values are converted to numerical data so that the classification algorithms can process them. For example, we have an input attribute called \"Provenance\" with values (Piura, Tumbes, Tumbes, Piura, Comas); the result of applying the first step of the encoding process is (Piura, Tumbes, Comas); finally, applying the second step of the encoding results (Piura = 1, Tumbes = 2, Comas = 3).  
Data Completion  
As a consequence of manual data retrieval, several records were found to be incomplete. Data from medical records present 8.6% of missing values among the eight numerical features and four categorical traits (see Table 2). In the pattern recognition literature, the incomplete data problem is commonly addressed by deleting incomplete cases, using models to estimate data distribution or classifier parameters, or evaluating missing data through imputation methods.  
In order to complete missing information from medical records, the following two methods were selected:  
1. The K-nearest neighbors imputer employs the \(K\)-nearest neighbor (KNN) classifier with Euclidean distance, as shown in Equation (1), to describe the similarity between the incomplete record (\(x_{i}\)) and other records nearby (\(x_{j}\)) [33; 34]: \[d_{i,j}=dist(x_{i},x_{j})=\sqrt{\sum_{k=1}^{n}(x_{i,k}-x_{j,k})^{2}},\] (1) where \(dist(x_{i},x_{j})\) is the Euclidean distance between the encoded medical records; and \(n\) symbolizes the number of features. The estimate of the missing value at record \(i\) compared to the record \(j\) is given by \[\hat{x}_{i,j}=\frac{\sum_{k=1}^{K}W_{k}X_{k}}{\sum_{k=1}^{K}W_{k}},\] (2) where \(k\) is the number of samples selected from features; \(X_{k}\) is the input matrix for the \(k^{th}\) record; and \(W_{k}\) is the \(k^{th}\) similarity weight defined by \[W_{k}=\frac{1}{d_{k}},\] (3) where \(d_{k}\in\{d_{1},d_{2},\ldots,d_{K}\}\) is the \(k^{th}\) rank distance of the neighbors.
2. The simple imputer method employed is based on mean, as described by [PERSON] and [PERSON] [35]. The simple imputer replaces the missing values with the mean value of the missing feature, considering all records in training data, according to: \[\hat{x}_{i}=\frac{1}{N}\sum_{l=1}^{N}x_{l},\] (4) where values in matrix \(X\) are the observations of each feature in the medical record; and \(N\) is the amount of records used for training.