With the application of big data, artificial intelligence, and other related technologies in the field of education, using machine learning to carry out early warning for course learning has become an effective means to improve teaching quality. However, in the scene of early warning, the samples are significantly less than the ordinary samples, and the general clustering or classification methods are difficult to achieve good results. Therefore, this paper proposes an early warning for course learning method based on SMOTE and OCSVM. First, collect and preprocess students’ college entrance examination information and online course learning information data. Second, use SMOTE algorithm to expanding the samples. Then, the OCSVM model is designed, the Gaussian kernel function is used, and the Lagrange multiplier is used to solve the optimization problem for the optimization objective. The qualified student samples are selected for learning, and the classifier is trained, so as to classify the student data and realize the early warning of course learning. Select recall and F1_Score to evaluate the model, and comparative experiments are carried out. From the experiment, it is clear that in most cases, the method proposed in this paper is superior to the original sample and traditional methods in recall rate and F1_Score.