Data prediction method and device, electronic equipment and storage medium
Through the time series feature decomposition and decision tree construction of historical business data, the problem of inability to effectively learn complex features in the existing technology is solved, the accuracy and stability of data prediction are improved, and the data change patterns can be better understood and explained.
Patent Information
- Application Number
- CN202411096047.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-09
- Publication Date
- 2024-12-31
AI Technical Summary
Existing time series analysis methods are difficult to capture relationships in complex data and cannot effectively learn complex features, resulting in insufficient prediction accuracy and stability.
By obtaining historical business data in the target field, decompose the timing characteristics into seasonal terms, trend terms and residual terms, make predictions based on these terms, and build a decision tree with non-temporal characteristics to obtain the final data prediction result.
It improves the accuracy and stability of data prediction, can better understand and interpret data changes patterns, capture long-term dependencies and abnormal events, and enhances the ability to handle complex features.
Smart Images

Figure CN119226948A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer processing technology, and in particular to a data prediction method, device, electronic device and storage medium. Background Art
[0002] Data forecasting can help various fields to better handle business. Taking the sales field as an example, sales forecasting is an important business problem in many industries, especially in retail, e-commerce, manufacturing and other fields. Accurately predicting sales can help companies make better decisions, including inventory management, production planning, marketing strategies and other aspects. Existing sales forecasting methods are mainly based on time series analysis methods. Time series analysis is a statistical method for studying a sequence of continuous observations in time. It relies on past values to predict future values based on the intrinsic connection between sequences. It is relatively simple to implement, has wide applicability, and is highly interpretable. It can help us understand the trends, seasonality, outliers, periodicity and other characteristics in time series. For example, ARIMA model and Prophet model.
[0003] However, time series analysis can only process data with fewer influencing factors and lower complexity, and usually cannot capture complex relationships in the data. It can only perform well when future trends are similar to historical data. The expressive power of existing data prediction models is relatively simple, resulting in an inability to learn complex features well. Summary of the invention
[0004] In view of this, the present application provides a data prediction method, device, electronic device and storage medium to solve the problem that the prior art cannot learn complex features well.
[0005] In a first aspect of the present application, a data prediction method is provided, comprising: obtaining historical business data of a target field, the historical business data comprising time series features and non-time series features; decomposing the time series features to obtain seasonal items, trend items and residual items; making predictions based on trend items and residual items to obtain trend item changes and residual item changes, and fusing the trend item changes, residual item changes and the seasonal items to obtain initial data prediction results; constructing a decision tree based on the initial data prediction results and the non-time series features, and obtaining final data prediction results based on the decision tree.
[0006] According to a second aspect of the present application, a data prediction device is provided, comprising: an acquisition module, configured to acquire historical business data of a target domain, the historical business data comprising time series features and non-time series features; a decomposition module, configured to decompose the time series features to obtain seasonal items, trend items and residual items; an initial prediction module, configured to make predictions based on trend items and residual items, obtain trend item changes and residual item changes, and fuse the trend item changes, residual item changes and the seasonal items to obtain initial data prediction results; and a final prediction module, configured to construct a decision tree based on the initial data prediction results and non-time series features, and obtain final data prediction results based on the decision tree.
[0007] According to a third aspect of the present application, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.
[0008] According to a fourth aspect of the present application, a storage medium is provided, which stores a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.
[0009] At least one of the above technical solutions adopted in this application can achieve the following beneficial effects:
[0010] By acquiring historical business data in the target field, storing the historical business data in time series features and non-time series features respectively, decomposing the time series features to obtain seasonal items, trend items and residual items, and then making predictions based on trend items and residual items, it is possible to capture long-term dependencies in time series features, obtain preliminary trend item changes and residual item changes, further fuse trend item changes, residual item changes and seasonal items to obtain initial prediction results, and obtain initial data prediction results by comprehensively considering the impact of different factors on the data. A decision tree is constructed based on the initial data prediction results and non-time series features, which can further explore the potential patterns and correlations of the data, and obtain the final data prediction results based on each decision tree. In this way, we can better understand and explain the changing patterns of data based on the decomposition of time series features. Then, based on the changes in trend items, we can understand the overall development direction of the data. The changes in residual items can reflect anomalies or emergencies in the data. By integrating the changes in trend items, residual items and seasonal items, we can take into account the impact of different factors on the data, thereby improving the accuracy and stability of data prediction. Finally, based on the initial data prediction results, we can further build a decision tree with non-time series features to fully understand the importance and influence of each feature, and attach non-time features, such as region, brand, etc., to obtain specific final data prediction results. This can fully explore the potential rules and correlations in historical business data to help the model understand complex data features to handle complex data prediction tasks. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0012] Figure 1 It is a flow chart of a data prediction method provided in an embodiment of the present application;
[0013] Figure 2 It is a flowchart of another data prediction method provided in an embodiment of the present application;
[0014] Figure 3 is a structural schematic diagram of a data prediction device provided in an embodiment of the present application;
[0015] Figure 4 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0016] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0017] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0018] In addition, it should be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "includes..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0019] A data prediction method and device according to an embodiment of the present application will be described in detail below with reference to the accompanying drawings.
[0020] Figure 1 is a flow chart of a data prediction method provided in an embodiment of the present application. Figure 1 As shown, the data prediction method includes:
[0021] S101, obtaining historical business data of the target domain, where the historical business data includes time series features and non-time series features;
[0022] S102, decomposing the time series characteristics to obtain seasonal terms, trend terms and residual terms;
[0023] S103, performing prediction based on the trend item and the residual item to obtain the trend item change and the residual item change, and integrating the trend item change, the residual item change and the seasonal item to obtain the initial data prediction result;
[0024] S104, building a decision tree based on the initial data prediction results and the non-time series features, and obtaining the final data prediction results based on the decision tree.
[0025] Specifically, an interpretable regression model can be used to make overall data predictions, and the prediction results can also be specific to a single city. In this way, a wider range of data, such as business data from various places, can be used for overall model training during model training.
[0026] Furthermore, after obtaining the historical business data, the time series decomposition algorithm ("Seasonal and Trend decomposition using Loess, STL) can be used to decompose the time series features to obtain seasonal items, trend items and residual items. In order to fit the irregular part of the time series features, the seasonal item can be removed, and the trend item and residual item are input into the long short-term memory model (Long Short-Term Memory, LSTM) for processing to obtain the trend item change and the residual item change. The preliminary trend item prediction results and the prediction results corresponding to the residual data can be obtained. The trend item change, the residual item change and the seasonal item are recombined to obtain the initial data prediction results. Among them, the seasonal item can reflect the pattern of periodic changes in the data, such as the data fluctuations in a specific season of the year. The trend item can reflect the changes in the medium- and long-term trends of the data. The overall development direction of the data can be captured based on the trend item, such as the trend of gradual increase or decrease of the data. The residual item can reflect the noise, outliers, or unconsidered factors in the data.
[0027] Furthermore, the initial data prediction results can be combined with the seasonal items in an integrated learning manner, and fused with the non-time series features to obtain fused features, a decision tree can be constructed based on the fused features, and a final prediction can be made based on the prediction results of each decision tree to obtain the final data prediction results. The final data prediction results can be obtained by processing the fused features based on the extreme gradient boosting model (eXtreme Gradient Boosting, XGBoost).
[0028] According to the method of the above embodiment, the time series features can be decomposed to obtain seasonal terms, trend terms and residual terms, and the trend terms and residual terms can be further fitted. The fitting results are combined with the seasonal terms to obtain initial data prediction results, and the decision numbers are further constructed to obtain final data prediction results. Complex features can be processed, so that the data change model can be better understood and explained, and the entire prediction process is explainable and not a black box prediction mode. The final data prediction results can provide explainability and reference basis for business operations and decision-making.
[0029] In some embodiments, the time series features are decomposed to obtain seasonal terms, trend terms and residual terms, including: using a moving window to obtain data around the time series features at each time point, using the surrounding data as a local data set, and fitting according to the weights of the local data set to obtain the seasonal terms; subtracting the seasonal terms from the time series features to obtain the original data without the seasonal terms, and performing local weighted regression on the original data to obtain the trend terms; subtracting the trend terms and seasonal terms from the time series features to obtain the residual terms.
[0030] Specifically, STL can be used to decompose time series features, and the time series features can be divided into three parts: trend term, seasonal term and residual term. Specifically, based on the local weighted regression technology, the trend and seasonal components can be estimated by fitting a local linear regression model to obtain the trend term and the seasonal term. Then, the residual term can be obtained by subtracting the seasonal term and the trend term from the time series features. In practical applications, various programming languages and tools can be used to implement the STL algorithm, such as the stl() function in the R language, the statsmodels library in Python, etc. These tools usually provide convenient interfaces and functions, so that time series data can be directly decomposed and analyzed, and no specific restrictions are made here.
[0031] Furthermore, we can first calculate the seasonal component of each time point by moving the window, and use local weighted regression to fit the seasonal curve. The data points in the window are used as local data sets, and the seasonal terms are obtained by fitting according to the weights of the surrounding data. It should be noted that seasonality usually has a cycle, such as a week, a month or a year. In order to capture this periodic change, a sufficiently large window size is preset to calculate the seasonal component. For example, the minimum cycle is weekly, the unit is days, and there are 7 days in a week. Therefore, the window size can be selected to be greater than or equal to 7 to at least include complete periodic information.
[0032] Then, based on the decomposition of the seasonal term, the seasonal term component can be subtracted to obtain the original data without the seasonal term, and then the local weighted regression can be applied again to fit the trend curve to obtain the trend term. For example, each prediction point is determined, and for each training sample, the weight is calculated by the Gaussian function. Here, the samples closer to the predicted point can be given a higher weight. The weighted training samples are substituted into the weighted linear regression formula for fitting to obtain the fitted model, and then the fitted model is used to process the original data to obtain the trend term, which can better capture the nonlinear relationship of the time series characteristics.
[0033] Then, the trend term and seasonal term can be subtracted from the time series characteristics to obtain the residual sequence, i.e. the residual term.
[0034] As an example, there is a set of historical sales data that changes over time. The STL algorithm can be used to perform seasonal decomposition on the historical sales data to obtain the seasonal components at each time point, obtain the seasonal terms, and then extract the seasonal terms to obtain the original data without seasonality. The STL algorithm is applied to the original data without seasonality to obtain the trend term. The trend term and the seasonal term are subtracted from the historical sales data to obtain the residual term, which can reflect the non-seasonal and non-trend fluctuations in the historical sales data.
[0035] Of course, in addition to separating trend and seasonal features, we can also separate time series features into holiday features, and use holiday components to learn the impact of holidays occurring on irregular schedules. Specifically, we can abstract the trend characteristics of special holiday nodes (for example, the sales volume of bouquets on Valentine's Day will be much greater than usual) in historical business data, so that the model will consider the impact of holidays on data prediction, and predict the current holiday sales based on the historical holiday business trend characteristics with higher accuracy.
[0036] According to the method of the above embodiment, by decomposing the time series features, the seasonal, trend and residual components in the historical business data can be clearly understood, so as to better understand the structure and changing trends of the historical business data, and can flexibly adapt to different seasonal patterns and trend changes, while having a certain degree of robustness against outliers and noise.
[0037] In some embodiments, prediction is performed based on the trend term and the residual term to obtain trend term changes and residual term changes, including: inputting the trend term and the residual term into a long short-term memory model, filtering the trend term and the residual term through an input gate to obtain candidate cell states; discarding target historical data from the cell state at the previous moment through a forget gate to obtain a new cell state to capture long-term dependencies, and obtaining a target cell state based on the candidate cell state and the new cell state; and controlling the target cell state to filter through an output gate to obtain output information, the output information including trend term changes and residual term changes.
[0038] Specifically, the LSTM model can be used to model and predict time series features. Specifically, a control gate mechanism can be introduced to determine which data in the trend term and the residual term can enter the LSTM unit through the input gate to obtain the candidate cell state. The forget gate can determine which information in the cell state of the previous moment (i.e., the target historical data) needs to be forgotten or discarded in order to learn the long-term dependencies in the time series features and obtain a new cell state. The output gate can control the information in the target cell state in the LSTM unit to be output to the next unit or output layer. In the LSTM unit, an intermediate storage unit Ct called cell state 0 can be introduced to store information and pass it to the LSTM unit of the next layer, where the target cell state can be obtained based on the fusion of the candidate cell state and the new cell state, indicating the cell state in the LSTM unit at the current moment.
[0039] In other embodiments, prediction is performed based on trend terms and residual terms to obtain trend term changes and residual term changes, and also includes: through an input gate, input data is processed using an activation function to obtain a first control signal, input of the input data is controlled based on the first control signal to obtain a candidate cell state, wherein the input data represents the trend term and residual term input at the current time step; through a forgetting gate, input data and hidden information at the previous moment are mapped to a second control signal using an activation function, target historical data is discarded based on the second control signal to obtain a new cell state; through an output gate, input data and the cell state at the previous moment are calculated using an activation function to obtain a third control signal, and the target cell state is linearly combined based on the third control signal to obtain output information.
[0040] Specifically, the trend term and the residual term can be processed by a control gate composed of an activation function to generate a first control signal between 0 and 1. Based on the first control signal, the trend term and the residual term can be filtered to control the input degree of the candidate cell state, wherein the activation function can be a sigmoid function, that is, a sigmoid activation function can be used: i can be obtained according to the following formula t (value ranges from 0 to 1):
[0041] i t =σ(W i [h t-1 , x t ]+b i )
[0042] Among them, i t can represent the activation value of the input gate at time t, i.e., the first control signal. σ can represent the sigmoid activation function, which is used to map the input data to between 0 and 1, and thus can control the value close to 1 to allow input into the LSTM unit, while the value close to 0 closes the channel and does not allow input. W i It can represent the weight matrix, which is used to learn how to combine the hidden state h from the previous moment t-1 and the current input data x t , get the candidate cell state, b i It can represent bias and is used to adjust the input of the activation function to help the model learn the offset of the input data, making the model more flexible.
[0043] The second control signal can also be calculated by the activation function on the input data and the hidden state at the previous moment, and then the second control signal can be used to filter the cell state at the previous moment to obtain a new cell state. Specifically, the filtering task can be performed based on the following formula. t =σ(W g ·[h t-1 , x t]+b f )
[0044] where f t It can represent the second control signal of the forget gate, W g It can represent weighted evidence, b f It can represent the bias term, and the meanings of other codes that are the same as those in the previous formula are the same.
[0045] The second control signal can also be obtained by mapping the input data and the hidden information of the previous moment to 0 to 1 based on the sigmoid activation function. The value corresponding to 1 can represent complete retention, and the value corresponding to 0 can represent complete abandonment. The details will not be expanded.
[0046] Then, the activation function can be used to calculate the input data and the cell state at the previous moment to obtain the third control signal, and the output information can be obtained based on the third control signal. The sigmoid activation function can also be used to obtain a third control signal with a value in the interval [0, 1]. t , the third control signal can be obtained based on the following formula, o t =σ(W o ·[h t-1 , x t ]+b0)
[0047] Among them t It can represent weighted evidence, b0 can represent the bias term, and the others are not explained in detail.
[0048] Then, the output of the LSTM unit can be obtained by performing a linear combination based on the third control signal and the target cell state. Through this method, the final output information can be obtained after being processed by multiple LSTM units.
[0049] According to the method of the above embodiment, the temporal dynamic relationship between the residual term and the trend term can be learned through the LSTM model. The input gate is used to filter the candidate cell states of the input to selectively update the cell state, which helps the model learn useful information. The forget gate is used to control the model to discard the target historical data in the cell state of the previous moment, which can capture long-term dependencies and selectively forget unimportant information in the past moment, so as to better handle long-term dependencies. The output gate can be used to control which information in the target cell state needs to be filtered out, so as to extract the trend term changes and the residual term changes, and further obtain the initial data prediction results.
[0050] In some embodiments, a decision tree is constructed based on the initial data prediction results and the non-time series features, and a final data prediction result is obtained based on the decision tree, including: fusing the initial data prediction results with the non-time series features to obtain fused features; based on the fused features, constructing multiple decision trees, and obtaining corresponding multiple prediction results based on the multiple decision trees; and weighting and combining the multiple prediction results to obtain the final data prediction result.
[0051] Specifically, the initial data prediction results are fused with non-time series features to obtain fused features, so that business forecasts can be combined with time-independent data. For example, when predicting sales data, specific locations and specific sizes can be combined for prediction. For example, when predicting airport passenger flow, specific business forecasts can be combined with weather, airlines, airport locations, etc.
[0052] Then, a decision tree model is constructed based on the fusion features. In this process, the XGBoost model can be used to construct multiple decision trees to learn the relationship between the fusion features and the final data prediction results. This model can effectively fit complex data relationships. At the same time, after building multiple decision trees, each decision tree will predict the data, so multiple prediction results can be obtained. Each decision tree can provide a different perspective and prediction result. The prediction results of each decision tree are weighted and combined, and the prediction capabilities of each model can be comprehensively considered to obtain a more robust and accurate final prediction result. The weighted results can determine the weight according to the performance of each decision tree to ensure that the model with better performance has a greater influence. Of course, before using XGBoost for prediction, you can also introduce a training set for training, which will not be expanded here.
[0053] According to the method of the above embodiment, the final data prediction result can be obtained by fusing features, building multiple decision trees using XGBoost, and combining the weighted average of multiple prediction results. This combination of feature fusion, ensemble learning and decision tree technology can effectively deal with complex prediction problems and improve the accuracy of prediction.
[0054] In some embodiments, historical business data of a target field is obtained, including: extracting a large number of features corresponding to the business based on literature, business experience, and marketing tools to obtain initial data; filtering the initial data based on information gain, retaining initial data whose information gain is greater than a preset value, and obtaining historical business data.
[0055] Specifically, before executing the data prediction task, you can also build data features first, and you can first perform rough feature selection to select features related to the indicators (corresponding to the business prediction results, that is, the final data prediction results) to obtain historical business data.
[0056] Furthermore, a large number of features related to the indicators can be extracted based on literature, business experience, and commonly used business tools to achieve rough feature selection to obtain initial data. For example, the rough selected features in the sales field can include basic performance information: historical monthly and daily transaction data, transaction user source channels, transaction methods, transaction area, and property; macro information: land prices, market-issued currency, and government purchase restriction policies; second-hand housing transaction information: listing volume, listing price, transaction price, transaction area, etc.
[0057] Then, from a large number of features based on experience, the features related to the indicator, i.e., historical business data, can be selected through algorithms. For example, the Filter method is used to filter and select a single influencing factor. The Filter method mainly calculates a certain metric based on the general characteristics of the data to score the feature or feature subset. This method is independent of the learning algorithm. Common information, distance, dependence, consistency, similarity, and statistical measures are used as filtering measures. The information gain method is selected to calculate the Information Gain for the feature to characterize the contribution of the feature to the indicator. Features with information gain greater than the preset value can be screened out, and then historical business data can be obtained. The preset value can be obtained based on specific business needs. As an example, when building a sales forecasting model, an information gain threshold of 0.05 can be preset. Then, only features with information gain greater than 0.05 will be retained and used as historical business data to perform forecasting tasks. Of course, the acquisition of specific historical business data can also be verified by cross-validation and other methods to obtain the effect of feature selection.
[0058] According to the method of the above embodiment, unnecessary or honorary features in the data set can be reduced through information gain filtering, so that the final historical business data is more concise and efficient. The accuracy and efficiency of modeling can also be improved by retaining the initial data with large information gain. In this way, feature selection through information gain not only improves the modeling efficiency, but also simplifies the complexity of the data, making the data more interpretable and understandable.
[0059] In some embodiments, the non-time series features include regions, and obtaining historical business data of the target field also includes: if the data amount of the initial time series features corresponding to the region is less than a preset amount, recursively processing the initial time series features using a preset prediction model to obtain the time series features.
[0060] Specifically, a preset number can be determined in advance as the quantity threshold of time series features based on factors such as model performance, experience, and business needs. If the amount of data of the initial time series features of a region obtained after the above-mentioned information gain screening is less than the preset number, it means that the data is insufficient to support data prediction. For indicator data that has not been accumulated for enough time, the data can be expanded to obtain historical business data of sufficient volume.
[0061] Furthermore, the XGBOOST model can be used as a preset prediction model to perform feature recursive processing during feature construction. For example, the indicator data of the T-2 period and the related feature data of the T-2 period can be used to predict the T-1 data, and a sufficient number of time series features can be obtained to perform data prediction tasks.
[0062] According to the method of the above embodiment, the initial time series features can be recursively processed to ensure that the amount of historical business data reaches the expected level to meet the requirements of modeling and analysis. In this way, data can be automatically filled when the data volume is insufficient to ensure the accuracy and reliability of the model.
[0063] Figure 2 This is a flow chart of another data prediction method provided by an embodiment of the present application. Figure 2 The embodiments of the present application are further described.
[0064] First, the original data, that is, historical business data, can be input into the STL model for decomposition to obtain seasonal items, trend items, and error items. The trend items and error items are then input into the LSTM model for processing and fusion prediction to obtain trend item changes and error item changes. The trend item changes and error item changes are then recombined with the seasonal items to obtain the initial data prediction results. The initial data prediction results can then be fused with other non-time series features, such as cities, names, etc., and input into the XGBoost model for further prediction to obtain the final data prediction results. In this way, historical business data can be fully learned, feature processing can be performed through interpretable regression models, and business data can be predicted, which enhances the interpretability of the model. The features are time-seriesized through the LSTM model, and the features are processed using the XGBoost interpretable model. The business allocation can be guided according to the importance of the features, avoiding the problem of losses or accidents caused by excessive planning errors in business operations.
[0065] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present application, which will not be described one by one here.
[0066] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.
[0067] Figure 3 Schematic diagram of a data prediction device provided in an embodiment of the present application. Figure 3 As shown, the data prediction device includes:
[0068] An acquisition module 301 is configured to acquire historical business data of a target domain, where the historical business data includes time series features and non-time series features;
[0069] A decomposition module 302 is configured to decompose the time series features to obtain a seasonal term, a trend term, and a residual term;
[0070] The initial prediction module 303 is configured to perform prediction based on the trend item and the residual item, obtain the trend item change and the residual item change, and fuse the trend item change, the residual item change and the seasonal item to obtain the initial data prediction result;
[0071] The final prediction module 304 is configured to construct a decision tree based on the initial data prediction result and the non-time series feature, and obtain the final data prediction result based on the decision tree.
[0072] In some embodiments, the decomposition module 302 is specifically used to use a moving window to obtain data around the time series feature at each time point, use the surrounding data as a local data set, and fit it according to the weight of the local data set to obtain a seasonal term; subtract the seasonal term from the time series feature to obtain the original data without the seasonal term, and perform local weighted regression on the original data to obtain the trend term; subtract the trend term and the seasonal term from the time series feature to obtain a residual term.
[0073] In some embodiments, the initial prediction module 303 is specifically used to input the trend term and the residual term into the long short-term memory model, filter the trend term and the residual term through the input gate to obtain the candidate cell state; discard the target historical data from the cell state at the previous moment through the forgetting gate to obtain a new cell state to capture the long-term dependency, and obtain the target cell state based on the candidate cell state and the new cell state; control the target cell state through the output gate for filtering to obtain output information, and the output information includes the change of the trend term and the change of the residual term.
[0074] In some embodiments, the initial prediction module 303 is specifically used to process the input data through the input gate using an activation function to obtain a first control signal, control the input of the input data based on the first control signal, and obtain a candidate cell state, wherein the input data represents the trend term and the residual term input at the current time step; map the input data and the hidden information at the previous moment into a second control signal through a forgetting gate using an activation function, discard the target historical data based on the second control signal, and obtain a new cell state; calculate the input data and the cell state at the previous moment using an activation function through an output gate to obtain a third control signal, linearly combine the target cell state based on the third control signal, and obtain output information.
[0075] In some embodiments, the final prediction module 304 is specifically used to fuse the initial data prediction results with non-time series features to obtain fused features; based on the fused features, construct multiple decision trees, and obtain corresponding multiple prediction results based on the multiple decision trees; and weightedly combine the multiple prediction results to obtain the final data prediction results.
[0076] In some embodiments, the acquisition module 301 is specifically used to extract a large number of features corresponding to the business based on literature, business experience, and marketing tools to obtain initial data; filter the initial data based on information gain, retain the initial data whose information gain is greater than a preset value, and obtain historical business data.
[0077] In some embodiments, the acquisition module 301 is specifically used to obtain historical business data by recursively processing the initial time series features using a preset prediction model if the amount of data of the initial time series features corresponding to a region is less than a preset amount.
[0078] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0079] Figure 4 Schematic diagram of an electronic device 4 provided in an embodiment of the present application. Figure 4 As shown, the electronic device 4 of this embodiment includes: a processor 401, a memory 402, and a computer program 403 stored in the memory 402 and executable on the processor 401. When the processor 401 executes the computer program 403, the steps in the above-mentioned method embodiments are implemented. Alternatively, when the processor 401 executes the computer program 403, the functions of the modules / units in the above-mentioned device embodiments are implemented.
[0080] The electronic device 4 may be a desktop computer, a notebook, a PDA, a cloud server, or other electronic device. The electronic device 4 may include, but is not limited to, a processor 401 and a memory 402. Those skilled in the art will appreciate that Figure 4 The electronic device 4 is merely an example and does not limit the electronic device 4 , and may include more or less components than those shown in the figure, or different components.
[0081] The processor 401 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
[0082] The memory 402 may be an internal storage unit of the electronic device 4, for example, a hard disk or memory of the electronic device 4. The memory 402 may also be an external storage device of the electronic device 4, for example, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 4. The memory 402 may also include both an internal storage unit and an external storage device of the electronic device 4. The memory 402 is used to store computer programs and other programs and data required by the electronic device.
[0083] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units.
[0084] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the present application implements all or part of the process in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. The computer program may include computer program code, which may be in source code form, object code form, executable file or some intermediate form. Computer-readable media may include: any entity or device capable of carrying computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc.
[0085] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A data prediction method, characterized in that: include: Acquire historical business data of the target domain, wherein the historical business data includes time series features and non-time series features; Decomposing the time series characteristics to obtain seasonal terms, trend terms and residual terms; Predicting based on the trend item and the residual item, obtaining trend item changes and residual item changes, and fusing the trend item changes, the residual item changes and the seasonal item to obtain an initial data prediction result; A decision tree is constructed based on the initial data prediction result and the non-time series feature, and a final data prediction result is obtained based on the decision tree.
2. The method according to claim 1, characterized in that The decomposition of the time series features to obtain seasonal terms, trend terms and residual terms includes: Using a moving window to obtain data around each time point of the time series feature, taking the surrounding data as a local data set, and fitting according to the weight of the local data set to obtain the seasonal term; Subtracting the seasonal term from the time series feature to obtain original data without the seasonal term, and performing local weighted regression on the original data to obtain the trend term; The trend term and the seasonal term are subtracted from the time series feature to obtain the residual term.
3. The method according to claim 1, characterized in that: The predicting based on the trend term and the residual term to obtain a trend term change and a residual term change includes: Inputting the trend term and the residual term into a long short-term memory model, screening the trend term and the residual term through an input gate, and obtaining a candidate cell state; Discarding target historical data from the cell state at the previous moment through a forget gate to obtain a new cell state to capture long-term dependencies, and obtaining a target cell state based on the candidate cell state and the new cell state; The target cell state is controlled by an output gate to be filtered to obtain output information, where the output information includes the change of the trend term and the change of the residual term.
4. The method according to claim 3, characterized in that The prediction is performed based on the trend term and the residual term to obtain a trend term change and a residual term change, and further includes: Processing the input data by using an activation function through the input gate to obtain a first control signal, controlling the input of the input data based on the first control signal to obtain the candidate cell state, wherein the input data represents the trend term and the residual term input at the current time step; By using the forget gate, the input data and the hidden information at the previous moment are mapped into a second control signal using an activation function, and the target historical data is discarded based on the second control signal to obtain the new cell state; The input data and the cell state at the previous moment are calculated by using an activation function through the output gate to obtain a third control signal, and the target cell state is linearly combined based on the third control signal to obtain the output information.
5. The method according to claim 1, characterized in that The constructing a decision tree based on the initial data prediction result and the non-time series feature, and obtaining a final data prediction result based on the decision tree, includes: Fusing the initial data prediction result with the non-time series feature to obtain a fused feature; Based on the fusion features, multiple decision trees are constructed, and corresponding multiple prediction results are obtained based on the multiple decision trees; The multiple prediction results are weighted and combined to obtain the final data prediction result.
6. The method according to claim 1, characterized in that The obtaining of historical business data of the target field includes: Extract a large number of business-related features from literature, business experience, and marketing tools to obtain initial data; The initial data is filtered based on information gain, and the initial data whose information gain is greater than a preset value is retained to obtain the historical business data.
7. The method according to claim 6, characterized in that The non-time series feature includes region, and the acquisition of historical business data of the target field also includes: If the data amount of the initial time series features corresponding to the region is less than a preset amount, the historical business data is obtained by recursively processing the initial time series features using a preset prediction model.
8. A data prediction device, characterized in that: include: An acquisition module is configured to acquire historical business data of a target domain, wherein the historical business data includes time series features and non-time series features; A decomposition module is configured to decompose the time series features to obtain a seasonal term, a trend term, and a residual term; An initial prediction module is configured to perform prediction based on the trend item and the residual item, obtain a trend item change and a residual item change, and fuse the trend item change, the residual item change and the season item to obtain an initial data prediction result; The final prediction module is configured to construct a decision tree based on the initial data prediction result and the non-time series feature, and obtain the final data prediction result based on the decision tree.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Safety production intelligent supervision system based on artificial intelligence
CN119740989A
Intelligent method and device for system performance prediction and anomaly detection
CN120066925A
Vehicle collision detection method and device, vehicle and storage medium
CN120726849A
Enterprise management report merging budget cooperation system based on multi-dimensional data model
CN120850969A