# LSTM DSS Automatism and Dataset Optimization for Diabetes Prediction+
## 2 Materials and Methods  
Based on several studies, we found that a commonly used dataset for health data mining was the Pima Indians Diabetes Dataset from the University of California, Irvine (UCI) Machine Learning Database [24; 25; 26; 27; 28; 29]. The datasets consist of several medical predictor (independent) variables and one target (dependent) variable, Outcome. Independent variables include the number of pregnancies the patient has had, their BMI, insulin level, age, and so on:  
* PregnanciesNumber (PN): Pregnant number;
* GlucosePlasma (GP): Glucose concentration (after 2 h of oral glucose tolerance test);
* BloodPressureDiastolic (BPD): Blood pressure (mm Hg);
* SkinThicknessTriceps (STT): Skin fold thickness (mm);
* Insulin2-Hour (I): Serum insulin (mu U/mL);
* BMIBody (BMI): Mass index (weight in kg/(height in m)\({}^{2}\));
* DiabetesPedigreeFunctionDiabetes (DPFD): Pedigree function;
* AgeAge (AA): Years old;
* OutcomeClass (OC): Binary variable (0 indicates the no-diabetes status of 268 samples, and 1 indicates the diabetes status of the remaining 500 cases of the training dataset). In Figure 2 is illustrated the statistic distribution of the above listed attributes plotted by RapidMiner tool. In general, before processing data by data mining algorithms, it is important to analyze the correlation between attributes in order to choose the less correlated variables: By processing strong correlated variables, which can be introduced into the system redundancies and calculus sensitivities, which can alter the results and increase the data process error or the prediction error. Figure 2: (a–i) Attribute dataset statistic distribution. These considerations are valid also for LSTM processing. A method to estimate the correlation between variables generating a weights vector based on these correlations is Pearson's correlation coefficient evaluation. The algorithm calculates this coefficient, which is the covariance of the two variables divided by the product of their standard deviations [35; 36]:  
\[\rho_{X,Y}=\frac{cov(X,Y)}{\sigma_{X}\sigma_{Y}} \tag{1}\]  
being _Cov (X,Y)_, the covariance of the variables \(X\) and \(Y\) (\(\sigma_{XY}\)), and \(\sigma_{X}\) and \(\sigma_{Y}\) the standard deviation of variable \(X\) and \(Y\), respectively. By observing the calculated correction matrix of Table 1 (data processing of the experimental dataset) it is clear that all the attributes are not strongly correlated. A first check of correlation can also be performed by directly observing the 2D plots between a couple of variables. By focusing the attention on the OutcomeClass variable indicating diabetic status, it was evident from Figures 3-5 that generally the classes 1 and 0 were not distinguished in the function of the other variables (data overlapping). This confirmed that the results found in the correlation matrix and provided information about samples dispersion. \begin{table}
\begin{tabular}{c c c c c c c c c} \hline \hline  & **PN** & **GP** & **BPD** & **STT** & **I** & **BMI** & **DFFD** & **AA** & **OC** \\ \hline PN & 1 & 0.13 & 0.14 & \(-\)0.08 & \(-\)0.07 & 0.02 & \(-\)0.03 & 0.54 & 0.22 \\ GP & 0.13 & 1 & 0.15 & 0.06 & 0.03 & 0.22 & 0.14 & 0.26 & 0.47 \\ BPD & 0.14 & 0.15 & 1 & 0.21 & 0.09 & 0.28 & 0.04 & 0.24 & 0.07 \\ STT & \(-\)0.08 & 0.06 & 0.21 & 1 & 0.04 & 0.39 & 0.18 & \(-\)0.11 & 0.07 \\ I & \(-\)0.07 & 0.33 & 0.09 & 0.44 & 1 & 0.2 & 0.19 & \(-\)0.04 & 0.13 \\ BMI & 0.02 & 0.22 & 0.28 & 0.39 & 0.02 & 1 & 0.14 & 0.04 & 0.29 \\ DPFD & \(-\)0.03 & 0.14 & 0.04 & 0.18 & 0.19 & 0.14 & 1 & 0.03 & 0.17 \\ AA & 0.54 & 0.26 & 0.24 & \(-\)0.11 & \(-\)0.04 & 0.04 & 0.03 & 1 & 0.24 \\ OC & 0.22 & 0.47 & 0.07 & 0.07 & 0.1 & 0.29 & 0.17 & 0.24 & 1 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Correlation matrix between experimental dataset attributes. Figure 3: Outcome versus DiabetesPedigree function. The prediction results about the outcome variable (labeled variable) were performed by the LSTM neural network.