A Time Series Forecasting Method Based on Optimized Trend Fuzzy Granularization and Related Equipment
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-21
- Publication Date
- 2026-08-14
AI Technical Summary
[0003]本申请提供一种基于优化趋势模糊粒化的时间序列预测方法及其相关设备,以解决现有技术中所存在的一个或多个技术问题,至少提供一种有益的选择或创造条件,能够有效解决现有技术中异常值和短期波动干扰导致趋势识别扭曲及预测性能下降的问题,通过融合混合整数二次规划趋势提取与模糊粒化Bootstrap集成策略,显著提升时间序列预测的鲁棒性与准确性
[0014]本申请的有益效果是:本申请提供一种基于优化趋势模糊粒化的时间序列预测方法及其相关设备,首先通过构建混合整数二次规划模型将趋势提取转化为求解分段线性趋势的优化问题,利用最小化原始观测值与拟合趋势值的偏差平方和以及趋势段数量的惩罚项之和,能够精准剥离数据中的噪声干扰并提取出稳健的线性趋势信息;在此基础上,引入高斯线性模糊信息粒计算各观测值属于所述线性趋势的隶属度,并将其作为Bootstrap重采样的概率分布对原始时间序列进行重采样,这种机制确保了生成的多个衍生训练集能够有效保留并强化数据中潜在的趋势结构特征;最后结合LSTM神经网络强大的非线性拟合能力,通过对多个基模型的预测结果取平均值进行集成,不仅克服了单一模型在复杂波动环境下的不稳定性,还显著降低了过拟合风险,从而大幅提升了时间序列预测的整体准确性与鲁棒性。本申请还提供了上述方法的相关设备,相关设备的有益效果跟方法类似,在此不再赘述。
Smart Images

Figure CN122570867A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of machine learning technology, and in particular to a time series prediction method and related equipment based on optimized trend fuzzy granularization. Background Technology
[0002] In the field of time series forecasting, to enhance the interpretability of machine learning models, existing technologies combine trend extraction techniques with machine learning models. However, existing trend-based time series forecasting methods are often affected by outliers and fluctuations when processing data. These disturbances not only distort trend identification but also significantly reduce forecasting performance. This is especially true when outliers occur consecutively within a short period, such as short-term traffic flow anomalies caused by accidents or short-term shocks to stock prices from unexpected events. While these temporary anomalies do not reflect the underlying trend of the time series, their impact on forecasting is often more significant than that of isolated outliers. Furthermore, traditional bootstrap sampling methods have limitations when processing time-varying series, failing to effectively preserve linear trend information in the data, thus affecting the robustness and accuracy of the forecasting model. Summary of the Invention
[0003] This application provides a time series forecasting method and related equipment based on optimized trend fuzzy granulation to solve one or more technical problems existing in the prior art, and at least provides a beneficial option or creates conditions that can effectively solve the problems of trend recognition distortion and prediction performance degradation caused by outliers and short-term fluctuations in the prior art. By integrating mixed integer quadratic programming trend extraction with fuzzy granulation Bootstrap integration strategy, the robustness and accuracy of time series forecasting are significantly improved.
[0004] On the one hand, this application provides a time series forecasting method based on optimized trend fuzzy granularization, including the following steps: Step S100: Construct a mixed-integer quadratic programming model to transform the time series trend extraction problem into an optimization problem of solving piecewise linear trends. By minimizing the sum of squared deviations between the original observations and the fitted trend values, as well as the sum of penalty terms for the number of trend segments, linear trend information in the time series is extracted. The mixed-integer quadratic programming model includes an objective function and constraints. Step S200: Based on Gaussian linear fuzzy information particles, calculate the membership degree of each observation in the time series belonging to the linear trend; Step S300: Use the membership degree as the probability distribution of Bootstrap resampling to resample the original time series and generate multiple derived training sets containing trend structures; Step S400: Construct an LSTM neural network model and train multiple LSTM base models using the multiple derived training sets respectively; Step S500: The prediction results of multiple LSTM base models are averaged and integrated to obtain the final time series prediction result.
[0005] Furthermore, in step S100, the construction logic of the objective function is as follows: Based on the sum of squares of the differences between the observed values and the corresponding fitted trend values of the original time series at each time point, a penalty term is added to the product of a preset penalty parameter and the number of trend segments to seek the minimum value of this sum. The expression for the objective function is: ; in, Let the objective function be... For the original time series at time... The observed values, For a moment The fitted trend value, The total length of the time series. The default penalty parameters are... This is the maximum number of preset trend segments.
[0006] Furthermore, the constraints in step S100 include linear trend relationship constraints, trend segment uniqueness constraints, trend segment boundary constraints, and parameter value range constraints. in: The linear trend relationship constraint satisfies the following formula: ; ; in, The intercept parameter is for a linear trend. The slope parameter represents the linear trend. It is a large constant that is much larger than the range of values in the time series; For binary variables, At that moment Belongs to the During a trend period, Thus satisfying the linear trend relationship ; The trend segment uniqueness constraint is used to ensure that each observation in the original time series is assigned to only one trend segment, satisfying the following formula: ; The specific logic of the trend segment boundary constraint is as follows: restricting the time interval of the observed values. It must be located at the starting point of this trend segment. After and the termination point Previously, the following formula was satisfied: ; ; in, ; The parameter value range constraint is used to limit the numerical range of the fitted trend value and its linear parameters, and its specific logic satisfies the following formula: ; ; ; in, and These represent the minimum and maximum values in the time series, respectively. and This represents the minimum and maximum slopes between any two adjacent points in a time series.
[0007] Furthermore, the membership degree of the Gaussian linear fuzzy information granules in step S200 is calculated as follows: Using a Gaussian membership function, the distance deviation between the observed value and the core line of the trend segment to which the observed value belongs is calculated; The membership degree decreases exponentially as the distance deviation increases, and the rate of decrease is controlled by the variance parameter within the trend segment. The core line is determined by the change of the intercept and slope parameters of the trend segment over time.
[0008] Furthermore, the specific process of Bootstrap resampling in step S300 is as follows: For each observation, the probability of it being selected into the bootstrap sample is proportional to its corresponding membership degree; During the generation of each derived training set, a determination is made for the observation value at each time step: if the observation value is selected according to the probability, the original observation value at that time step is retained; if it is not selected, the trend fitting value corresponding to that time step is used as a substitute. By repeating the above process, several independent derivative training sets are generated.
[0009] Furthermore, before step S100, a preprocessing step of the original time series is included: When the maximum number of preset trend segments exceeds the preset threshold, a bottom-up fusion algorithm is used to approximate the solution of the trend segments in order to reduce the computational complexity of the model. The fusion algorithm iteratively calculates the merging loss of adjacent trend segments, selects the adjacent trend segment with the smallest merging loss for merging operation, until the current number of trend segments is reduced to the preset maximum number L of trend segments.
[0010] Furthermore, in step S500, the specific method for averaging and integrating the prediction results of multiple LSTM base models to obtain the final time series prediction result is as follows: The predicted output values of all trained LSTM base models for the same input data are summed and divided by the total number of LSTM base models involved in the integration to obtain the final arithmetic mean prediction value.
[0011] On the other hand, this application provides a time series forecasting system based on optimized trend fuzzy granularization, comprising: The trend extraction module is configured to: construct a mixed-integer quadratic programming model to transform the time series trend extraction problem into an optimization problem of solving piecewise linear trends; and extract linear trend information from the time series by minimizing the sum of squared deviations between the original observations and the fitted trend values, as well as the sum of penalty terms for the number of trend segments; wherein, the mixed-integer quadratic programming model includes an objective function and constraints. The granular calculation module is configured to: calculate the membership degree of each observation in the time series to the linear trend based on Gaussian linear fuzzy information granules; The sample generation module is configured to: use the membership degree as the probability distribution of Bootstrap resampling, resample the original time series, and generate multiple derived training sets containing trend structures; The model training module is configured to: construct an LSTM neural network model and train multiple LSTM base models using multiple derived training sets respectively; The prediction ensemble module is configured to: average the prediction results of multiple LSTM base models and integrate them to obtain the final time series prediction result.
[0012] On the other hand, this application provides a computer device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the aforementioned time series forecasting method based on optimized trend fuzzy granularization.
[0013] On the other hand, this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the aforementioned time series forecasting method based on optimized trend fuzzy granularization.
[0014] The beneficial effects of this application are as follows: This application provides a time series forecasting method and related equipment based on optimized trend fuzzy granulation. First, by constructing a mixed-integer quadratic programming model, trend extraction is transformed into solving an optimization problem of piecewise linear trends. By minimizing the sum of squared deviations between the original observations and the fitted trend values, as well as the sum of penalty terms for the number of trend segments, noise interference in the data can be accurately removed and robust linear trend information can be extracted. On this basis, Gaussian linear fuzzy information granules are introduced to calculate the membership degree of each observation to the linear trend, and this is used as the probability distribution for Bootstrap resampling to resample the original time series. This mechanism ensures that the generated multiple derived training sets can effectively retain and strengthen the potential trend structure features in the data. Finally, combined with the powerful nonlinear fitting capability of LSTM neural networks, the average prediction results of multiple base models are integrated, which not only overcomes the instability of a single model in complex fluctuation environments, but also significantly reduces the risk of overfitting, thereby greatly improving the overall accuracy and robustness of time series forecasting. This application also provides related equipment for the above method. The beneficial effects of the related equipment are similar to those of the method, and will not be elaborated here.
[0015] Other features and advantages of this application will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the application. The objectives and other advantages of this application may be realized and obtained by means of the structures particularly pointed out in the description, claims and drawings. Attached Figure Description
[0016] The accompanying drawings are provided to further understand the technical solutions of the present invention and constitute a part of the specification. They are used together with the embodiments of the present invention to explain the technical solutions of the present invention, and do not constitute a limitation on the technical solutions of the present invention.
[0017] Figure 1 This is a flowchart of the time series forecasting method based on optimized trend fuzzy granularization provided in this application; Figure 2 The number of segments provided in this application Example of optimal trend extraction at that time; Figure 3 This is an example diagram showing the distribution of the membership degree of the time series observations provided in this application relative to their trend values; Figure 4 This is a schematic diagram of the framework principle of the time series forecasting method based on optimized trend fuzzy granularization provided in this application; Figure 5 This is a schematic diagram of the stock market index dataset provided in this application; Figure 6 This is a schematic diagram of the classic benchmark dataset provided in this application; Figure 7 This is a schematic diagram comparing the TFGB time series forecasting method based on optimized trend fuzzy granularization provided in this application with related methods under multiple evaluation indicators; Figure 8 This is a schematic diagram comparing the TFGB time series forecasting method based on optimized trend fuzzy granularization provided in this application with methods in the literature under multiple evaluation indicators; Figure 9 This is a schematic diagram of the Nemenyi test results of the TFGB time series prediction method based on optimized trend fuzzy granulation and related methods provided in this application; Figure 10 This is a schematic diagram of the Nemenyi test results of the time series prediction method TFGB based on optimized trend fuzzy granulation provided in this application and the method in the literature; Figure 11 This is a schematic diagram of the evaluation index results under different prediction step sizes provided in this application; Figure 12 This is a schematic diagram of the Nemenyi test results for different prediction step sizes provided in this application; Figure 13 This is a structural diagram of the time series forecasting method based on optimized trend fuzzy granulation provided in this application. Detailed Implementation
[0018] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0019] The present application will be further described below with reference to the accompanying drawings and specific embodiments. The described embodiments should not be considered as limitations on the present application, and all other embodiments obtained by those skilled in the art without inventive effort are within the scope of protection of the present application.
[0020] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0021] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0022] In the field of time series forecasting, the existing technical framework is mainly composed of two pillars: traditional statistical methods and modern machine learning methods. Traditional statistical methods, such as autoregressive integral moving average models and exponential smoothing, have dominated certain areas due to their solid mathematical foundations. The core logic of these methods lies in making strict prior assumptions about the intrinsic structure of the time series, such as assuming that the data satisfies the requirement of stationarity or follows a specific statistical distribution. While this assumption-based modeling approach gives the model good interpretability and makes its logical chain clear and transparent, its fatal weakness lies in its lack of generalization ability. When faced with complex, variable, nonlinear, and noisy data environments in the real world, such as stock price sequences in financial markets that are subject to sudden news shocks or complex periodic fluctuations in internet traffic, traditional statistical methods often perform poorly because they cannot meet their strict mathematical assumptions, and the prediction accuracy drops sharply.
[0023] To overcome the limitations of traditional statistical methods, researchers have turned to data-driven machine learning methods, such as deep learning. These methods, especially recurrent neural network models like Long Short-Term Memory (LSTM) networks, demonstrate powerful function fitting capabilities through nonlinear transformations of massive numbers of parameters. They can automatically learn complex feature representations and long-term dependencies from historical data without making strict mathematical assumptions about the data distribution, thus achieving superior accuracy compared to traditional methods in many prediction tasks. However, machine learning methods are not a panacea and also have significant inherent limitations.
[0024] First, these models are highly susceptible to overfitting, meaning they perform perfectly on the training set but generalize very poorly to unseen test data, especially when training data is limited or noisy. Second, deep learning models are often considered "black box" models, lacking transparency in their internal decision-making processes and exhibiting low interpretability. This "knowing what but not why" characteristic limits their application in high-risk fields such as financial risk control and medical diagnosis, because in these scenarios, decision-makers need not only to predict outcomes but also to understand the underlying logic.
[0025] To address the issue of poor interpretability in machine learning models, a hybrid modeling paradigm integrating trend extraction and machine learning has emerged in existing technologies. This approach attempts to decompose time series data into trend, periodic, and residual components, using machine learning models to specifically handle the difficult-to-model residual portion. While this approach is theoretically sound, it has encountered new bottlenecks in practical engineering applications.
[0026] Most existing trend extraction methods rely on simple techniques such as moving averages or empirical mode decomposition. These methods are extremely vulnerable when faced with data containing outliers and sharp fluctuations. Outliers and short-term volatility often severely interfere with the trend identification process, causing the extracted trend lines to be distorted and unable to accurately reflect the underlying trend of the data.
[0027] In particular, when data shows continuous short-term anomalies caused by sudden events, such as a surge in traffic on an e-commerce platform during Singles' Day or a sudden drop in traffic caused by a natural disaster in a certain area, these temporary disturbances, although they do not reflect the long-term evolution of the sequence, can strongly mislead existing trend extraction algorithms, and then transmit this erroneous trend perception to subsequent prediction models, resulting in a significant decline in the final prediction performance.
[0028] Furthermore, existing ensemble learning techniques have significant limitations when processing time-varying sequences. Traditional bootstrap sampling methods typically assume that samples are independent of each other, generating multiple training sets through random sampling with replacement. However, time series data exhibits significant temporal dependencies, meaning that the current value is often closely related to past values. Traditional bootstrap sampling methods, by randomly shuffling the data order, easily destroy this valuable temporal structure and linear trend information, causing the generated training sets to lose the dynamic evolution characteristics of the original data.
[0029] The predictive power of a base model trained on such a distorted training set is naturally greatly reduced, failing to effectively capture the long-term trend of the time series, thus affecting the robustness and accuracy of the entire ensemble prediction system. In summary, existing technologies face a series of pressing technical challenges when dealing with complex time series, including overly strong statistical assumptions, overfitting and lack of interpretability in machine learning methods, susceptibility to interference in trend extraction, and the disruption of time series structure by traditional sampling.
[0030] To address the aforementioned issues, this application provides a time series forecasting method and related equipment based on optimized trend fuzzy granularization. It constructs a forecasting framework that deeply integrates mathematical optimization, fuzzy logic, and deep learning. First, by establishing a mixed integer quadratic programming model, the extraction of time series trends is transformed into an optimization problem of solving piecewise linear trends. By utilizing the dual constraints of minimizing the sum of squared deviations and the penalty term for the number of trend segments, data noise is accurately removed and robust linear trend information is extracted.
[0031] Building upon this foundation, Gaussian linear fuzzy information granules are innovatively introduced to calculate the membership degree of each observation to the linear trend. This membership degree is then used as the probability distribution for Bootstrap resampling to resample the original sequence, thereby generating multiple derivative training sets that effectively preserve and enhance the underlying trend structure. Finally, by combining the powerful nonlinear fitting capability of Long Short-Term Memory networks, the average prediction results of multiple base models are integrated and output. This not only effectively overcomes the problem of outlier interference in trend identification in traditional methods but also solves the problem of conventional sampling destroying the temporal structure, significantly improving the accuracy and robustness of time series prediction in complex environments.
[0032] It should be noted that trend extraction is one of the most critical steps in long-term time series forecasting, and its purpose is to capture the inherent patterns of change in the data that are often obscured by noise or short-term fluctuations. Existing trend extraction methods include mean smoothing, transformation and filtering techniques, global and local regression (
[29] ), and decomposition methods. The idea of extracting trends by establishing a mixed integer optimization model in this application is derived from the filtering method. The implementation process of the filtering method is as follows.
[0033] Given a one-dimensional time series The goal of trend filtering is to extract a time series. To satisfy the following optimization problem: (1); In formula (1), Representing time series of Order difference. When and When this happens, the filter degenerates into a total variation filter. and At that time, the filter is Trend filter. When and At this point, the filter is a Hodrick-Prescott filter. From a modeling perspective, the trend filter function consists of two parts. The first part is called the data fitting term, which is used to measure the original sequence. With extraction trend The difference between them. The second part is the smoothing penalty term, which is used to penalize the degree of change in the linear trend. For the given penalty parameter. When When the value is larger, the resulting trend will be smoother; when When the value is smaller, the resulting trend will be closer to the original data points.
[0034] It should also be noted that information granulation refers to the process of dividing a dataset into several information granules, each containing a set of data points with certain common characteristics. This technique achieves an abstraction process, allowing the model to focus on the main features of the data while reducing complexity. Information granules can capture the core information of the data, making it easier to process in subsequent calculations.
[0035] Given that linear trends are simple in form, have low computational complexity, and their parameters are highly interpretable, this paper uses Gaussian Linear Fuzzy Information Granules (GLIG) to perform granular modeling of time series. The membership function of GLFIG is defined by the following formula (2); (2); in, The core line representing GLFIG. Measures the degree of deviation of observed data points from the core line. Interval This indicates the time range for constructing information granules. By applying GLFIG, time series data can be represented in a granular form, reducing data complexity while preserving linear trend characteristics.
[0036] It's also worth noting that Bagging is short for Bootstrap Aggregating, a commonly used ensemble learning technique. This method improves the stability and prediction accuracy of machine learning models by reducing variance and preventing overfitting. Bagging mainly consists of three steps: First, Bootstrap resampling, which generates multiple derived training sets by randomly sampling the original dataset with replacement; second, model training, which trains an independent model for each derived training set obtained through Bootstrap sampling; and third, ensemble the predictions, which averages the predictions from all models to obtain the final prediction. It's important to note that Bootstrap sampling assumes that data points are independent. However, in time series data, observations often exhibit serial correlation, especially in the case of time-varying series, making this independence assumption difficult to satisfy.
[0037] It's also important to note that LSTM networks are a special type of recurrent neural network (RNN) designed to process sequential data, particularly suitable for scenarios with long-term dependencies. Compared to standard RNNs, LSTMs control the flow of information within the network by introducing memory units and gating mechanisms, enabling them to learn both short-term and long-term dependencies simultaneously. An LSTM network consists of a series of neural units, each containing three key components: an input gate, a forget gate, and an output gate. These gate structures regulate the flow of time-series information within the unit, allowing the network to determine which information to retain, which outliers or temporary disturbances to discard, and how to update hidden trend information. This gating mechanism enables LSTMs to retain and utilize key information in longer sequences, thus demonstrating excellent performance in time series forecasting tasks.
[0038] First, the time series prediction method based on optimized trend fuzzy granularization provided in the embodiments of this application will be described in detail below with reference to the accompanying drawings.
[0039] Reference Figure 1 The implementation process of the time series prediction method based on optimized trend fuzzy granulation provided in this application includes, but is not limited to, the following steps.
[0040] Step S100: Construct a mixed integer quadratic programming model to transform the time series trend extraction problem into an optimization problem of solving piecewise linear trends. By minimizing the sum of squared deviations between the original observations and the fitted trend values, as well as the sum of penalty terms for the number of trend segments, linear trend information in the time series is extracted.
[0041] The Mixed Integer Quadratic Programming (MIQP) model includes an objective function and constraints.
[0042] In step S100, the traditional approach to trend extraction is fundamentally changed. By constructing a mixed-integer quadratic programming model, the originally complex problem of time series trend extraction is transformed into a rigorous mathematical optimization problem. By setting the objective function and constraints, the process of solving for piecewise linear trends is formalized into a process of finding the optimal solution.
[0043] Specifically, this model ensures that the extracted trend line closely approximates the true trend of the data by minimizing the sum of squared deviations between the original observations and the fitted trend values. It also introduces a penalty term for the number of trend segments to avoid overfitting noise, thus achieving an optimal balance between smoothing data fluctuations and preserving key trend inflection points. This method can accurately remove noise interference from the data, extracting robust and representative linear trend information from massive and complex datasets, laying a solid mathematical foundation for subsequent refined predictions.
[0044] Step S200: Based on Gaussian linear fuzzy information particles, calculate the membership degree of each observation in the time series belonging to the linear trend.
[0045] In step S200, an innovative tool, Gaussian linear fuzzy information granules, is introduced to quantify the correlation between each observation in the time series and the extracted linear trend. By calculating the membership degree of each observation to the linear trend, the absolute judgment of "belongs" or "does not belong" in traditional binary logic is transformed into a continuous description of "to what extent it belongs" in fuzzy logic. This processing method can delicately characterize the importance weight of data points in the trend structure, effectively identify and weaken the interference of outliers on the overall trend, and at the same time strengthen the signal of true trend points.
[0046] Through this fuzzy granular processing, the originally messy numerical data is transformed into information granules with clear semantic features. This not only significantly reduces the complexity of the data but also preserves the inherent structured features of the data, providing high-quality feature representations for subsequent model training.
[0047] Step S300: Using the membership degree as the probability distribution for Bootstrap resampling, the original time series is resampled to generate multiple derived training sets containing trend structures.
[0048] In step S300, the membership degree calculated in the previous step is transformed into the probability distribution of Bootstrap resampling, thereby guiding the resampling process of the original time series. This breaks the inherent pattern of equal probability of sample occurrence in traditional bootstrap sampling methods, giving the resampling process a clear direction and structure.
[0049] By using membership degrees as sampling probabilities, this method ensures that the generated derivative training sets are not simply random copies of the original data, but rather highly condensed and representative samples that enhance the potential trend structure in the original sequence. This trend-importance-based resampling strategy effectively preserves the dynamic evolution characteristics of time series and avoids the problem of traditional methods potentially destroying temporal dependencies when randomly shuffling data. It provides a diverse and high-quality training environment for building predictive models with strong trend-capturing capabilities.
[0050] Step S400: Construct an LSTM neural network model and train multiple LSTM base models using multiple derived training sets.
[0051] In step S400, an LSTM neural network model is constructed, and it is trained in a distributed manner using multiple derivative training sets containing trend structures generated in the previous step. This fully leverages the unique advantages of the LSTM model in processing sequence data, namely, effectively capturing long-term dependencies and nonlinear dynamic features in time series through its internal gating mechanism.
[0052] By training multiple LSTM base models using multiple derived training sets, this method achieves preliminary model ensemble, enabling each base model to learn different local features and noise patterns of the data while preserving common trends. This training strategy not only enhances the model's ability to fit complex time-varying sequences but also reduces the risk of overfitting that may occur with a single model by introducing diversity, providing rich and complementary predictive perspectives for the final ensemble prediction.
[0053] Step S500: The prediction results of multiple LSTM base models are averaged and integrated to obtain the final time series prediction result.
[0054] In step S500, the prediction results of multiple LSTM base models are integrated and averaged to obtain the final time series prediction result. This ensemble learning approach smooths the prediction errors of each base model, significantly improving the stability and accuracy of the predictions. Since each base model is trained on different derived training sets, their prediction biases for unknown data are random. Averaging these prediction results effectively offsets some random errors while preserving common prediction trends. This simple linear ensemble strategy is not only computationally efficient but also significantly reduces model variance, enhancing the robustness of the entire prediction system and enabling it to provide more reliable and stable prediction outputs in complex and ever-changing real-world application scenarios.
[0055] In some embodiments of this application, in step S100, the construction logic of the objective function is as follows: based on the sum of squares of the differences between the observed values of the original time series at each time point and the corresponding fitted trend values, a penalty term consisting of a preset penalty parameter and the product of the number of trend segments is added to seek the minimum value of the sum.
[0056] Specifically, this application transforms the trend extraction process of time series into a rigorous mixed-integer quadratic programming optimization problem by constructing an objective function. The objective function uses the sum of squares of the deviations between the actual observed values of the original time series at each time point and the trend values fitted by the model as the basic term. This design aims to force the generated piecewise linear trend to closely approximate the true trend of the data, ensuring that the fitting results accurately reflect the overall evolution of the original data numerically.
[0057] Building upon this foundation, the objective function innovatively introduces a penalty term—the product of a preset penalty parameter and the number of trend segments—and aims to minimize the sum of these two factors as the final solution objective. The core significance of introducing this penalty term lies in effectively constraining the model's complexity, preventing the algorithm from generating excessive trend segments to overly cater to every tiny fluctuation or random noise in the data. By adjusting the magnitude of the penalty parameter, this method can find the optimal balance between pursuing fitting accuracy and maintaining trend simplicity, thereby automatically selecting the most representative key turning points and eliminating redundant segment information. This construction logic, which balances goodness of fit and model simplicity, not only significantly improves the robustness and anti-interference ability of trend extraction but also fundamentally avoids overfitting, laying a solid mathematical foundation for subsequent predictive modeling based on high-quality trend information.
[0058] In some embodiments of this application, the objective function is expressed as the following formula (3): (3); in, Let be the objective function. For the original time series at time... The observed values, For a moment The fitted trend value, The total length of the time series. The preset penalty parameters can be set as follows: Standard deviation; This is the maximum number of preset trend segments.
[0059] The first part of the above formula This represents the sum of squared residuals between the observed values and the fitted trend values of the original time series at each time point. This term, as a fidelity term, strictly constrains the fitted piecewise linear trend to closely approximate the true trend of the original data, ensuring that the model does not lose key evolutionary information contained in the data. The second part of the formula... This introduces a regularization mechanism, where a preset penalty parameter is used. Maximum number of trend segments The multiplication term constitutes a penalty term, which limits the complexity of the model and prevents the algorithm from generating too many trend segments to accommodate every tiny fluctuation or random noise in the data, thus avoiding overfitting. Furthermore, the penalty term also reflects the number of parameters that need to be estimated in a piecewise linear model. A continuous piecewise linear model requires 2^36 parameters to be estimated. The non-continuous piecewise linear model is 3 .
[0060] By seeking the minimum of the sum of these two factors, the objective function cleverly establishes a dynamic balance between fitting accuracy and model simplicity, so that the final extracted trend can not only accurately reflect the long-term trend of the data, but also has a clear and robust piecewise linear structure, providing a high-quality feature foundation for subsequent predictive modeling.
[0061] In some embodiments of this application, the constraints in step S100 include linear trend relationship constraints, trend segment uniqueness constraints, trend segment boundary constraints, and parameter value range constraints, which are used to limit the variable space when solving discontinuous or continuous piecewise linear trends.
[0062] In some embodiments of this application, the linear trend constraint is used to: force the observation to satisfy the linear equation of the trend segment when it is determined that the observation belongs to a certain trend segment; and release the constraint of the linear equation when it is determined that the observation does not belong to the trend segment. Its specific logic satisfies the following formulas (4) and (5): (4); (5); in, The intercept parameter is for a linear trend. The slope parameter represents the linear trend. A large constant, much larger than the range of values in the time series, is used as a relaxation term; For binary variables, At that moment Belongs to the During a trend period, Thus satisfying the linear trend relationship .
[0063] When it is determined that the point does not belong to this segment, the relaxation term is used. This restriction is removed. This mechanism gives the model extremely high flexibility, enabling it to automatically and accurately identify and match the true linear evolution pattern behind each data segment in the process of solving complex mixed-integer quadratic programming problems.
[0064] In some embodiments of this application, the trend segment uniqueness constraint is used to: ensure that each observation in the original time series is assigned to only one trend segment, maintain the rigor and mutual exclusivity of the time series segmentation, and mathematically guarantee that each independent observation in the original time series can only be assigned to a unique trend segment, and there will never be a situation of ambiguous assignment or duplicate calculation.
[0065] The specific logic is as follows: for any moment in the time series, the sum of the binary variables corresponding to all preset trend segments is always equal to 1, satisfying the following formula (6): (6).
[0066] This hard constraint not only ensures that the final extracted piecewise linear trends are structurally clear and non-overlapping, but also provides an accurate data foundation for subsequent feature analysis and modeling based on these trend segments.
[0067] In some embodiments of this application, trend segment boundary constraints are used to: define the time interval range of each trend segment, and ensure that the start and end points of the trend segment match the time of the observed value.
[0068] The specific logic is as follows: utilize the starting point variable of the trend segment. and termination point variables Combined with relaxation terms Limiting the time of observation It must be located after the starting point and before the ending point of the trend segment, satisfying the following formulas (7) and (8): (7); (8); in, In this way, determining the effective time window for a trend segment ensures that the generated segmented trends are continuous, orderly, and consistent with actual physical meaning on the time axis, avoiding trend breaks or misalignments caused by boundary confusion.
[0069] In some embodiments of this application, the parameter value range constraint is used to: limit the numerical range of the fitting trend value and its linear parameters, and prevent abnormal deviations in the solution results. Its specific logic satisfies the following formulas (9), (10) and (11): (9); (10); (11); in, and These represent the minimum and maximum values in the time series, respectively. and This represents the minimum and maximum slopes between any two adjacent points in a time series.
[0070] This effectively prevents the solution from deviating abnormally from common sense. This strict limitation on the numerical range not only significantly reduces the search space of the mixed-integer quadratic programming model and improves the convergence speed and computational efficiency of the algorithm, but also fundamentally avoids the risk of model failure caused by numerical explosion or extreme solutions, ensuring that the final extracted linear trend information has high robustness and engineering application value.
[0071] In some embodiments of this application, with Compared to trend filtering methods, the trend extraction method based on MIQP in this application does not force adjacent trend segments to maintain continuity, while Trend filtering ensures that adjacent trend segments are connected. To ensure continuity, the following constraint can be added to satisfy the following formula (12): (12).
[0072] In some embodiments of this application, a preprocessing step of the original time series is included before step S100: (1) When the maximum number of trend segments L exceeds the preset threshold, a bottom-up fusion algorithm is used to approximate the solution of the trend segments in order to reduce the computational complexity of the model.
[0073] Specifically, in mixed-integer quadratic programming models, an excessive number of allowed trend segments can lead to a surge in decision variables, resulting in enormous computational overhead and even convergence problems. By introducing this preprocessing mechanism, the system can quickly process massive potential segments using lightweight heuristic algorithms before entering the core optimization steps, compressing the originally large and redundant search space to a reasonable size. This not only significantly reduces the computational complexity of subsequent accurate modeling but also effectively avoids engineering implementation difficulties caused by excessively large parameter sizes, ensuring that the entire prediction method maintains millisecond-level response speed and good real-time performance even when dealing with long-period or high-frequency time series data.
[0074] (2) The above fusion algorithm iteratively calculates the merging loss of adjacent trend segments, selects the adjacent trend segment with the smallest merging loss for merging operation, until the current number of trend segments is reduced to the preset maximum number of trend segments. .
[0075] Specifically, a greedy strategy is used to achieve a global approximation of local optima, thereby preserving key trend features while eliminating redundant information to the greatest extent. The algorithm simulates the aggregation process from microscopic details to macroscopic structures. In each iteration, it accurately finds and merges the adjacent line segments with the least differences and the highest homogeneity, ensuring that the sacrificed local fitting accuracy is the least costly in the global scope.
[0076] Through this progressive screening mechanism, the original complex sequence is refined into a set of the most representative backbone trend segments. This not only provides a high-quality initial state that is extremely close to the global optimum for the subsequent mixed-integer quadratic programming model, accelerating the convergence process of the model, but also fundamentally ensures that the extracted trend structure is both concise and clear, and fully covers the main context of data evolution.
[0077] In some embodiments of this application, reference is made to Figure 2 The graph shows the number of segments. Example of optimal trend extraction. In the figure, the original time series data points (black dots) are divided into three consecutive trend segments, each segment being analyzed by a linear regression model. Fitting, boundary points This marks a trend reversal point. The enlarged views in the upper left and lower right corners show the minimum slope. and maximum value The calculation method is to determine the extreme value of the slope of the trend segment by the coordinate difference (Δy / Δt) between the endpoints of adjacent segments, which is used to constrain the slope range of linear fitting during the trend extraction process.
[0078] In addition, the formula in the upper right corner defines the constraints for each segment: ( ), ( ), ( ),in Let be the amplitude of the sequence. This example verifies that the algorithm, through a bottom-up merging strategy, achieves accurate extraction of time series trends while satisfying the constraint on the number of segments.
[0079] In some embodiments of this application, as the number of trend segments increases, especially in the case of high-frequency trend extraction, the proposed optimization problem becomes computationally difficult to handle. Therefore, this application proposes a fusion algorithm for efficient approximate solution. The algorithm's input is: time series... and the number of trend segments ( The output is: trend-fitted sequence The main implementation process of the algorithm is as follows.
[0080] (1) Initialize the current trend segment number. Current trend endpoint set ,in ,..., .
[0081] (2) Perform fitting, for each pair of adjacent trend segments and The two segments are merged, and a linear model is fitted to the merged interval to calculate... The estimated value ,in .
[0082] (3) Conduct an evaluation for all possible segments. Record the losses resulting from the merger: .
[0083] (4) Merge the trend segments, select the pair with the least loss, and update the trend boundary set. And reduce the number of trend segments to .
[0084] (5) Repeat the above process, if If the condition is met, the algorithm terminates; otherwise, return to step (2).
[0085] In the short-term trend merging process, adjacent and similar trend segments are merged to achieve the short-term trend merging objective. The solution obtained by the above fusion algorithm is a feasible solution to the mixed-integer quadratic programming model, that is, it satisfies all the constraints proposed above.
[0086] In some embodiments of this application, the membership degree of the Gaussian linear fuzzy information granules in step S200 is calculated as follows: Step S210: Using a Gaussian membership function, calculate the distance deviation between the observed value and the core line of the trend segment to which the observed value belongs. The core line is determined by the time variation of the intercept and slope parameters of the trend segment.
[0087] In step S210, a precise quantitative benchmark is established for the fuzzy granulation process. This is achieved by employing a Gaussian membership function to first calculate the distance deviation between each observation and the core line of its corresponding trend segment. Here, the core line is the ideal linear trajectory uniquely determined by the time-varying intercept and slope parameters extracted during the optimization phase of the trend segment. In this way, the abstract concept of "trend conformity" is transformed into a concrete numerical distance, enabling an objective measurement of the degree to which actual observed data points deviate from the ideal linear model. This provides a reliable geometric basis for subsequently evaluating the contribution weight of data points to the trend.
[0088] In step S220, the membership degree decreases exponentially with the increase of distance deviation, and the rate of decrease is controlled by the variance parameter within this trend segment.
[0089] In step S220, a smooth and fault-tolerant weight mapping mechanism is constructed. This mechanism stipulates that the membership degree decays exponentially with increasing distance deviation, and the rate of decay is strictly controlled by the variance parameter within the trend segment. It abandons the rigid, either-or judgments of traditional methods, instead utilizing the characteristics of a Gaussian distribution to assign higher membership degrees to observations closer to the core line, while giving extremely low weights to outliers or noise points far from the core. By flexibly adjusting the decay rate through the variance parameter, this method effectively suppresses short-term fluctuations and outlier interference, ensuring that the generated fuzzy information particles can both keenly capture the main trend of the data and possess good noise resistance, thereby significantly improving the quality of the derived training set.
[0090] In some embodiments of this application, an improved Bagging strategy is proposed to enhance the accuracy and robustness of the prediction model. Traditional Bagging methods are based on random sampling with replacement and assume that the data generation process remains constant across observations. However, this assumption does not hold true in many real-world time series. Therefore, a Bagging method is proposed that combines trend fitting results with GLFIG-based membership to guide the sampling process.
[0091] After extracting the trend segments, based on the concept of granular computation, each trend segment is treated as a fuzzy information granule. Each information granule is characterized by its linear parameter, the th... Observations in each trend particle The membership degree is defined as satisfying the following formula (13): (13); In equation (12), Indicates the first Variance within each trend segment. Membership degree Used to measure observed values Belongs to the The degree of membership is used to determine the extent of each trend segment. This membership degree is used for selection during the Bagging process. The probability of.
[0092] In some embodiments of this application, reference is made to Figure 3 The figure shows the time series observations. Membership degree relative to its trend value The distribution of [something]. In the figure, the horizontal axis [is shown]. Representing time points, the vertical axis Represents observed values, vertical axis This represents the membership degree (range [0,1]). The observed value at each time point. For each membership value, a series of Gaussian membership function curves are used, which oscillate periodically around the trend line. Membership reflects the degree of closeness between the observed value and the trend value: when... When approaching the trend value, When close to 1; when deviating from the trend value, The value gradually decreases. This figure visually illustrates the granulation process of Gaussian linear fuzzy information. By measuring membership, it quantifies the degree of "fuzzy attribution" of observations to the trend, providing a probability distribution basis for subsequent Bootstrap sampling.
[0093] In some embodiments of this application, step S300, the Bootstrap resampling process includes the following steps.
[0094] Step S310: For each observation, the probability of it being selected into the bootstrap sample is proportional to its corresponding membership degree.
[0095] In step S310, a trend-importance-based guidance mechanism is introduced into the Bootstrap resampling process, breaking the assumption of randomness in traditional bootstrap methods where all sample points are selected with equal probability. By stipulating that the probability of each observation being selected into the bootstrap sample is proportional to its membership degree calculated in step S200, this step ensures that "high-quality" data points that closely follow the linear trend and contain key evolutionary information have a higher frequency of occurrence during the resampling process. This strategy ensures that the generated derivative training set is no longer a simple random copy of the original data, but rather can selectively retain and strengthen the core trend structure in the time series, thereby providing a data foundation rich in effective features for subsequent model training.
[0096] Step S320: During the generation of each derived training set, a determination is made for the observation value at each time step: if the observation value is selected according to probability, the original observation value at that time step is retained; if it is not selected, the trend fitting value corresponding to that time step is used as a substitute.
[0097] In step S320, a hybrid filling strategy that combines data authenticity and trend integrity is constructed. During the generation of each derived training set, it intelligently determines and processes the observations at each time step. Specifically, if an observation at a certain time step is successfully selected according to the aforementioned probability rules, its original value is directly retained to maintain the true fluctuation details of the data. If the observation is not selected, the system does not simply discard or leave it blank as in traditional methods, but innovatively uses the trend fitting value corresponding to that time step as a substitute. This logic not only ensures the continuity and integrity of the derived training set in the time dimension, but also cleverly uses the fitted value to fill in missing positions, which is equivalent to injecting explicit trend prior knowledge while retaining the original information, greatly enhancing the training set's ability to express potential linear laws.
[0098] Step S330: By repeating the above process, several independent derivative training sets are generated.
[0099] In step S330, by repeatedly performing the aforementioned biased resampling and imputation process, several independent derived training sets are generated in batches, providing a rich and diverse training environment for the base models in the subsequent ensemble learning framework. Since each resampling is an independent random experiment based on a probability distribution, while the generated derived training sets generally reinforce the trend structure, they differ in local details and sample combinations. This diversity is a key prerequisite for ensemble learning to leverage its advantages; it ensures that the multiple LSTM base models trained subsequently learn the evolutionary patterns of the data from different perspectives, thereby effectively reducing the prediction variance of a single model and improving the robustness and generalization ability of the final ensemble prediction results.
[0100] In some embodiments of this application, in step S500, the method of averaging the prediction results of multiple LSTM base models to obtain the final time series prediction result is as follows: the prediction output values of all trained LSTM base models for the same input data are accumulated and divided by the total number of LSTM base models participating in the integration, thereby obtaining the final arithmetic mean prediction value.
[0101] Specifically, the predicted output values of all trained LSTM base models for the same input data are summed and divided by the total number of LSTM base models involved in the ensemble to obtain the final arithmetic mean prediction value. In this way, by calculating the expectation, the model's prediction variance is significantly reduced, thereby improving the robustness and generalization ability of the prediction results.
[0102] Within the framework of ensemble learning, each individually trained LSTM base model may exhibit specific biases due to local noise in the training data or differences in initialization parameters; these biases are often random. By implementing a simple arithmetic averaging strategy, the errors in the positive and negative directions can cancel each other out during the aggregation process, causing the final output value to approach the central trend of all model predictions. This strategy effectively smooths out the potentially drastic fluctuations that may occur in a single model, avoids the risk of overfitting due to overfitting a specific training set, and ensures that the final time series prediction results are not only smoother and more reliable but also more accurately reflect the underlying true evolution patterns of the data.
[0103] The predicted output values of all trained LSTM base models for the same input data are summed and divided by the total number of LSTM base models participating in the integration to obtain the final arithmetic mean prediction value. This achieves unbiased estimation of model predictions and information fusion, constructing a collective intelligence that is superior to any single component.
[0104] Each LSTM base model, when learning on a derived training set, captures specific local features and nonlinear dependencies in the time series, but these captures are often one-sided. The arithmetic average operation is not a simple numerical summation, but an efficient feature fusion mechanism that weights and integrates the heterogeneous knowledge learned by multiple base models from different perspectives.
[0105] Through this integration, the system can comprehensively consider multiple possible evolution paths, rather than being limited to a single specific prediction logic. This not only greatly enhances the model's adaptability to complex, non-stationary time series, but also makes the final integrated prediction results more robust to interference and have higher confidence, thus demonstrating superior predictive performance when facing unknown future data.
[0106] In some embodiments of this application, based on GLFIG, this application proposes the following improved Bagging algorithm, whose input is a time series. and trend-fitted sequences The output is the predicted sequence. The main implementation process of the improved Bagging algorithm is as follows.
[0107] (1) Sampling is performed for each observation. It was selected as the first The probability of a bootstrap sample and its membership degree Directly proportional. If If not selected, its trend fit value will be used. The alternative satisfies the following formulas (14) and (15): (14); (15); in, Indicates the first The first of the self-help samples One observation value.
[0108] (2) Generate containing One self-help training set: Each training set maintains the same trend structure while perturbing the observations according to their membership degree.
[0109] (3) To Train the LSTM model on each training set to obtain the prediction results. .
[0110] (4) The final prediction results are obtained through analysis of... The average of the outputs of the LSTM models is obtained, satisfying the following formula (16): (16).
[0111] The improved Bagging method enhances the temporal dependency structure between observations and ensures that bootstrap samples reflect the underlying trend structure. By introducing a fuzzy granularization mechanism, the probability of selecting representative trend observations is increased, while reducing the impact of outliers or noise on model training.
[0112] In some embodiments of this application, the classic GLFIG membership function is used. Strictly speaking, the form of the membership function directly affects the generation of bootstrap samples, thereby affecting the prediction results. Therefore, this application also proposes an alternative form that removes the definition interval restriction, whose membership function is defined as satisfying the following formula (17): (17); Under this modification, the self-service sample generation process can be expressed as the following formulas (18) and (19): (18); (19); In the above equation (18), the numerator represents Belongs to the Membership degree of each trend segment, denominator represents The sum of membership degrees belonging to all trend segments.
[0113] In some embodiments of this application, reference is made to Figure 4This application presents a framework for a time series forecasting method based on optimized trend fuzzy granulation, showcasing a hybrid forecasting model that integrates trend extraction, fuzzy granulation, and ensemble learning. First, the original time series undergoes trend extraction using a mixed-integer quadratic programming model and a fusion algorithm (MIQP model and Fusion Algorithm), decomposing the complex nonlinear sequence into several linear trend segments to remove noise interference and retain the core structure. Then, Gaussian linear fuzzy information granulation is used to transform the extracted trend into fuzzy information granules, generating a trend-fuzzy granulated sequence. Based on this, a Bagging strategy is employed for sampling, generating multiple sampling training sets based on the Gaussian linear fuzzy information granulation results. Finally, these training sets are input into a Bagging-LSTM model for training. Through parallel learning and result aggregation of multiple LSTM base models, the predicted time series is ultimately output. This framework enhances data interpretability through trend extraction, preserves the underlying structure of data through fuzzy granulation, and improves the generalization ability and stability of the model through Bagging-LSTM, thus achieving high-precision prediction of complex time series.
[0114] In some embodiments of this application, the implementation process of the time series prediction method based on optimized trend fuzzy granularization proposed in this application is as follows: First, the input to the algorithm is defined as a time series. Number of trend segments ( The output is the predicted sequence. ; Secondly, initialize the number of segments. Trend endpoint set ,in .
[0115] Then iterative calculations are performed, when... When traversing the set Each pair of adjacent segments is merged into two segments, a linear model is fitted to the merged interval, and the estimated values of the observations within the merged interval are calculated. The loss is calculated as After the traversal is complete, select the pair of segments with the minimum loss and merge them, then update the trend boundary. Update the number of segments until it is not satisfied End the iteration.
[0116] Based on the above iterative calculation results, a trend-fitting sequence is generated. Calculate the membership degree for each observation. For each observation Set the probability of being selected as follows: ; .
[0117] Furthermore, generating The self-sampling training set is as follows: In each training set Train the LSTM model to obtain the prediction results. .
[0118] Finally, the prediction results are integrated: Output .
[0119] In some embodiments of this application, to verify the effectiveness of the proposed time series forecasting method based on optimized trend fuzzy granularization (TFGB), multiple sets of data were selected for experiments, including six real stock index datasets and four classic benchmark datasets. Stock index data are as follows: Figure 5 As shown, the dataset contains daily closing prices from January 2020 to December 2023 for the Dow Jones Industrial Average (DJI), NASDAQ Composite Index (NASDAQ), S&P 500 Index (SP500), Shanghai Composite Index (SSE), Hang Seng Index (HSI), and Taiwan Stock Exchange Weighted Index (TAIEX). These four classic benchmark datasets are as follows: Figure 6 As shown, the dataset includes Melbourne daily maximum temperature dataset (DMTM), Mackey-Glass time series (MGTS), Zurich monthly sunspot number (ZMSN), and monthly milk production dataset (MMP).
[0120] All datasets were tested for stationarity using the Extended Dickey-Fuller (ADF) test at the 5% significance level. The results are shown in Table 1 below. Two of the six stock indices and four benchmark datasets exhibited non-stationarity, meaning their statistical characteristics (such as mean and variance) changed over time. This violates many fundamental assumptions of traditional time series forecasting methods, further illustrating the necessity of using the method proposed in this application.
[0121] Table 1 Results of Nonstationarity Test
[0122] In some embodiments of this application, in accordance with common practice in the art, the root mean square error (RMSE) is used as the main indicator for evaluating the prediction performance of different methods, satisfying the following formula (20): (20); in, Indicates time The observed values, Indicates the predicted value. The sample size is represented. RMSE reflects both the prediction bias and variance. It should be noted that, since the error term is squared, RMSE imposes a higher penalty on larger errors. To alleviate the sensitivity of RMSE to large errors, this application also uses the mean absolute error (MAE) as a supplementary evaluation index, satisfying the following formula (21): (twenty one).
[0123] Since RMSE and MAE are both scale-related indicators, it is difficult to directly compare them between different datasets. Therefore, this application further adopts the mean absolute percentage error (MAPE) as an additional evaluation indicator, which satisfies the following formula (22): (twenty two); It is important to note that the dataset meets the following conditions. .
[0124] In the first set of comparative experiments, the TFGB method proposed in this application was compared with several related methods, including GLFIG-based Bagging LSTM2, MIQP-based Bagging LSTM, the TFGB method using continuous piecewise linear trends, and the TFGB method using alternative membership functions. The evaluation results are summarized in [link to evaluation results]. Figure 7 The results show that the TFGB method outperforms other methods in all metrics. Since the selected method shares similar characteristics with the TFGB method, these comparative results further validate the effectiveness of combining MIQP, GLFIG, and Bagging LSTM.
[0125] Furthermore, this application also compared the TFGB method with methods in the literature on four classic benchmark datasets, and the results are summarized in […]. Figure 8 The optimal RMSE, MAE, and MAPE values for each dataset are highlighted in bold. The results show that the proposed method achieves state-of-the-art performance on the DMTM and ZMSN datasets, and also demonstrates strong competitiveness on two other datasets.
[0126] Wherein, AR represents autoregressive model, NAR represents nonlinear autoregressive model, SVR represents support vector regression model, FIG represents fuzzy information granule model, GQFIG represents Gaussian quadratic fuzzy information granule model, FTS represents fuzzy time series model, and SLD represents stepwise linear partitioning method.
[0127] In some embodiments of this application, the default parameters of LSTM in the above numerical experiments are set as follows: number of hidden layers is 30, maximum number of training iterations is 300, gradient threshold is 1, and initial learning rate is... After 250 iterations, the learning rate is adjusted with a learning rate adjustment factor of 0.1 and a regularization parameter of [value missing]. .
[0128] In some embodiments of this application, to rigorously evaluate the performance differences between different prediction models, the classic Friedman test and Nemenyi test are employed. The Friedman test is used to determine whether there are significant differences in the performance ranking of a group of methods across multiple datasets. Its statistic... The calculation satisfies the following formula (23): (twenty three); in, Indicates the number of datasets. Indicate the number of methods, Representation method The sum of ranks across all datasets and evaluation metrics. (Statistic) Obeying the degree of freedom The chi-square distribution.
[0129] Furthermore, on Figure 7 The method described in the paper underwent a Friedman test. The test results showed... Value Since its significance level is less than 5%, it indicates that there are significant performance differences among the prediction methods.
[0130] In some embodiments of this application, to further analyze the significant performance differences among the prediction methods described above, a Nemenyi test was performed. This test compares each pair of methods to determine whether there are significant performance differences. The critical error (CD) of the Nemenyi test is calculated according to the following formula (24): (twenty four); in, Derived from the Tukey distribution, its value depends on the significance level. and number of methods Regarding the method and ,like If the performance of the two is significantly different, then the performance difference between them is significant; conversely, if If the two are not significantly different, then there is no significant difference between them.
[0131] for Figure 7 The five methods, at the 5% significance level, The Nemenyi test results are as follows: Figure 9 As shown in the figure. The results demonstrate a significant difference between the TFGB method proposed in this application and the GLFIG-based Bagging LSTM method, as well as the GFTB method which employs continuous trends. This indicates that utilizing MIQP to extract discontinuous trends in the GFTB method can significantly improve prediction performance.
[0132] Similarly, we Figure 8 The method described in the paper underwent a Friedman test. The test results showed... Value Similarly, at a 5% significance level, this indicates a significant difference between the proposed method and existing methods. Figure 8 The method described in the text, at a 5% significance level, The result is as follows Figure 10 As shown. Obviously, the TFGB method performs best overall. It can be observed that, except for the TFGB method, the other methods do not show significant differences compared with the FIG+SLD method. However, there are significant differences between the TFGB method and the FIG+SLD, NAR(3), SVR and AR(3) methods.
[0133] In some embodiments of this application, to verify the ability of the proposed method in predicting time series containing outliers, this application statistically analyzed the number of outliers in classic datasets. The interquartile range (IQR) method was used to determine whether an observation was an outlier, and the determination formula is as follows: (25); in, Represents a sequence The upper quartile, IQR represents the lower quartile, and IQR represents the interquartile range. For given parameters. When When it is an outlier, Otherwise, it is 0. If the data follows a normal distribution, when When the data falls within the interval The probability within is over 99%.
[0134] Furthermore, the proportion of outliers to total observations is listed in Table 2. Combined with... Figure 8 It can be observed that the proposed method achieves the best prediction performance in the two samples with a high proportion of outliers; while in the samples with a low proportion of outliers, there is still room for improvement in prediction performance.
[0135] Table 2. Outlier statistics for different methods on classic datasets.
[0136] In some embodiments of this application, to further verify the ability of the proposed method in short-term and long-term forecasting, this application performed 1-step, 10-step, and 30-step advance forecasts on a stock index dataset, respectively. The results are summarized in... Figure 11 Friedman test Value This indicates that there are indeed significant differences between different prediction step sizes.
[0137] Subsequently, the Nemenyi test was used to compare the predictive performance among different prediction step sizes, and the critical error was calculated at the 5% significance level. The Nemenyi test results are as follows: Figure 12 As shown in the figure. The results show that when the prediction step size is less than 10 steps, there is no significant difference between the methods; however, with a longer prediction step size, performance differences begin to appear, and the proposed method maintains high prediction accuracy over a longer prediction interval.
[0138] Secondly, refer to Figure 13 This application provides a time series prediction system based on optimized trend fuzzy granulation, including a trend extraction module, a granulation calculation module, a sample generation module, a model training module, and a prediction integration module.
[0139] The trend extraction module is configured as follows: A mixed-integer quadratic programming model is constructed to transform the time series trend extraction problem into an optimization problem of solving piecewise linear trends. This is achieved by minimizing the sum of squared deviations between the original observations and the fitted trend values, as well as the sum of penalty terms for the number of trend segments, to extract linear trend information from the time series. The mixed-integer quadratic programming model includes an objective function and constraints.
[0140] The granular calculation module is configured to: calculate the membership degree of each observation in the time series belonging to the linear trend based on Gaussian linear fuzzy information granules.
[0141] The sample generation module is configured to use membership degrees as the probability distribution for Bootstrap resampling, resample the original time series, and generate multiple derived training sets containing trend structures.
[0142] The model training module is configured to: construct an LSTM neural network model and train multiple LSTM base models using multiple derived training sets.
[0143] The prediction ensemble module is configured to average the prediction results of multiple LSTM base models and then integrate them to obtain the final time series prediction result.
[0144] Furthermore, embodiments of this application provide a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the steps of the time series prediction method based on optimized trend fuzzy granularization as described above.
[0145] Furthermore, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the aforementioned time series prediction method based on optimized trend fuzzy granularization.
[0146] In summary, the time series prediction method and related equipment based on optimized trend fuzzy granulation provided in this application have the following technical effects.
[0147] First, this application employs a mixed-integer quadratic programming (MIQP) model for trend extraction, exhibiting superior noise resistance and flexibility. This method transforms time series trend extraction into an optimization problem of solving piecewise linear trends. By minimizing the sum of squared deviations and the trend segment penalty term, it can accurately remove noise interference from the data. Unlike traditional trend filtering methods, this application does not require adjacent trend segments to remain continuous, thus automatically selecting the most representative key turning points. While preserving key trend features, it effectively avoids overfitting, laying a solid mathematical foundation for subsequent predictions.
[0148] Second, this application introduces Gaussian linear fuzzy information granules (GLFIG) and an improved Bagging strategy, effectively preserving the latent structural features of the data. By calculating the membership degrees of observations and using them as the probability distribution for Bootstrap resampling, the limitation of equal probability of sample occurrence in traditional bootstrap methods is overcome. This mechanism ensures that the generated derivative training set is no longer a simple random copy of the original data, but rather can selectively reinforce the core trend structure in the time series, while using trend fitting values to replace unselected points, further enhancing the training set's ability to express latent linear patterns.
[0149] Third, this application combines LSTM neural networks with an ensemble learning strategy to significantly improve the stability and nonlinear fitting ability of predictions. LSTM base models are trained using multiple derived training sets containing trend structures, and the prediction results are averaged. The ensemble learning approach smooths the prediction errors of each base model. This strategy fully leverages the advantage of LSTM in capturing long-term dependencies, while reducing the prediction variance caused by local noise or parameter initialization in a single model through model diversity, thus overcoming the instability of a single model in complex and fluctuating environments.
[0150] Fourth, experiments have demonstrated that this application exhibits significant superiority in handling non-stationary time series and those containing outliers. Comparative tests on stock index and classic benchmark datasets show that this method outperforms existing AR, SVR, NAR, and traditional fuzzy granularization methods in terms of RMSE, MAE, and other evaluation metrics. The Friedman and Nemenyi tests further confirm that this method shows a significant difference from existing methods at the 5% significance level, especially when dealing with data with a high proportion of outliers, maintaining high prediction accuracy and robustness.
[0151] It should be noted that in all specific embodiments of this application, all data processing activities related to user identity or personal characteristics, such as user information, user behavior data, historical data, and location information, will be conducted in accordance with the principles of legality, legitimacy, and necessity. All data collection, use, storage, and processing will be subject to compliance with applicable national and regional laws, regulations, and industry standards, and informed consent from users will be obtained in a clear and explicit manner before processing. For the processing of sensitive personal information, separate consent from users will be obtained through prominent means such as pop-up prompts and independent confirmation pages. If any processing conflicts with laws and regulations, the laws and regulations will prevail, and necessary data processing will only be carried out within the scope permitted by laws and regulations, ensuring that all data-based applications, analyses, and technical implementations are conducted within the scope permitted by laws and regulations.
[0152] In some alternative embodiments, the functions / operations mentioned in the block diagrams may not occur in the order shown in the operation diagrams. For example, depending on the functions / operations involved, two consecutively shown blocks may actually be executed substantially simultaneously, or the blocks may sometimes be executed in reverse order. Furthermore, the embodiments presented and described in the flowcharts of this application are provided by way of example to provide a more comprehensive understanding of the technology. The disclosed methods are not limited to the operations and logic flows presented herein. Alternative embodiments are contemplated in which the order of various operations is changed and sub-operations described as part of a larger operation are executed independently.
[0153] Furthermore, although this application is described in the context of functional modules, it should be understood that, unless otherwise stated, one or more of the functions and / or features may be integrated into a single physical device and / or software module, or one or more functions and / or features may be implemented in a separate physical device or software module. It is also understood that a detailed discussion of the actual implementation of each module is unnecessary for understanding this application. Rather, given the properties, functions, and internal relationships of the various functional modules in the apparatus disclosed herein, the actual implementation of the module will be understood within the scope of ordinary skill of an engineer. Therefore, those skilled in the art can implement the application set forth in the claims using ordinary skill. It is also understood that the specific concepts disclosed are merely illustrative and are not intended to limit the scope of this application, which is determined by the full scope of the appended claims and their equivalents.
[0154] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several programs to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0155] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequential list of executable programs for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, a program execution system, apparatus, or device (such as a computer-based system, a processor-included system, or other system that can retrieve and execute a program from or in conjunction with such a program execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can mean any means that can contain, store, communicate, propagate, or transmit a program for use by or in conjunction with a program execution system, apparatus, or device.
[0156] More specific examples (a non-exhaustive list) of computer-readable media include: electrical connections (electronic devices) having one or more wires, portable computer disk drives (magnetic devices), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Additionally, computer-readable media can even be paper or other suitable media on which programs can be printed, for example, by optically scanning the paper or other media, then editing, interpreting, or, if necessary, processing it in a suitable manner to obtain the program electronically, and then storing it in computer memory.
[0157] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable program execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0158] In the foregoing description of this specification, the reference to terms such as "one embodiment / implementation," "another embodiment / implementation," or "certain embodiments / implementations," etc., indicates that a specific feature, structure, material, or characteristic described in connection with an embodiment or example is included in an embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0159] Although embodiments of the invention have been shown and described, those skilled in the art will understand that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the claims and their equivalents.
[0160] The above is a detailed description of the preferred embodiments of the present invention. However, the present invention is not limited to the embodiments. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of the present invention. All such equivalent modifications or substitutions are included within the scope defined by the claims of the present invention.
Claims
1. A time series forecasting method based on optimized trend fuzzy granularization, characterized in that, Includes the following steps: Step S100: Construct a mixed-integer quadratic programming model to transform the time series trend extraction problem into an optimization problem of solving piecewise linear trends. By minimizing the sum of squared deviations between the original observations and the fitted trend values, as well as the sum of penalty terms for the number of trend segments, linear trend information in the time series is extracted. The mixed-integer quadratic programming model includes an objective function and constraints. Step S200: Based on Gaussian linear fuzzy information particles, calculate the membership degree of each observation in the time series belonging to the linear trend; Step S300: Use the membership degree as the probability distribution of Bootstrap resampling to resample the original time series and generate multiple derived training sets containing trend structures; Step S400: Construct an LSTM neural network model and train multiple LSTM base models using the multiple derived training sets respectively; Step S500: The prediction results of multiple LSTM base models are averaged and integrated to obtain the final time series prediction result.
2. The time series forecasting method based on optimized trend fuzzy granularization according to claim 1, characterized in that, In step S100, the construction logic of the objective function is as follows: Based on the sum of squares of the differences between the observed values and the corresponding fitted trend values of the original time series at each time point, a penalty term is added to the product of a preset penalty parameter and the number of trend segments to seek the minimum value of this sum. The expression for the objective function is: ; in, Let the objective function be... For the original time series at time... The observed values, For a moment The fitted trend value, The total length of the time series. The default penalty parameters are... This is the maximum number of preset trend segments.
3. The time series forecasting method based on optimized trend fuzzy granularization according to claim 2, characterized in that, The constraints in step S100 include linear trend relationship constraints, trend segment uniqueness constraints, trend segment boundary constraints, and parameter value range constraints. in: The linear trend relationship constraint satisfies the following formula: ; ; in, The intercept parameter is for a linear trend. The slope parameter represents the linear trend. It is a large constant that is much larger than the range of values in the time series; For binary variables, At that moment Belongs to the During a trend period, Thus satisfying the linear trend relationship ; The trend segment uniqueness constraint is used to ensure that each observation in the original time series is assigned to only one trend segment, satisfying the following formula: ; The specific logic of the trend segment boundary constraint is as follows: restricting the time interval of the observed values. It must be located at the starting point of this trend segment. After and the termination point Previously, the following formula was satisfied: ; ; in, ; The parameter value range constraint is used to limit the numerical range of the fitted trend value and its linear parameters, and its specific logic satisfies the following formula: ; ; ; in, and These represent the minimum and maximum values in the time series, respectively. and This represents the minimum and maximum slopes between any two adjacent points in a time series.
4. The time series forecasting method based on optimized trend fuzzy granularization according to claim 1, characterized in that, The membership degree of the Gaussian linear fuzzy information granules in step S200 is calculated as follows: Using a Gaussian membership function, the distance deviation between the observed value and the core line of the trend segment to which the observed value belongs is calculated; The membership degree decreases exponentially as the distance deviation increases, and the rate of decrease is controlled by the variance parameter within the trend segment. The core line is determined by the change of the intercept and slope parameters of the trend segment over time.
5. The time series forecasting method based on optimized trend fuzzy granularization according to claim 1, characterized in that, The specific process of Bootstrap resampling in step S300 is as follows: For each observation, the probability of it being selected into the bootstrap sample is proportional to its corresponding membership degree; During the generation of each derived training set, a determination is made for the observation value at each time step: if the observation value is selected according to the probability, the original observation value at that time step is retained; if it is not selected, the trend fitting value corresponding to that time step is used as a substitute. By repeating the above process, several independent derivative training sets are generated.
6. The time series forecasting method based on optimized trend fuzzy granularization according to claim 1, characterized in that, The step S100 is preceded by a preprocessing step of the original time series: When the maximum number of preset trend segments exceeds the preset threshold, a bottom-up fusion algorithm is used to approximate the solution of the trend segments in order to reduce the computational complexity of the model. The fusion algorithm iteratively calculates the merging loss of adjacent trend segments, selects the adjacent trend segment with the smallest merging loss for merging operation, until the current number of trend segments is reduced to the preset maximum number of trend segments.
7. The time series forecasting method based on optimized trend fuzzy granularization according to claim 1, characterized in that, In step S500, the method for averaging and integrating the prediction results of multiple LSTM base models to obtain the final time series prediction result is as follows: The predicted output values of all trained LSTM base models for the same input data are summed and divided by the total number of LSTM base models involved in the integration to obtain the final arithmetic mean prediction value.
8. A time series forecasting system based on optimized trend fuzzy granularization, characterized in that, include: The trend extraction module is configured to: construct a mixed-integer quadratic programming model to transform the time series trend extraction problem into an optimization problem of solving piecewise linear trends; and extract linear trend information from the time series by minimizing the sum of squared deviations between the original observations and the fitted trend values, as well as the sum of penalty terms for the number of trend segments; wherein, the mixed-integer quadratic programming model includes an objective function and constraints. The granular calculation module is configured to: calculate the membership degree of each observation in the time series to the linear trend based on Gaussian linear fuzzy information granules; The sample generation module is configured to: use the membership degree as the probability distribution of Bootstrap resampling, resample the original time series, and generate multiple derived training sets containing trend structures; The model training module is configured to: construct an LSTM neural network model and train multiple LSTM base models using multiple derived training sets respectively; The prediction ensemble module is configured to: average the prediction results of multiple LSTM base models and integrate them to obtain the final time series prediction result.
9. A computer 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 program, it implements the steps of the time series forecasting method based on optimized trend fuzzy granularization as described in any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps of the time series forecasting method based on optimized trend fuzzy granularization as described in any one of claims 1 to 7.