# LSTM DSS Automatism and Dataset Optimization for Diabetes Prediction+
## 3 Results
### Training and Testing Dataset  
The training and the testing dataset were randomly extracted from the whole dataset made by 768 records. This allows a decrease in the error calculation of the LSTM network by limiting data redundancy and consecutively data correlation and sensitivity. Table 2 illustrates a table extracted from output results indicating the diabetic outcome prediction, where the predicted OC is the output and the other listed variables are the input testing attributes. Figure 6: Long short-term memory (LSTM) calculation cell (symbol \(x\) represents the multiplication operator between inputs, and \(\int\) represents the application of a differentiable function). The best convergence was observed for the model accuracy of Figure 10, thus confirming that a good balancing between test and train model was achieved (case of testing dataset of 20%). Evident overfitting was observed in the model accuracy of Figure 9 related to 15% of testing dataset (no good balancing of parameters). From the ROC curves can be calculated the AUC values. Summarized in Table 3 are the results of the AUC, accuracy, and loss of the adopted models, where the green color indicates a better result. The red and the green colors refer to values above or below thresholds considered valid for LSTM outputs. Specifically, the following thresholds have been considered: 86% for AUC %, 75% for the accuracy, and 60% for loss. The thresholds could be integrated into an automatic procedure able to select the best model to apply. In Appendix A is listed the python script used for the testing. The LSTM approach has been improved by implementing a new approach to the training dataset construction based on artificial data creation (LSTM artificial records--AR--). In the case of 20% of the testing dataset characterized by the best compromise between accuracy and loss parameter has created a new training dataset following these criteria:  
* Choose the attributes characterized by a higher correlation if compared with other attributes (in the case of study are insulin correlated with glucose, and skin thickness correlated with BMI);
* Split the dataset for patients having diabetes or not (first partition);
* The first partition has been furthermore split by considering the age (second partition);
* The second partition is then split into a third one representing pregnant women (third partition);
* Change of the correlated attributes by a low quantity of the values couple glucose and insulin (by increasing insulin is decreased the glucose of the same entity in order to balance the parameter variation), and skin thickness and BMI of the same person belonging to the same partition. The goal of the proposed criteria is to generate artificial records improving the training dataset stability and test accuracy. The increase in artificial data is important for all cases where only few data of the training dataset are available, as for more practical cases. In the case of this study, a training dataset has been created of 10,000 records, where only 768 are real. The cross validation has been performed on MLP traditional methods, and on LSTM using artificial records--AR--(LSTM-AR-). In Table 4 a benchmarking performed by the comparison of the test set accuracy parameter is provided between traditional MLP [38], LSTM traditional algorithm, and the innovative LSTM-AR-approach. Observing the comparison, it is evident an efficiency increase of the LSTM-AR- of 9% if compared with the LSTM traditional approach, and of 6.5% if compared with the MLP method optimized for diabetes prediction model [38]. Figures 12-14 illustrate the accuracy, the loss, and the ROC curve of the LSTM-AR- outputs. \begin{table}
\begin{tabular}{c c} \hline \hline
**Method** & **Test Set Accuracy \%** \\ \hline MLP & 77.5 [38] \\ LSTM & 75 \\ LSTM-AR- & 84 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Cross validation of results. Figure 14: LSTM-AR- results (training dataset = 80%, testing dataset = 20%): ROC curve.