Increased utilization of electronic medical records (EMR) is naturally generating enriched databases with sufficient people and observations to create localized risk models. Instead of building new "generalizable" risk models, we developed locally-fitted EMR-based prediction risk model using machine learning techniques for cardiovascular disease among patients with Type 2 Diabetes Mellitus (T2DM). Methods: We conducted a retrospective observational cohort study within Ochsner Health System (Louisiana's largest integrated delivery health system, n=6,245, 2013-2017). The patients were required to have two outpatient diagnoses of T2DM recorded in separate months or a diagnosis recorded during an inpatient encounter. The baseline clinical data were limited to 180 days before the index T2DM diagnosis. Cardiovascular outcomes were coronary heart disease (CHD), heart failure, and stroke. We used machine learning method to select predictor variables from demographic characteristics, clinical variables, medical histories, biomarkers, and medication utilizations into Cox proportional hazards models for each outcome. Model discrimination was used to compare the new equations to three types of risk equations: the Risk Equations for Complications Of type 2 Diabetes (RECODe), American College of Cardiology/American Heart Association atherosclerotic cardiovascular disease (AS-CVD), and QRISK-3. Results: Among factors identified as statistically significant in the Ochsner (n=11), RECODe (n=14) and QRISK3 (n=21), only age is common to all three risk equations. The Ochsner risk equations had high internal discrimination (C-statistics 0.8495, 0.8583, 0.8317, for CHD, heart failure, and stroke, respectively). The Ochsner equations had better discrimination than RECODe (C-statistics 0.4589, 0.5249, and 0.5021, for CHD, congestive heart failure, and stroke, respectively), AS-CVD (Cstatistics 0.5378 for CHD), and the QRISK-3 (C-statistics 0.7187 for CHD). Conclusions: Health system tailored risk equation improved risk stratification of CHD, heart failure, and stroke for patients with T2DM. Application of machine-learning method further simplified locally-fit models, that have implications for burden of data collection in clinical practice.