Background: Diabetes is common and an economic burden in the United States. In this study, a machine learning predictive model was developed to predict unplanned medical visits among patients with diabetes. Methods: Data were drawn from electronic medical records (EMRs) from a large healthcare organization in the Northern Plans region of the US, from adult (≥18 years old) patients with type 1 or type 2 diabetes who received care at least once during the 3 year period. A variety of machine-learning classification models were run using standard EMR variables as predictors (age, body mass index (BMI), Systolic blood pressure (BP), Diastolic BP, low-density lipoprotein (LDL), high-density lipoprotein (HDL), glycohemoglobin (A1C), smoking status, number of diagnoses and number of prescriptions). The best-performing model after cross-validation testing was analyzed to identify strongest predictors.Results: The best-performing model was a radial-basis support vector machine, which achieved a prediction accuracy (average of sensitivity and specificity) of 66.2%. This outperformed a conventional logistic regression by 1.5 percentage points. High BP and low HDL were identified as the strongest predictors, such that eliminating these from the model decreased its overall prediction accuracy by 1.9 and 1.8 percentage points, respectively.Conclusion: Our machine-learning predictive model more accurately predicted unplanned medical visits among patients with diabetes, relative to conventional models. Post-hoc analysis of the model was used for hypothesis generation, namely that HDL and BP are the strongest contributors to unplanned medical visits among patients with diabetes. In this way, this predictive model can be used in moving from prediction to implementation and improved diabetes care management in clinical settings.