The consumer price index (CPI) is an important indicator to measuring inflation or deflation. Its changes are closely related to residents' lives, and also affect the direction of national macroeconomic policy formulation. In recent years, the combination of economics with mathematical models such as machine learning and macro-statistics has gradually become a hot topic. In this paper, the impact of different types of CPI on China's overall CPI was discussed. Machine learning prediction and correlation analysis of various types of influencing factors and CPI. The machine learning model of the regression decision tree process predicted CPI more accurately. Spearman correlation analysis showed that CPI was mainly positively related to goods and services, living, medical care, food, tobacco and alcohol, clothing and so on, while CPI was mainly negatively related to the transport and communication of residents.