To develop predictive models of final corrected distance visual acuity (CDVA) following cataract surgery using machine learning algorithms and electronic health record data. In this predictive modeling study we used decision tree, random forest, and gradient boosting. We included the first surgical eye of 64,768 members of Kaiser Permanente Northern California who underwent cataract surgery from June 1, 2010 through May 31, 2015. We measured discrimination and calibration of machine learning models for predicting postoperative CDVA 20/50 or worse vs 20/40 or better. The training set included 51,712 patients, and the validation set included 13,056 patients. We compared 3 machine learning models and found that the gradient boosting model provided the best discrimination ability for CDVA. The most important variables for predicting final CDVA 20/50 or worse were preoperative CDVA, age, and age-related macular degeneration, which together accounted for 41% of the gain in optimization of the gradient boosting model. Other important variables in the model included dispensed glaucoma medication, epiretinal membrane, cornea disorder, cataract surgery operating time, surgeon experience, and census block neighborhood characteristics (household income, family income, family poverty, college education, and home residence by owner). For predicting CDVA after cataract surgery, gradient boosting had the best ability to discriminate patients with postoperative CDVA 20/50 or worse from patients with postoperative CDVA 20/40 or better. Machine learning has the potential to improve prognosis and can improve patient information when making decisions to undergo cataract surgery.