IntroductionHeatstroke is a serious clinical condition caused by exposure to high temperature and high humidity environment, which leads to a rapid increase of the core temperature of the body to more than 40°C, accompanied by skin burning, consciousness disorders and other organ system damage. This study aims to analyze the effect of meteorological factors on the incidence of heatstroke using machine learning, and to construct a heatstroke forecasting model to provide reference for heatstroke prevention.MethodsThe data of heatstroke incidence and meteorological factors in a city in South China from May to September 2014–2019 were analyzed in this study. The lagged effect of meteorological factors on heatstroke incidence was analyzed based on the distributed lag non-linear model, and the prediction model was constructed by using regression decision tree, random forest, gradient boosting trees, linear SVRs, LSTMs, and ARIMA algorithm.ResultsThe cumulative lagged effect found that heat index, dew-point temperature, daily maximum temperature and relative humidity had the greatest influence on heatstroke. When the heat index, dew-point temperature, and daily maximum temperature exceeded certain thresholds, the risk of heatstroke was significantly increased on the same day and within the following 5 days. The lagged effect of relative humidity on the occurrence of heatstroke was different with the change of relative humidity, and both excessively high and low environmental humidity levels exhibited a longer lagged effect on the occurrence of heatstroke. With regard to the prediction model, random forest model had the best performance of 5.28 on RMSE and dropped to 3.77 after being adjusted.DiscussionThe incidence of heatstroke in this city is significantly correlated with heat index, heatwave, dew-point temperature, air temperature and zhongfu, among which the heat index and dew-point temperature have a significant lagged effect on heatstroke incidence. Relevant departments need to closely monitor the data of the correlated factors, and adopt heat prevention measures before the temperature peaks, calling on citizens to reduce outdoor activities.