Due to the fragility of sensor nodes, namely: vulnerability to damage, calibration, unstable communication links, limited carrying energy, and being vulnerable to environmental influences, sensor nodes in wireless sensor networks are prone to fault. In this paper, we mainly focus on noise fault, short-term fault, and fixed fault caused by low battery and calibration. In recent years, a large number of machine learning-based algorithms have been proposed for the anomaly detection of wireless sensor networks. In this paper, we compare and analyze the performance of Support Vector Machine (SVM), Naive Bayes, and Gradient Lifting Decision Tree (GBDT) in identifying and classifying fault. We introduce a comparative study of the above methods on experimental data sets. Experiments show that GBDT algorithm obtains a better fault detection rate.