The parameter configuration of quantum key distribution (QKD) has a great effect on the communication effect, and in the practical application of the QKD network in the future, it is necessary to quickly realize the parameter configuration optimization of the asymmetric channel measurement-device-independent QKD according to the communication state, so as to ensure the good communication effect of the mobile users, which is an inevitable requirement for real-time quantum communication. Aiming at the problem that the traditional QKD parameter optimization configuration scheme cannot guarantee real-time, in this paper we propose to apply the supervised machine learning algorithm to the QKD parameter optimization configuration, and predict the optimal parameters of TF-QKD and MDI-QKD under different conditions through the machine learning model. First, we delineate the range of system parameters and evenly spaced (linear or logarithmic) values through experimental experience, and then use the traditional local search algorithm (LSA) to obtain the optimal parameters and take them as the optimal parameters in this work. Finally, we train various machine learning models based on the above data and compare their performances. We compare the supervised regression learning models such as neural network, K-nearest neighbors, random forest, gradient tree boosting and classification and regression tree (CART), and the results show that the CART decision tree model has the best performance in the regression evaluation index, and the average value of the key rate (of the prediction parameters) and the optimal key rate ratio is about 0.995, which can meet the communication needs in the actual environment. At the same time, the CART decision tree model shows good environmental robustness in the residual analysis of asymmetric QKD protocol. In addition, compared with the traditional scheme, the new scheme based on CART decision tree greatly improves the real-time performance of computing, shortening the single prediction time of the optimal parameters of different environments to the microsecond level, which well meets the real-time communication needs of the communicator in the movable state. This work mainly focuses on the parameter optimization of discrete variable QKD (DV-QKD). In recent years, the continuous variable QKD (CV-QKD) has developed also rapidly. At the end of the paper, we briefly introduce academic attempts of applying machine learning to the parameter optimization of CV-QKD system, and discuss the applicability of the scheme in CV-QKD system.