Time series analysis is a universal way for human beings to understand and explore the laws of nature.In order to accurately predict time series data,machine learning,as the basis of artificial intelligence research,has an absolute advantage in complex time series analysis.Therefore,it is of great significance to study machine learning algorithms for analyzing time series.An improved SAM-LSTM fusion algorithm is proposed to solve the problem that the traditional time series analysis method is not accurate enough to predict the time series.By studying the current methods for time series prediction effect is good and general algorithm based on machine learning support vector machine(SVM)and recurrent neural network(RNN),it is found that SVM is mainly used to classify linear separable data,Although RNN has the ability to save previous information,it is easy to cause the phenomenon of gradient disappearance,which leads to poor prediction effect.Long and short-term memory neural network(LSTM)is to solve the problem that RNN can not deal with long-distance long-sequence dependence,By adding gate structures,the problem of gradient disappearance is well avoided;The purpose of self attention mechanism(SAM)is to help the model to give different weights to each sample data and extract the key information affecting data analysis and prediction.The SAM-LSTM fusion algorithm is constructed,and the respective advantages of the two algorithms are integrated.The power load demand data and daily maximum temperature meteorological data are selected experimentally,to compare the accuracy and error value of SVM algorithm,RNN algorithm,LSTM algorithm and SAM-LSTM algorithm for time series prediction,the evaluation indicators are mean absolute error(MAE),mean absolute percentage error(MAPE),mean square error(MSE).Based on the analysis of experimental results,taking the power load demand data prediction of NSW as an example,compared with the RNN method,the MAPE value of SAM-LSTM method is reduced by 55.1%,the MSE value is reduced by 57.4%,and the MAE value is reduced by 33.8%;compared with the LSTM method,the MAE value of SAM-LSTM method is reduced by 33.2%,the MAPE value is reduced by 52.9%,and the MSE value is reduced by 53.8%.The simulation results show that the improved SAM-LSTM algorithm can be applied to the study of time series analysis and prediction,and the prediction simulation diagram has high coincidence and low error value,which is of great significance to the study of time series analysis. |