Talent is the first resource, the development of the enterprise to retain key talent is essential, the main research is based on machine learning and ontological reasoning, human resources analysis and management risk prediction and early warning methods, first of all, according to the specific situation and the target case, through the calculation of the similarity of the concept name and attribute of the similarity assessment of the source case in the case library, the matching of knowledge-based employees of the company's case for the similarity prediction and human resources management risk prediction research. Then, according to the evaluation results, we can find out the most suitable job matches in specific risk problems and situations. This is a solution to the target cases and criteria for companies to evaluate candidates. Second, we have successfully developed and implemented a prediction model that applies machine learning to the early warning study of risk prediction for HR management. The model is optimized with a cross-validation function, and the convergence of the model training is accelerated by the regularization of Newton's iterative method. Finally, our prediction model achieved 82% yield. Ontological reasoning and machine learning are promising in human resource management risk prediction and warning, which is proved by the high accuracy rate verified by examples. Finally, we analyze the proposed results of HRM risk prediction and early warning to contribute to the improvement of risk control and suggest measures for possible risks.