Aiming at the power grid company charging risk, a risk analysis and early warning based on optimized random forest algorithm is proposed. Firstly, the SMOTE algorithm is used to optimize the user sample set distribution to solve the inhomogeneous distribution of the arrearage users and normal users. Secondly, selecte the Information Value to calculate the correlation between attribute features and target category, and then the random selection of node attributes is optimized. Thirdly, for the main parameters that affect the accuracy and performance of the random forest algorithm: tree size nTree, minimum sample leaf nodes minLeaf and attribute subset size K, it use the simulated annealing algorithm to obtain the best combination. Then, the optimized random forest algorithm is used to predict the future arrears of users, and obtains the potential high risk users. The method is compared with other classification algorithms such as logistic regression and decision tree, and the experimental results show that the method is effective.#$NLKeywords: electricity customers; arrears risk forecast ; random forest; SMOTE; Inofrmation Value; parameter combination; heating simulated annealing