Heart disease is a major threat to human health, with a variety of contributing factors, and is not easily cured. This paper will present a dataset from a cardiovascular study of residents of Framingham, Massachusetts. First, the validity of the three models, logistic regression, random forest, and decision tree, is estimated by comparing information such as accuracy, precision, recall, and F1 values. The optimal model, i.e., the logistic regression model, was selected by plotting ROC curves and using AUC as a reference criterion for assessing the predictive effectiveness of the models. Then the raw data and data were preprocessed, including dealing with missing values. Finally, a logistic regression model was developed to analyze the influencing factors of heart disease. The purpose of this study was to use the results of the logistic model to help doctors and patients in heart disease treatment. The results show that the model has a good predictive effect.