Time series data prediction method and device based on improved secondary exponential smoothing
By regularly acquiring and correcting time series data, eliminating abnormal data and adjusting the smoothing coefficient, the problems of error accumulation and model lag in the prior art are solved, and the accuracy and adaptability of time series data prediction are improved.
Patent Information
- Application Number
- CN202411218978.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-02
- Publication Date
- 2024-12-06
AI Technical Summary
Existing time series data prediction methods rely on historical prediction data, resulting in error accumulation and model update lag, unable to reflect the latest behavior patterns in time, and relying on mutation value correction increases system complexity.
By regularly obtaining historical time series data, eliminating data with a difference value greater than the preset threshold, correcting the fitting curve, and adjusting the horizontal smoothing coefficient and trend smoothing coefficient according to business rules, and dynamically adjusting the model to adapt to data changes.
Reduces error accumulation, improves prediction accuracy and real-time, reduces the lag deviation of model updates, and enhances the adaptability of the model.
Smart Images

Figure CN119090079A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of big data processing, and in particular to a time series data prediction method and device based on improved quadratic exponential smoothing. Background Art
[0002] Intelligent prediction methods are widely used in many fields, including finance, logistics, medical care, environmental protection, etc. In these fields, intelligent prediction methods are essentially predictions of a series of time series data, such as account balance predictions in the financial field, inventory demand predictions in the logistics field, patient condition change predictions in the medical field, and air quality index predictions in the environmental protection field. At present, with the development of big data and artificial intelligence technology, intelligent prediction methods are also constantly developing and innovating, providing more accurate and sophisticated prediction services for various industries.
[0003] In the field of time series data prediction, existing technologies usually rely on historical prediction data for modeling and prediction. These methods usually adopt a quadratic exponential smoothing model, and construct a prediction model to predict future data by obtaining the historical prediction data and related historical data of the target data. For example, in terms of account balance, the existing technology is implemented in the following ways: obtaining the historical prediction balance data and historical payment data of the target account; constructing a quadratic exponential smoothing model based on the historical prediction balance data; using the quadratic exponential smoothing model to predict the N first time nodes of the target account in the first time period; obtaining the historical payment data of the target account in the historical second time period at the N second time nodes; determining the historical payment data with numerical mutations from the N historical payment data to obtain the target historical payment data; determining the second time node corresponding to the target historical payment data as the second mutation node; generating a mutation value based on the predicted balance corresponding to the target first time node corresponding to the second mutation node and the target historical payment data; and using the mutation value to correct the predicted balance of the N first time nodes.
[0004] However, the prior art still has the following problems:
[0005] First, existing technologies rely on historical forecast data, which means that each forecast is based on previous forecast results. If a forecast is wrong, the error will accumulate in subsequent forecasts, resulting in larger and larger deviations. In addition, due to the reliance on past forecast data, model updates and adjustments will lag behind actual time series data changes and fail to reflect the latest behavior patterns in a timely manner.
[0006] Secondly, the existing technology uses mutation values to correct the prediction results. This method only makes local adjustments and cannot optimize the prediction ability of the entire model. Moreover, the correction of mutation values is usually carried out after significant changes occur, and the reaction is relatively delayed. Finally, using mutation values for correction requires complex rules and logic to identify and process mutations, which increases the complexity of the system and the difficulty of maintenance. Summary of the invention
[0007] In view of this, the present invention provides an account balance prediction method and device to solve at least one of the above-mentioned problems.
[0008] In order to achieve the above object, the present invention adopts the following scheme:
[0009] According to a first aspect of the present invention, a time series data prediction method based on improved quadratic exponential smoothing is provided, the method comprising: regularly acquiring historical time series data and determining whether the amount of historical time series data meets a prediction condition; in response to the amount of historical time series data meeting the prediction condition, obtaining a fitting curve of the historical time series data based on a quadratic exponential smoothing method; eliminating data whose difference value with the fitting curve is greater than a preset threshold from the historical time series data; correcting the fitting curve after eliminating the difference data; obtaining a predicted value of the time series data after N days according to established business rules and the corrected fitting curve; within a set time period before reaching N days, determining whether the predicted value of the time series data meets the set condition, if so, performing corresponding business operations, if not, correcting the horizontal smoothing coefficient and trend smoothing coefficient in the quadratic exponential smoothing method.
[0010] As an embodiment of the present invention, the above method further includes: dynamically adjusting the preset threshold value by using the moving average and standard deviation of the historical time series data within a set time period.
[0011] As an embodiment of the present invention, the method of correcting the fitting curve after eliminating the difference data includes: re-fitting the curve using the historical time series data after eliminating the difference data; and smoothing the re-fitted curve to reduce the fluctuation introduced by eliminating the data.
[0012] As an embodiment of the present invention, the above method for obtaining the predicted value of time series data N days later according to established business rules and the modified fitting curve includes: predicting the time series data N days later according to the horizontal smoothing and trend smoothing of the modified fitting curve; adjusting the predicted time series data according to the established business rules to obtain the predicted value of time series data N days later.
[0013] As an embodiment of the present invention, the above method for determining whether the predicted value of the time series data meets the set conditions includes: determining whether the absolute value of the difference between the predicted value of the time series data and the actual value is less than a preset threshold, or determining whether the ratio between the predicted value and the actual value of the time series data is within a set range.
[0014] As an embodiment of the present invention, if the above method is not satisfied, the horizontal smoothing coefficient and the trend smoothing coefficient in the quadratic exponential smoothing method are corrected, including: if the absolute value of the difference is greater than a preset threshold, then continue to judge whether the predicted value is lower than the actual value, if it is lower than the actual value, increase the horizontal smoothing coefficient, if it is higher than the actual value, reduce the horizontal smoothing coefficient, and judge whether the predicted value has multiple consecutive prediction errors in the same direction, if the predicted value is lower than the actual value for multiple consecutive times, increase the trend smoothing coefficient, if the predicted value is higher than the actual value for multiple consecutive times, reduce the trend smoothing coefficient; or if the ratio is not within the set range, then continue to judge whether the predicted value is lower than the actual value, if it is lower than the actual value, increase the horizontal smoothing coefficient, if it is higher than the actual value, reduce the horizontal smoothing coefficient, and judge whether the predicted value has multiple consecutive prediction errors in the same direction, if the predicted value is lower than the actual value for multiple consecutive times, increase the trend smoothing coefficient, if the predicted value is higher than the actual value for multiple consecutive times, reduce the trend smoothing coefficient.
[0015] According to a second aspect of the present invention, there is provided a time series data prediction device based on improved quadratic exponential smoothing, the device comprising: a historical data acquisition unit, used to periodically acquire historical time series data and determine whether the amount of historical time series data meets the prediction conditions; a fitting curve acquisition unit, used to obtain a fitting curve of the historical time series data based on the quadratic exponential smoothing method in response to the amount of historical time series data meeting the prediction conditions; a data elimination unit, used to eliminate data whose difference value with the fitting curve is greater than a preset threshold from the historical time series data; a curve correction unit, used to correct the fitting curve after eliminating the difference data; a prediction unit, used to obtain a predicted value of the time series data after N days according to established business rules and the corrected fitting curve; a judgment unit, used to determine whether the predicted value of the time series data meets the set conditions within a set time period before reaching N days; a business operation unit, used to perform corresponding business operations when the set conditions are met; a coefficient correction unit, used to correct the horizontal smoothing coefficient and the trend smoothing coefficient in the quadratic exponential smoothing method when the set conditions are not met.
[0016] As an embodiment of the present invention, the above-mentioned device further includes: a threshold adjustment unit, which is used to dynamically adjust the preset threshold using the moving average and standard deviation of the historical time series data within a set time period.
[0017] As an embodiment of the present invention, the above-mentioned curve correction unit includes: a re-fitting module, which is used to re-fit the curve using the historical time series data after eliminating the difference data; and a smoothing processing module, which is used to smooth the re-fitted curve to reduce the fluctuation introduced by eliminating the data.
[0018] As an embodiment of the present invention, the above-mentioned prediction unit includes: a prediction module, which predicts the time series data N days later based on the horizontal smoothing and trend smoothing of the modified fitting curve; a prediction value adjustment module, which is used to adjust the predicted time series data according to established business rules to obtain the predicted value of the time series data N days later.
[0019] As an embodiment of the present invention, the above-mentioned judgment unit is specifically used to: judge whether the absolute value of the difference between the predicted value and the actual value of the time series data is less than a preset threshold, or judge whether the ratio between the predicted value and the actual value of the time series data is within a set range.
[0020] As an embodiment of the present invention, the above-mentioned coefficient correction unit is specifically used for: if the absolute value of the difference is greater than a preset threshold value, then continue to judge whether the predicted value is lower than the actual value, if it is lower than the actual value, increase the horizontal smoothing coefficient, if it is higher than the actual value, reduce the horizontal smoothing coefficient, and judge whether the prediction error of the predicted value is in the same direction for multiple consecutive times, if the predicted value is lower than the actual value for multiple consecutive times, increase the trend smoothing coefficient, if the predicted value is higher than the actual value for multiple consecutive times, reduce the trend smoothing coefficient; or if the ratio is not within the set range, then continue to judge whether the predicted value is lower than the actual value, if it is lower than the actual value, increase the horizontal smoothing coefficient, if it is higher than the actual value, reduce the horizontal smoothing coefficient, and judge whether the prediction error of the predicted value is in the same direction for multiple consecutive times, if the predicted value is lower than the actual value for multiple consecutive times, increase the trend smoothing coefficient, if the predicted value is higher than the actual value for multiple consecutive times, reduce the trend smoothing coefficient.
[0021] According to a third aspect of the present invention, there is provided an electronic device, 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.
[0022] According to a fourth aspect of the present invention, there is provided a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of the above method when executed by a processor.
[0023] According to a fifth aspect of the present invention, there is provided a computer program product, comprising a computer program / instructions, which implement the steps of the above method when executed by a processor.
[0024] It can be seen from the above technical solutions that the time series data prediction method based on improved quadratic exponential smoothing provided by the present application avoids relying on historical prediction data by regularly acquiring historical time series data and reconstructing the fitting curve at each prediction. This method reduces the accumulation of errors in subsequent predictions, thereby improving the accuracy of the prediction. In addition, the present application regularly updates and refits the data, and the model can promptly reflect the behavior pattern of the latest data subject, so that the prediction results are closer to the actual situation and reduce the deviation caused by the lag in model update. Finally, when the prediction does not meet the set conditions, the present application automatically corrects the horizontal smoothing coefficient and trend smoothing coefficient in the quadratic exponential smoothing method. This dynamic adjustment mechanism improves the adaptability of the model, enabling it to better cope with changes in time series data. These improvements make the time series data prediction method and device of the present invention superior to the prior art in terms of accuracy, real-time, complexity and adaptability. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the prior art descriptions. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. In the drawings:
[0026] Figure 1 It is a flow chart of a time series data prediction method based on improved quadratic exponential smoothing provided by an embodiment of the present invention;
[0027] Figure 2 It is a schematic diagram of a flow chart of correcting and eliminating difference data to fit a curve provided in an embodiment of the present application;
[0028] Figure 3 This is a schematic diagram of a process for obtaining a predicted value of time series data N days later provided in an embodiment of the present application;
[0029] Figure 4 It is a structural schematic diagram of a time series data prediction device based on improved quadratic exponential smoothing provided by an embodiment of the present invention;
[0030] Figure 5 is a structural schematic diagram of a curve correction unit provided in an embodiment of the present application;
[0031] Figure 6 is a schematic diagram of the structure of a prediction unit provided in an embodiment of the present application;
[0032] Figure 7 It is a schematic block diagram of the system structure of the electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0033] To make the purpose, technical solution and advantages of the embodiments of the present invention more clear, the embodiments of the present invention are further described in detail below in conjunction with the accompanying drawings. Here, the exemplary embodiments of the present invention and their descriptions are used to explain the present invention, but are not intended to limit the present invention.
[0034] The information collected in the technical solution of this application is information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of relevant data comply with the relevant laws, regulations and standards of relevant countries and regions, take necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0035] The acquisition, transmission, storage, use, and processing of data in the technical solution of this application comply with the relevant provisions of national laws and regulations.
[0036] It should be noted that in the embodiments of the present application, certain software, components, models and other existing solutions in the industry may be mentioned, and they should be regarded as exemplary. Their purpose is only to illustrate the feasibility of implementing the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.
[0037] like Figure 1 FIG. 1 is a flow chart of a time series data prediction method based on improved quadratic exponential smoothing provided by an embodiment of the present invention. The method comprises the following steps:
[0038] Step S101: periodically obtain historical time series data and determine whether the amount of historical time series data meets the prediction conditions.
[0039] Historical time series data are collected regularly at set time intervals (e.g., daily, weekly). As pointed out in the background technology, these historical time series data may involve multiple fields such as finance, logistics, medical care, environmental protection, etc. Taking the financial field as an example, these historical data may usually include account transaction records, balance changes, etc., such as historical consumption and deduction records of gas fees, heating fees, water and electricity fees, etc. The purpose of regularly acquiring data is to ensure that the model can timely reflect the latest status and trends of the data subject. Here, the data subject may be, for example, accounts in the financial field, inventory in the logistics field, patient records in the medical field, or air quality in the environmental protection field.
[0040] After acquiring the data, check whether the data volume meets the minimum requirements for effective prediction, which can include the time span of the data, the number of data points, etc. If the data volume is insufficient, the prediction results may be inaccurate, so it is necessary to wait until the data volume meets the conditions before proceeding to the subsequent prediction steps.
[0041] Step S102: In response to the amount of the historical time series data satisfying a prediction condition, a fitting curve of the historical time series data is obtained based on a quadratic exponential smoothing method.
[0042] The quadratic exponential smoothing method is a time series analysis method suitable for time series data with trends. It can better capture the trends and changes of data by re-smoothing the first exponential smoothing value. This application not only considers the current value of the data, but also the historical trend of the data, thereby generating a smoother and more accurate fitting curve. Using the data processed by the quadratic exponential smoothing method, a fitting curve can be generated, which represents the trend and change pattern of the time series data. The fitting curve provides a basis for subsequent predictions and can help identify future trends in time series data.
[0043] Through this step, the forecasting model is able to utilize trend information from historical data to provide a reliable basis for future forecasts.
[0044] Step S103: Eliminate data whose difference value with the fitting curve is greater than a preset threshold from the historical time series data.
[0045] The purpose of this step is to identify and remove data points that deviate greatly from the fitted curve, ensuring that the data on which the model is based is more reliable, thereby improving the accuracy of the prediction.
[0046] First, the difference between each historical time series data point and the corresponding point on the fitted curve is calculated. The difference is the distance between the actual data value and the corresponding value on the fitted curve. A reasonable threshold is determined to determine which difference values are considered abnormal. This threshold is usually determined based on the characteristics of the data and business needs. For each data point, check its difference with the fitted curve. If the difference is greater than the preset threshold, the data point is considered abnormal data, and the identified abnormal data point is removed from the historical time series data.
[0047] It can be seen that this process can reduce the impact of noise and outliers in the data on the model. By eliminating abnormal data points, the fitting curve of the model can more accurately represent the normal change trend of the account and will not be biased by individual outliers, thereby making the prediction results more in line with the actual situation.
[0048] Preferably, in order to improve the accuracy of anomaly detection and better adapt to dynamic changes in data, the present application can dynamically adjust the preset threshold in this step using the moving average and standard deviation of historical time series data within a set time period.
[0049] The moving average is used to identify the long-term trend of the data. It can help determine whether the data is rising, falling, or stable. The moving average calculation can use a simple moving average, a weighted moving average, or an exponential moving average. The specific choice depends on the specific application scenario and data characteristics, and this application does not limit this. The standard deviation is used to measure the volatility of the data and describe the degree of dispersion of the data. For a set of data, you can first calculate its average value, and then calculate the variance based on the average value, and the standard deviation is the square root of the variance. The size of the standard deviation provides an intuitive understanding of the distribution of individual data in the data set.
[0050] The moving average can be used to check the trend of the data. If the moving average shows a strong upward or downward trend, it means that the data is undergoing a systematic change. In this case, if the direction of the data change is consistent with the trend, even if some data points deviate a lot from the average, they may be part of the trend rather than anomalies. At the same time, observe the standard deviation to understand the volatility of the data. If the standard deviation is large, it means that the data fluctuates violently; if the standard deviation is small, it means that the data is relatively stable. In the case of high volatility, in order to avoid misjudgment, it is necessary to relax the threshold to accommodate higher volatility and prevent normal data from being mistakenly identified as abnormal.
[0051] Therefore, the present embodiment can dynamically adjust the preset threshold in the following manner: if the data has both a high standard deviation and an obvious trend (indicated by a moving average), the preset threshold is relaxed, so that fluctuations under the trend can be avoided from being misjudged as abnormalities. If the data standard deviation is small or the moving average trend is stable, the preset threshold can be tightened to more strictly eliminate abnormal data that deviates significantly. If there is no specific trend but the fluctuation is high, the threshold can be moderately adjusted based on the standard deviation, keeping it neither too loose nor too strict.
[0052] By regularly updating the moving average and standard deviation and adjusting the threshold in a timely manner to adapt to the latest data changes, this dynamic adjustment can improve the sensitivity and accuracy of abnormal data identification.
[0053] Step S104: correcting the fitting curve after eliminating the difference data.
[0054] By correcting the fitting curve, the model can be used more reliably in subsequent prediction steps to ensure the accuracy and stability of the prediction results. This step is a key step to ensure that the model can still effectively reflect historical time series data after removing abnormal data.
[0055] Step S105: Obtain the predicted value of the time series data N days later according to the established business rules and the corrected fitting curve.
[0056] The modified fitting curve generated in step S104 is used as a basis to predict future changes in time series data. The prediction process is adjusted according to specific business needs and rules. For example, some businesses may need to consider seasonal factors, specific transaction patterns or other external factors. Business rules can help adjust the prediction results to make them more in line with actual business scenarios and needs.
[0057] Step S106: within a set time period before N days, determine whether the predicted value of the time series data meets the set conditions. If so, perform corresponding business operations; if not, correct the horizontal smoothing coefficient and trend smoothing coefficient in the quadratic exponential smoothing method.
[0058] The predicted value of the time series data is evaluated within a set time period before N days, such as the day before N days. The setting of this time period can be determined according to business needs. If the predicted value does not meet the set conditions, the model needs to be adjusted. Specifically, the model can be optimized by modifying the horizontal smoothing coefficient and trend smoothing coefficient in the quadratic exponential smoothing method. These adjustments are intended to improve the adaptability of the model so that it can more accurately reflect the real change trend of the data subject.
[0059] It can be seen from the above technical solutions that the time series data prediction method based on improved quadratic exponential smoothing provided by the present application avoids relying on historical prediction data by regularly acquiring historical time series data and reconstructing the fitting curve at each prediction. This method reduces the accumulation of errors in subsequent predictions, thereby improving the accuracy of the prediction. In addition, the present application regularly updates and refits the data, and the model can promptly reflect the behavior pattern of the latest data subject, so that the prediction results are closer to the actual situation and reduce the deviation caused by the lag in model update. Finally, when the prediction does not meet the set conditions, the present application automatically corrects the horizontal smoothing coefficient and trend smoothing coefficient in the quadratic exponential smoothing method. This dynamic adjustment mechanism improves the adaptability of the model, enabling it to better cope with changes in time series data. These improvements make the time series data prediction method and device of the present invention superior to the prior art in terms of accuracy, real-time, complexity and adaptability.
[0060] Preferably, Figure 2 As shown, the correction of the fitting curve after eliminating the difference data in the above step S104 may further include:
[0061] Step S1041: re-perform curve fitting using the historical time series data after eliminating the difference data.
[0062] Using the cleaned data set (i.e., the part after removing the difference data) provides a basis for refitting the curve, which ensures that the fitting process is based on more accurate and reliable data.
[0063] Step S1042: Smoothing the refitted curve to reduce fluctuations introduced by removing data.
[0064] After removing abnormal data and refitting the curve, some unnecessary fluctuations may occur, which may be caused by the reduction of data points or the overfitting of local data during the fitting process. Therefore, this application performs a smoothing process to solve this problem. In addition, after smoothing, the smoothing effect can be further evaluated to evaluate whether the smoothed curve effectively reduces unnecessary fluctuations while retaining the main trends and features of the data. Visual tools (such as drawing curve graphs before and after smoothing) can be used to intuitively compare the smoothing effect.
[0065] Through these steps, smoothing can effectively reduce the fluctuations in the fitting curve, making the analysis results more stable and reliable.
[0066] Preferably, Figure 3 As shown, obtaining the predicted value of the time series data after N days according to the established business rules and the modified fitting curve in the above step S105 may further include:
[0067] Step S1051: Predict the time series data N days later based on the horizontal smoothing and trend smoothing of the modified fitting curve. The quadratic exponential smoothing method usually includes two main parts: horizontal smoothing and trend smoothing. This application can use them to predict the predicted value of the time series data N days later. For example, the following formula can be used to predict the predicted value of the time series data N days later:
[0068] y t+N =S t +N×b t ;
[0069] where y t+N Represents the predicted value after N days, S t represents the current level value, b t Represents the current trend value.
[0070] Step S1052: adjusting the predicted time series data according to the established business rules to obtain the predicted value of the time series data N days later.
[0071] Business rules include, for example, seasonal adjustments, which take into account the impact of certain specific time periods (such as holidays and salary payment dates); business activities, such as the impact of known future transactions (such as loan repayments and term deposit maturities) on account balances. According to these rules, appropriate additions and subtractions are made to the forecast value obtained in step S1051 to obtain the final forecast value of the time series data after N days.
[0072] Through these steps, a forecast value of time series data N days later can be obtained after adjusting the business rules. This process combines technical models and business understanding to ensure the practicality and accuracy of the forecast results.
[0073] Preferably, determining whether the predicted value of the time series data meets the set conditions in the above step S106 may include: determining whether the absolute value of the difference between the predicted value of the time series data and the actual value is less than a preset threshold, or determining whether the ratio between the predicted value and the actual value of the time series data is within a set range.
[0074] Further preferably, if the above step S106 is not satisfied, then the horizontal smoothing coefficient and the trend smoothing coefficient in the quadratic exponential smoothing method are modified to include:
[0075] If the judgment is made by the absolute value of the difference between the predicted value and the actual value of the time series data: if the absolute value of the difference is greater than the preset threshold, continue to judge whether the predicted value is lower than the actual value. If it is lower than the actual value, increase the horizontal smoothing coefficient; if it is higher than the actual value, reduce the horizontal smoothing coefficient; and judge whether the predicted value has multiple consecutive prediction errors in the same direction. If the predicted value is lower than the actual value for multiple consecutive times, increase the trend smoothing coefficient; if the predicted value is higher than the actual value for multiple consecutive times, reduce the trend smoothing coefficient.
[0076] If the absolute value of the difference between the predicted value and the actual value is greater than the preset threshold, it means that the prediction error is too large and needs to be adjusted, and then further determine the position of the predicted value relative to the actual value: If the predicted value is lower than the actual value, the horizontal smoothing coefficient needs to be increased, which means that the model needs to be more sensitive to recent data changes, so increasing the coefficient can make new data have a stronger impact on the level estimate. If the predicted value is higher than the actual value, the horizontal smoothing coefficient needs to be reduced, which will reduce the impact of new data on the level estimate and increase the stability of the prediction.
[0077] Then further determine whether the error occurs continuously in the same direction: if the predicted value is lower than the actual value for many consecutive times, it means that there is a systematic underestimation, and the trend smoothing coefficient should be increased, which will enable the model to adapt and adjust to trend changes more quickly. If the predicted value is higher than the actual value for many consecutive times, it means that there is a systematic overestimation, so the trend smoothing coefficient should be reduced to smooth the pace of trend adjustment and make the forecast more robust.
[0078] If the judgment is made by the ratio between the predicted value and the actual value of the time series data: if the ratio is not within the set range, then continue to judge whether the predicted value is lower than the actual value, if it is lower than the actual value, increase the horizontal smoothing coefficient, if it is higher than the actual value, reduce the horizontal smoothing coefficient, and judge whether the predicted value has multiple consecutive prediction errors in the same direction, if the predicted value is lower than the actual value for multiple consecutive times, increase the trend smoothing coefficient, if the predicted value is higher than the actual value for multiple consecutive times, reduce the trend smoothing coefficient. The adjustment principle is as described above and will not be repeated here.
[0079] like Figure 4 The figure shows a schematic diagram of the structure of a time series data prediction device based on improved quadratic exponential smoothing provided in an embodiment of the present application, the device comprising: a historical data acquisition unit 410, a fitting curve acquisition unit 420, a data elimination unit 430, a curve correction unit 440, a prediction unit 450, a judgment unit 460, a business operation unit 470 and a coefficient correction unit 480, wherein the fitting curve acquisition unit 420 is respectively connected to the historical data acquisition unit 410 and the data elimination unit 430, the curve correction unit 440 is respectively connected to the data elimination unit 430 and the prediction unit 450, and the judgment unit 460 is respectively connected to the prediction unit 450, the business operation unit 470 and the coefficient correction unit 480.
[0080] A historical data acquisition unit 410 is used to periodically acquire historical time series data and determine whether the amount of historical time series data meets the prediction condition;
[0081] A fitting curve obtaining unit 420, configured to obtain a fitting curve of the historical time series data based on a quadratic exponential smoothing method in response to the amount of the historical time series data satisfying a prediction condition;
[0082] A data elimination unit 430 is used to eliminate data whose difference value with the fitting curve is greater than a preset threshold from the historical time series data;
[0083] The curve correction unit 440 is used to correct the fitting curve after removing the difference data;
[0084] Prediction unit 450, used to obtain the predicted value of time series data N days later according to the established business rules and the modified fitting curve;
[0085] A judgment unit 460 is used to judge whether the predicted value of the time series data meets a set condition within a set time period before N days;
[0086] A business operation unit 470, configured to perform corresponding business operations when set conditions are met;
[0087] The coefficient correction unit 480 is used to correct the horizontal smoothing coefficient and the trend smoothing coefficient in the quadratic exponential smoothing method when the set conditions are not met.
[0088] Preferably, the device of this embodiment further includes: a threshold adjustment unit, which is used to dynamically adjust the preset threshold using the moving average and standard deviation of historical data within a set time period.
[0089] Preferably, Figure 5 As shown, the curve correction unit 440 may further include:
[0090] The refitting module 441 is used to refit the curve using the historical time series data after removing the difference data.
[0091] The smoothing processing module 442 is used to smooth the re-fitted curve to reduce the fluctuation introduced by removing data.
[0092] Preferably, Figure 6 As shown, the prediction unit 450 may further include:
[0093] The prediction module 451 predicts the time series data N days later according to the horizontal smoothing and trend smoothing of the modified fitting curve.
[0094] The prediction value adjustment module 452 is used to adjust the predicted time series data according to the established business rules to obtain the predicted value of the time series data after N days.
[0095] Preferably, the above-mentioned judgment unit 460 is specifically used to: judge whether the absolute value of the difference between the predicted value and the actual value of the time series data is less than a preset threshold, or judge whether the ratio between the predicted value and the actual value of the time series data is within a set range.
[0096] Preferably, the coefficient correction unit 480 is specifically used for: if the absolute value of the difference is greater than a preset threshold, then continue to judge whether the predicted value is lower than the actual value, if it is lower than the actual value, increase the horizontal smoothing coefficient, if it is higher than the actual value, reduce the horizontal smoothing coefficient, and judge whether the prediction error of the predicted value is in the same direction for multiple consecutive times, if the predicted value is lower than the actual value for multiple consecutive times, increase the trend smoothing coefficient, if the predicted value is higher than the actual value for multiple consecutive times, reduce the trend smoothing coefficient; or if the ratio is not within the set range, then continue to judge whether the predicted value is lower than the actual value, if it is lower than the actual value, increase the horizontal smoothing coefficient, if it is higher than the actual value, reduce the horizontal smoothing coefficient, and judge whether the prediction error of the predicted value is in the same direction for multiple consecutive times, if the predicted value is lower than the actual value for multiple consecutive times, increase the trend smoothing coefficient, if the predicted value is higher than the actual value for multiple consecutive times, reduce the trend smoothing coefficient.
[0097] It can be seen from the above technical solutions that the time series data prediction device based on improved quadratic exponential smoothing provided by the present application avoids relying on historical prediction data by regularly acquiring historical time series data and reconstructing the fitting curve at each prediction. This method reduces the accumulation of errors in subsequent predictions, thereby improving the accuracy of the prediction. In addition, the present application regularly updates and refits the data, so that the model can timely reflect the behavior pattern of the latest data subject, making the prediction result closer to the actual situation and reducing the deviation caused by the lag in model update. Finally, when the prediction does not meet the set conditions, the present application automatically corrects the horizontal smoothing coefficient and trend smoothing coefficient in the quadratic exponential smoothing method. This dynamic adjustment mechanism improves the adaptability of the model, enabling it to better cope with changes in time series data. These improvements make the time series data prediction method and device of the present invention superior to the prior art in terms of accuracy, real-time, complexity and adaptability.
[0098] An embodiment of the present invention further provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the above method is implemented when the processor executes the program.
[0099] An embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the above method are implemented.
[0100] An embodiment of the present invention further provides a computer program product, including a computer program / instruction, which implements the steps of the above method when the computer program / instruction is executed by a processor.
[0101] like Figure 7 As shown, the electronic device 600 may further include: a communication module 110, an input unit 120, an audio processor 130, a display 160, and a power supply 170. It is worth noting that the electronic device 600 does not necessarily have to include Figure 7 In addition, the electronic device 600 may also include Figure 7 For components not shown, reference may be made to the prior art.
[0102] like Figure 7 As shown, the central processor 100 is sometimes also referred to as a controller or an operation control, and may include a microprocessor or other processor devices and / or logic devices. The central processor 100 receives inputs and controls the operations of various components of the electronic device 600.
[0103] The memory 140 may be, for example, one or more of a cache, a flash memory, a hard drive, a removable medium, a volatile memory, a non-volatile memory or other suitable devices. The above-mentioned information related to the failure may be stored, and a program for executing the relevant information may also be stored. The CPU 100 may execute the program stored in the memory 140 to implement information storage or processing.
[0104] The input unit 120 provides input to the CPU 100. The input unit 120 is, for example, a key or a touch input device. The power supply 170 is used to provide power to the electronic device 600. The display 160 is used to display display objects such as images and text. The display may be, for example, an LCD display, but is not limited thereto.
[0105] The memory 140 may be a solid-state memory, such as a read-only memory (ROM), a random access memory (RAM), a SIM card, etc. It may also be a memory that saves information even when the power is off, can be selectively erased, and is provided with more data, examples of which are sometimes referred to as ERPOMs, etc. The memory 140 may also be some other type of device. The memory 140 includes a buffer memory 141 (sometimes referred to as a buffer). The memory 140 may include an application / function storage unit 142, which is used to store application programs and function programs or processes for executing the operation of the electronic device 600 through the central processor 100.
[0106] The memory 140 may also include a data storage unit 143 for storing data, such as contacts, digital data, pictures, sounds, and / or any other data used by the electronic device. The driver storage unit 144 of the memory 140 may include various drivers for communication functions of the electronic device and / or for executing other functions of the electronic device (such as messaging applications, address book applications, etc.).
[0107] The communication module 110 is a transmitter / receiver that transmits and receives signals via the antenna 111. The communication module 110 (transmitter / receiver) is coupled to the central processor 100 to provide input signals and receive output signals, which may be the same as the case of a conventional mobile communication terminal.
[0108] Based on different communication technologies, multiple communication modules 110 may be provided in the same electronic device, such as a cellular network module, a Bluetooth module and / or a wireless LAN module. The communication module 110 (transmitter / receiver) is also coupled to a speaker 131 and a microphone 132 via an audio processor 130 to provide an audio output via the speaker 131 and receive an audio input from the microphone 132, thereby realizing a common telecommunication function. The audio processor 130 may include any suitable buffer, decoder, amplifier, etc. In addition, the audio processor 130 is also coupled to the central processor 100, so that recording can be performed on the local machine through the microphone 132, and the sound stored on the local machine can be played through the speaker 131.
[0109] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0110] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0111] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0112] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0113] The present invention uses specific embodiments to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A time series data prediction method based on improved quadratic exponential smoothing, characterized in that: The method comprises: Regularly obtain historical time series data and determine whether the amount of historical time series data meets the prediction conditions; In response to the amount of the historical time series data satisfying a prediction condition, obtaining a fitting curve of the historical time series data based on a quadratic exponential smoothing method; Eliminate data whose difference value with the fitting curve is greater than a preset threshold from the historical time series data; Correct the fitting curve after removing the difference data; Obtain the forecast value of time series data N days later based on the established business rules and the modified fitting curve; Within the set time period before N days, determine whether the predicted value of the time series data meets the set conditions. If so, perform corresponding business operations. If not, correct the horizontal smoothing coefficient and trend smoothing coefficient in the quadratic exponential smoothing method.
2. The time series data prediction method based on improved quadratic exponential smoothing as claimed in claim 1, characterized in that: The method further includes: dynamically adjusting the preset threshold value by using the moving average and standard deviation of the historical time series data within a set time period.
3. The time series data prediction method based on improved quadratic exponential smoothing as claimed in claim 1, characterized in that: The fitting curve after correcting and eliminating the difference data includes: Use the historical time series data after removing the difference data to re-fit the curve; The refitted curves were smoothed to reduce the fluctuations introduced by the removed data.
4. The time series data prediction method based on improved quadratic exponential smoothing as claimed in claim 1, characterized in that: The method of obtaining the predicted value of the time series data after N days according to the established business rules and the modified fitting curve includes: Predict the time series data N days later based on the horizontal smoothing and trend smoothing of the modified fitting curve; The predicted time series data is adjusted according to the established business rules to obtain the predicted value of the time series data N days later.
5. The time series data prediction method based on improved quadratic exponential smoothing according to claim 1, characterized in that: The determining whether the predicted value of the time series data meets the set condition includes: Determine whether the absolute value of the difference between the predicted value and the actual value of the time series data is less than a preset threshold, or determine whether the ratio between the predicted value and the actual value of the time series data is within a set range.
6. The time series data prediction method based on improved quadratic exponential smoothing as claimed in claim 5, characterized in that: If the above is not satisfied, the horizontal smoothing coefficient and trend smoothing coefficient in the modified quadratic exponential smoothing method include: If the absolute value of the difference is greater than the preset threshold, continue to judge whether the predicted value is lower than the actual value. If it is lower than the actual value, increase the horizontal smoothing coefficient; if it is higher than the actual value, reduce the horizontal smoothing coefficient; and judge whether the predicted value has multiple consecutive prediction errors in the same direction. If the predicted value is lower than the actual value for multiple consecutive times, increase the trend smoothing coefficient; if the predicted value is higher than the actual value for multiple consecutive times, reduce the trend smoothing coefficient; Or if the ratio is not within the set range, continue to judge whether the predicted value is lower than the actual value. If it is lower than the actual value, increase the horizontal smoothing coefficient; if it is higher than the actual value, reduce the horizontal smoothing coefficient; and judge whether the predicted value has multiple consecutive prediction errors in the same direction. If the predicted value is lower than the actual value for multiple consecutive times, increase the trend smoothing coefficient; if the predicted value is higher than the actual value for multiple consecutive times, reduce the trend smoothing coefficient.
7. A time series data prediction device based on improved quadratic exponential smoothing, characterized in that: The device comprises: A historical data acquisition unit, used to periodically acquire historical time series data and determine whether the amount of historical time series data meets the prediction conditions; A fitting curve acquisition unit, configured to obtain a fitting curve of the historical time series data based on a quadratic exponential smoothing method in response to the amount of the historical time series data satisfying a prediction condition; A data elimination unit, used to eliminate data whose difference value with the fitting curve is greater than a preset threshold from the historical time series data; A curve correction unit, used to correct the fitting curve after eliminating the difference data; A prediction unit is used to obtain the predicted value of the time series data N days later according to the established business rules and the modified fitting curve; A judgment unit, used to judge whether the predicted value of the time series data meets a set condition within a set time period before N days; A business operation unit is used to perform corresponding business operations when set conditions are met; The coefficient correction unit is used to correct the horizontal smoothing coefficient and the trend smoothing coefficient in the quadratic exponential smoothing method when the set conditions are not met.
8. The time series data prediction device based on improved quadratic exponential smoothing as claimed in claim 7, characterized in that: The device also includes: a threshold adjustment unit, which is used to dynamically adjust the preset threshold using the moving average and standard deviation of the historical time series data within a set time period.
9. The time series data prediction device based on improved quadratic exponential smoothing as claimed in claim 7, characterized in that: The curve correction unit comprises: The refitting module is used to refit the curve using the historical time series data after removing the difference data; The smoothing module is used to smooth the refitted curve to reduce the fluctuation introduced by eliminating data.
10. The time series data prediction device based on improved quadratic exponential smoothing according to claim 7, characterized in that: The prediction unit comprises: The prediction module predicts the time series data N days later based on the horizontal smoothing and trend smoothing of the modified fitting curve; The prediction value adjustment module is used to adjust the predicted time series data according to the established business rules to obtain the predicted value of the time series data after N days.
11. The time series data prediction device based on improved quadratic exponential smoothing according to claim 7, characterized in that: The judgment unit is specifically used to: judge whether the absolute value of the difference between the predicted value and the actual value of the time series data is less than a preset threshold, or judge whether the ratio between the predicted value and the actual value of the time series data is within a set range.
12. The time series data prediction device based on improved quadratic exponential smoothing according to claim 11, characterized in that: The coefficient correction unit is specifically used for: if the absolute value of the difference is greater than a preset threshold, then continue to judge whether the predicted value is lower than the actual value, if it is lower than the actual value, increase the horizontal smoothing coefficient, if it is higher than the actual value, reduce the horizontal smoothing coefficient, and judge whether the prediction error of the predicted value is in the same direction for multiple consecutive times, if the predicted value is lower than the actual value for multiple consecutive times, increase the trend smoothing coefficient, if the predicted value is higher than the actual value for multiple consecutive times, reduce the trend smoothing coefficient; or if the ratio is not within the set range, then continue to judge whether the predicted value is lower than the actual value, if it is lower than the actual value, increase the horizontal smoothing coefficient, if it is higher than the actual value, reduce the horizontal smoothing coefficient, and judge whether the prediction error of the predicted value is in the same direction for multiple consecutive times, if the predicted value is lower than the actual value for multiple consecutive times, increase the trend smoothing coefficient, if the predicted value is higher than the actual value for multiple consecutive times, reduce the trend smoothing coefficient.
13. 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 6 are implemented.
14. A computer-readable storage medium having a computer program stored thereon, 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 6 are implemented.
15. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Cited By
Floating platform tide gauge method based on offshore GNSS data
CN119807956A
