In order to improve the energy consumption balance between wireless sensor nodes and reduce the energy consumption of nodes in the process of data fusion, a machine learning based data fusion method for wireless sensor networks is proposed. Through the establishment and training of wireless sensor network model, the compressed sensing method is used to collect wireless sensor network data, and the multi-dimensional de aggregation class analysis algorithm is used to de duplicate the collected data. Using the spatial correlation between the data collected by multiple sensor nodes, the DCS method is used to process the abnormal data of WSN network. In order to eliminate the influence of measurement error on the fusion accuracy, the WSN network data is preliminarily fused by combining the adaptive theory with the batch estimation fusion algorithm. Based on the preliminary fusion results of WSN network data, the Bayesian inference method in machine learning algorithm is used to further fuse WSN network data. The experimental results show that the number of surviving nodes is large and the energy consumption is low when using this method for data fusion. The energy consumption between wireless sensor nodes has a certain balance, which proves that this method has a good data fusion effect.