# Artificial Intelligence Algorithms for Treatment of Diabetes
## 1 Introduction
Bias in data results from patient records in EHR not reflecting the population and causes models and relations that disproportionally concentrate on the characteristics of the dominant groups in EHR data. Even if EHR has good representation of African Americans and Latino/Hispanics, bias can still creep in unless this data is used with care. The data size provides a different challenge. For example, the accuracy of deep learning with long-short-term memory neural networks improves with large sets of data, but other techniques such as support vector machines, k-nearest neighbors, decision trees, linear discrimination, and ensemble learning provide good results with smaller data sets. The outcome of the AI techniques for classification and suggestion of the most effective treatments must be trustworthy. Since EHR data may be fragile, clinicians would like clarity on the reasons for the selection of a treatment [33; 34]. Explainable AI methods [35; 36; 37] provide insight into the selection of interventions in terms that are familiar to care providers. We will focus on explainable AI techniques based on feature attribution methods that assign weights to features used to predict the best treatment [38; 39; 40]. The goal is to assign a score to quantify the importance of features that are more useful for the prediction results using attention mechanisms [30]. Another type of explainable ML models aims to derive explanations after the model is trained, or post-hoc explanations [39]. In contrast to the infrequent decision-making in T2D, AI algorithms for T1D must process both historical records and real-time streaming data to make numerous recurrent decisions. People with T1D must make over a hundred decisions every day to regulate their BGC based on complicated calculations on their insulin dose requirements throughout daily life. This complex decision-making must consider numerous factors such as meal carbohydrate amounts and times, past insulin infusions, and planned exercise and future schedules. Assimilating diverse sources of information and making the insulin dosing decisions, and decisions on food types and amount to consume throughout the day, in order to maintain tight glycemic control is a challenging task. Automated insulin delivery (AID) is an advanced treatment approach for keeping BGC in range despite major disturbances to glycemic dynamics such as food consumption and physical activities (PA) [41; 42; 43; 44; 45; 46; 47; 48; 49; 50; 51]. Commercially available AID systems use BGC reported every 5 min (based on subcutaneous glucose concentrations measured by continuous glucose measurement [CGM] systems), a control algorithm that computes the optimal insulin dose to be infused, and an insulin pump that infuses the computed insulin dose to subcutaneous tissue [52; 53]. These AID systems are called hybrid closed-loop systems because the user manually provides information about the food consumed and then makes adjustments to the target BGC values or insulin dosing to mitigate the effects of routine, scheduled PA. They have achieved 65-75 percent time in range for BGC in clinical trials reported to regulatory agencies [54; 55; 56; 57; 58; 59]. However,some people prefer fully-automated AID systems or would like to be notified when they have not communicated a disturbance to their AID. This missing information may be due to the inability of a young child or a geriatric person with T1D to enter such information, forgetting to enter the information (such as a meal consumed) or an unplanned/unexpected PA (such as running to catch a bus). Fully-automated AID systems (Figure 1) necessitate the detection of food consumption and estimation of the carbohydrate content of the meal and the detection of PA, classification of its type (such as aerobic, resistance, or interval training), and estimating its intensity and duration [60; 61; 62; 63; 64].