A method and system for predicting consumption trends by integrating dynamic weighting algorithms
By introducing distribution drift detection and dynamic weight feedback mechanisms into consumer trend forecasting, the problem that fixed weights cannot cope with changes in data distribution is solved, achieving rapid response and high robustness in consumer trend forecasting, and improving forecast accuracy and stability.
Patent Information
- Application Number
- CN202611297039.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-25
- Publication Date
- 2026-11-17
AI Technical Summary
Existing consumer trend forecasting methods rely on fixed weights and cannot perceive changes in data distribution. This results in a delayed response of the model to recent sudden changes in data, large prediction errors, and poor robustness when facing complex and ever-changing long-tail data streams.
By acquiring multi-source consumer behavior data streams, a feature extraction network is used to map the data into a high-dimensional feature space. The distribution drift between feature vectors is calculated, and an adaptive time decay coefficient is used for exponential weighted fusion. A long short-term memory network is combined to predict consumer trends, and a closed-loop control structure is constructed through distribution drift detection and dynamic weight feedback mechanisms.
It significantly improves the response speed and robustness of consumer trend prediction, enables fine-grained adaptive adjustment of feature weights, and enhances the accuracy and stability of the prediction model in scenarios with non-stationary data distribution shifts.
Smart Images

Figure CN123118154A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of data processing technology, and in particular relates to a method and system for predicting consumption trends by integrating dynamic weighting algorithms. Background Technology
[0002] With the rapid development of e-commerce and the digital economy, accurate consumer trend forecasting is crucial for supply chain optimization, inventory management, and marketing decisions. Existing consumer trend forecasting methods mainly rely on time-series analysis of historical consumer data streams, typically using fixed time decay coefficients to weight historical data. However, consumer data streams are affected by sudden external events, causing drastic non-stationary shifts in their probability distribution within the feature space. Fixed weights cannot detect changes in the underlying data distribution, resulting in a significant lag in the model's response to recent abrupt changes and amplifying prediction errors. Some existing technologies attempt to address this issue by introducing dynamic weights, but their weight adjustments often rely on preset business rules or simple fixed-period polling, essentially depending on subjective business experience and lacking objective measurement of the underlying statistical characteristics of the data stream, leading to insufficient universality and reproducibility. Furthermore, most existing systems are open-loop feedforward structures, with data flowing unidirectionally into the prediction model. The model cannot adjust its feature extraction parameters in reverse based on the real-time distribution of the input data stream, resulting in poor robustness when facing complex and variable long-tail data streams. Summary of the Invention
[0003] This invention discloses a consumption trend prediction method and system that integrates dynamic weighting algorithms to solve the problems mentioned in the background art.
[0004] To achieve the above objectives, a first aspect of the present invention provides a method for predicting consumption trends by incorporating a dynamic weighting algorithm, the method comprising: A multi-source consumer behavior data stream is acquired, and the multi-source consumer behavior data stream is mapped into a set of time-series feature vectors in a high-dimensional feature space through a feature extraction network. The set of time-series feature vectors includes feature vectors in the current sliding window and feature vectors in the historical baseline window. The distribution drift between the feature vectors in the current sliding window and the feature vectors in the historical baseline window is calculated using the kernel method. The distribution drift is input into a preset nonlinear mapping function to calculate an adaptive time decay coefficient, which is negatively correlated with the distribution drift. The time series feature vector set is exponentially weighted and fused using the adaptive time decay coefficient to generate a trend prediction input feature vector. The trend prediction input feature vector is input into a pre-trained trend prediction network, which outputs the consumption trend prediction result.
[0005] Furthermore, the step of mapping the multi-source consumer behavior data stream into a set of time-series feature vectors in a high-dimensional feature space through a feature extraction network includes: The multi-source consumer behavior data stream is input into a feature extraction network with an autoencoder structure, wherein the feature extraction network is a two-layer fully connected structure. The input layer dimension of the feature extraction network is the original feature dimension, and the hidden layer dimension and output layer dimension are preset dimensions; With the goal of minimizing reconstruction error, the feature extraction network is trained using historical consumption behavior data over a preset time period to obtain the pre-trained feature extraction network.
[0006] Furthermore, the feature vectors within the historical baseline window are maintained using a first-in-first-out queue; The capacity of the first-in-first-out queue is the size of the historical baseline window; At each time step, the feature vector corresponding to the current time step is added to the tail of the first-in-first-out queue. When the first-in-first-out queue is full, the oldest feature vector at the head of the first-in-first-out queue is removed.
[0007] Further, the step of calculating the distribution drift between the feature vector within the current sliding window and the feature vector within the historical baseline window using the kernel method includes: The maximum mean difference is used as the kernel method. The eigenvectors in the current sliding window and the eigenvectors in the historical reference window are mapped to the regenerating kernel Hilbert space using the Gaussian radial basis kernel function; The distribution drift is obtained by calculating the mean distance between the feature vectors in the current sliding window and the feature vectors in the historical reference window in the regeneration kernel Hilbert space.
[0008] Further, the step of inputting the distributed drift into a preset nonlinear mapping function to calculate the adaptive time decay coefficient includes: Obtain the basic attenuation factor, sensitivity adjustment coefficient, and the historical maximum drift metric recorded within the sliding window; The normalized drift is obtained by calculating the ratio of the distributed drift to the historical maximum drift value. Calculate the product of the sensitivity adjustment coefficient and the normalized drift to obtain the product result; The exponential decay factor is obtained by raising the negative power of the product of the natural constants. The adaptive time decay coefficient is obtained by multiplying the exponential decay factor by the basic decay factor.
[0009] Further, the step of using the adaptive time decay coefficient to perform exponential weighted fusion of the time series feature vector set to generate a trend prediction input feature vector includes: For each historical time step feature vector in the time series feature vector set, the product of the adaptive time decay coefficients corresponding to each time step from the next time step of each historical time step to the current prediction time step is used as the fusion weight of the feature vector of each historical time step. The time series feature vector set is weighted and summed based on the fusion weights to generate the trend prediction input feature vector.
[0010] Furthermore, the trend prediction network is a long short-term memory network; The input dimension of the Long Short-Term Memory Network is consistent with the dimension of the trend prediction input feature vector; The Long Short-Term Memory Network adopts a stacked structure with a preset number of layers, and each layer contains a preset number of hidden units; The output of the last time step of the Long Short-Term Memory network passes through a fully connected layer to output the consumption trend prediction result. The output dimension of the fully connected layer is the prediction target dimension.
[0011] Furthermore, the method also includes an output confidence interval, the output confidence interval comprising: The dropout layer in the trend prediction network remains active during the inference phase; Perform a preset number of forward propagations on the trend prediction input feature vector to obtain a preset number of predicted values; Based on a preset confidence level, determine the lower and upper quantiles of the preset number of predicted values; The lower quantile and the upper quantile are respectively used as the lower and upper bounds of the confidence interval.
[0012] Furthermore, the method also includes a model retraining triggering step: Monitor prediction errors at consecutive time steps; When the prediction error exceeds a preset error threshold for a preset number of consecutive time steps, the model retraining process is triggered. The trend prediction network is retrained using data from a preset historical time period.
[0013] A second aspect of the present invention provides a consumer trend prediction system incorporating a dynamic weighting algorithm, the system comprising: The data stream mapping module is used to acquire multi-source consumer behavior data streams and map the multi-source consumer behavior data streams into a set of time-series feature vectors in a high-dimensional feature space through a feature extraction network. The set of time-series feature vectors includes feature vectors in the current sliding window and feature vectors in the historical baseline window. The drift detection module is used to calculate the distribution drift between the feature vector in the current sliding window and the feature vector in the historical reference window using the kernel method; The weighted feedback module is used to input the distribution drift into a preset nonlinear mapping function and calculate the adaptive time decay coefficient, wherein the adaptive time decay coefficient is negatively correlated with the distribution drift. The weighted fusion module is used to perform exponential weighted fusion of the time series feature vector set using the adaptive time decay coefficient to generate a trend prediction input feature vector; The trend output module is used to input the trend prediction input feature vector into a pre-trained trend prediction network and output the consumption trend prediction result.
[0014] This invention introduces a distribution drift detection step to quantify the probability distribution shift of multi-source consumer behavior data streams in the feature space in real time. When the underlying data distribution shifts, a dynamic weight feedback mechanism automatically calculates a small adaptive time decay coefficient, causing the weights of historical feature vectors to decay exponentially and rapidly. This forces the model to focus on the latest data stream, significantly improving the robustness and response speed of the prediction model in data distribution drift scenarios. This invention uses a kernel method based on the maximum mean difference of the regenerating kernel Hilbert space to calculate the distribution drift degree, transforming abstract changes in consumer habits into the calculation of the expected distance of feature vectors in the kernel space. This eliminates rule settings dependent on subjective business experience, achieving an objective mathematical measurement of the underlying data stream distribution state and improving the versatility and reproducibility of the solution. Through the collaborative work of the drift detection module, weight feedback module, and weighted fusion module, this invention constructs a closed-loop control structure for distribution state monitoring and decay parameter feedback. This allows the feature weighting parameters to be dynamically fine-tuned according to the real-time statistical characteristics of the input data stream, solving the problem of poor robustness of traditional open-loop feedforward structures when facing complex and variable long-tail data streams, and achieving fine-grained adaptive adjustment of feature weights. Attached Figure Description
[0015] The present invention will be further described with reference to the accompanying drawings, but the embodiments in the drawings do not constitute any limitation on the present invention. For those skilled in the art, other drawings can be obtained based on the following drawings without creative effort.
[0016] Figure 1 This is a framework diagram of a consumer trend prediction system that integrates a dynamic weighting algorithm according to the present invention.
[0017] Figure 2 This is a flowchart of a consumption trend prediction method that integrates a dynamic weighting algorithm according to the present invention.
[0018] Figure 3 This is a schematic diagram of the confidence interval calculation process according to an embodiment of the present invention. Detailed Implementation
[0019] Embodiments of the present invention are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.
[0020] Figure 1 An architecture diagram of a consumer trend prediction system based on a fusion dynamic weighting algorithm according to at least one embodiment of the present disclosure is shown.
[0021] This consumer trend prediction system based on a dynamic weighting algorithm includes: a data stream mapping module, used to acquire multi-source consumer behavior data streams and map them into a set of time-series feature vectors in a high-dimensional feature space through a feature extraction network. The time-series feature vector set contains feature vectors within the current sliding window and feature vectors within the historical baseline window; a drift detection module, used to calculate the distribution drift between the feature vectors within the current sliding window and the feature vectors within the historical baseline window using a kernel method; a weight feedback module, used to input the distribution drift into a preset nonlinear mapping function and calculate an adaptive time decay coefficient, which is negatively correlated with the distribution drift; a weighted fusion module, used to perform exponential weighted fusion of the time-series feature vector set using the adaptive time decay coefficient to generate a trend prediction input feature vector; and a trend output module, used to input the trend prediction input feature vector into a pre-trained trend prediction network and output the consumer trend prediction result.
[0022] Figure 2 A flowchart of a consumer trend prediction method based on a fusion dynamic weighting algorithm according to at least one embodiment of the present disclosure is shown below.
[0023] Step 1: Generate a set of high-dimensional time series feature vectors based on the access of multi-source consumer behavior data. Step one involves transforming heterogeneous consumer behavior data returned from various sources into a unified set of time-series feature vectors in a high-dimensional feature space, building upon the existing consumer behavior data access system. While the consumer behavior data received by the consumer trend prediction system from e-commerce platforms, mobile payment terminals, social media sentiment interfaces, and supply chain management systems all appear as transaction or interaction records, their data structures and business meanings differ significantly. Browsing and shopping cart additions from e-commerce platforms typically exhibit high-frequency, short-term fluctuations; transaction records from mobile payment terminals have clear status confirmation attributes; social media sentiment interface data exhibits strong suddenness and long-tail effects; and supply chain management system data reflects the underlying support status of inventory and logistics. The system unifies these consumer behavior data from different sources and with different meanings into high-dimensional dense vectors with timestamps and behavior types, enabling subsequent distribution drift detection to be based on the probability distribution in the feature space, rather than solely on apparent sales volume.
[0024] The system collects multi-source consumer behavior data streams in real time via a message queue. The data fields entering this event processing step are limited to user identifier, behavior type, timestamp, product category, and transaction amount. Specifically, the user identifier comes from the account mapping tables of each source system; the behavior type comes from the platform's preset behavior classification rules; the timestamp prioritizes the business occurrence time recorded by the source system, and if the source system does not provide one, the system's receiving time is used; the product category comes from the platform's product knowledge base; and the transaction amount comes from order settlement records.
[0025] The system then performs data preprocessing. For missing values in the time series, linear interpolation or forward imputation is used to complete them. For outliers, the 3-Sigma principle or truncation method is used to truncate extreme values exceeding the mean plus or minus three standard deviations to the boundary values. Continuous numerical features are standardized using Z-scores to make the mean 0 and the variance 1.
[0026] The system maps pre-processed multi-source consumer behavior data streams into dense vectors in a high-dimensional feature space using a pre-trained feature extraction network. The feature extraction network employs an autoencoder structure, which is a two-layer fully connected structure. The input layer has a dimension of N, where N is the original feature dimension. The hidden layer has a dimension of 128, and the output layer has a dimension of 64. The activation function is a modified linear unit function. The training data for the feature extraction network comes from 30 days of historical consumer behavior data, and the training objective is to minimize the reconstruction error.
[0027] The system then constructs a time series feature vector set according to time steps. The 64-dimensional vectors from T consecutive time steps are combined to construct the time series feature vector set. Here, T equals n plus m, where n is the current sliding window size and m is the historical baseline window size. The time series feature vector set covers each time step of both the historical baseline window and the current sliding window.
[0028] This step ultimately outputs a set of time-series feature vectors. This set of feature vectors then proceeds to the next step to generate the distribution drift. Through this step, existing heterogeneous consumer behavior data is transformed into a high-dimensional set of time-series feature vectors that can be uniformly measured. Subsequent distribution drift detection can then utilize the distance calculation results of this feature vector set in the regenerating kernel Hilbert space.
[0029] Step 2: Data Flow Distribution Drift Detection Based on First-In-First-Out Queues and Kernel Methods Step two takes the time series feature vector set output from step one and calculates the distribution drift according to the current sliding window and the historical benchmark window. The time series feature vector set in step one already contains the feature vectors for each time step. This step uses these feature vectors for monitoring the current distribution state and comparing with the historical benchmark, respectively.
[0030] The system first filters feature vectors according to a preset current sliding window and historical baseline window, forming a current sliding window feature vector set and a historical baseline feature vector set. The system uses a first-in, first-out (FIFO) queue to maintain the historical baseline window, with a capacity of m equal to the size of the historical baseline window. At each time step, the system adds the feature vector corresponding to the current time step to the tail of the FIFO queue. When the FIFO queue is full, the oldest feature vector at the head of the queue is removed. This strategy ensures that the historical baseline feature vector set always contains feature vectors from the most recent m time steps. The current sliding window feature vector set contains feature vectors from the most recent n time steps.
[0031] The system then uses a kernel method to calculate the distribution drift between the current sliding window feature vector set and the historical baseline feature vector set. The system employs the maximum mean difference as the kernel method. The maximum mean difference maps the data to a reproducing kernel Hilbert space through a kernel function, and measures the difference by calculating the distance between the means of the two distributions in this space.
[0032] Specifically, the current set of feature vectors of the sliding window is denoted as... The set of historical baseline feature vectors is denoted as Distribution drift The calculation formula is: in, Let be the Gaussian radial basis kernel function, and the calculation formula is: ; For kernel bandwidth, the median heuristic is used to adaptively calculate the distance to the median of the current batch of sample pairs; The historical baseline window size, The current size of the sliding window; Represents the first in the set of historical baseline feature vectors 1 eigenvector Represents the first element in the current sliding window feature vector set. 1 eigenvector. For the current time step The calculated distribution drift, derived from the real-time calculation results of the above formula, is used to quantify the probability distribution shift of multi-source consumer behavior data streams in the feature space.
[0033] The formula for calculating distribution drift includes a numerator consisting of a kernel function summation term within the historical baseline feature vector set, a kernel function summation term within the current sliding window feature vector set, and a cross-kernel function summation term between the two sets. The denominator is used for normalization.
[0034] In a specific implementation scenario, when faced with a sudden external stimulus, such as a product becoming wildly popular on social media, the distribution of the feature vectors within the current sliding window in the regenerating kernel Hilbert space will rapidly deviate from the distribution of the historical baseline feature vector set, resulting in a significant increase in the calculated distribution drift. This distribution drift will be used in the next step to control the adaptive time decay coefficient, avoiding treating all historical feature vectors as equally stable references.
[0035] This step ultimately outputs the distribution drift. This distribution drift is organized by time step and proceeds to the next step to calculate the adaptive time decay coefficient. Through this step, the time-series feature vector set formed in step one is transformed into a distribution state metric that can directly participate in dynamic weight feedback. The distribution drift already reflects the non-stationary offset characteristics of the consumed data stream in the feature space.
[0036] Step 3: Dynamic weight feedback and attenuation coefficient calculation based on nonlinear mapping Step 3 takes the distribution drift output from Step 2 and calculates the adaptive time decay coefficient. Step 2 has already generated the distribution drift according to the time step; this step converts the distribution drift into a decay parameter that controls the degree of dependence on historical data.
[0037] The system first obtains the base decay factor, sensitivity adjustment coefficient, and the historical maximum drift metric recorded within the sliding window. The base decay factor is set based on the typical volatility of the business scenario, with a recommended range of 0.85 to 0.98. The sensitivity adjustment coefficient is obtained by minimizing the prediction mean square error on the validation set through grid search, with a recommended range of 0.5 to 3.0. The sliding window W_max is recommended to be set to 100 time steps, i.e., the maximum drift within the most recent 100 time steps is used as the normalization benchmark. During system cold start, the historical maximum drift metric is initialized to 1.0, and after the sliding window has collected W_max drift records, it is switched to the actual maximum value.
[0038] The system then calculates the adaptive time decay coefficient. Adaptive time decay coefficient The calculation formula is: in, For the first The adaptive time decay coefficient for each time step is derived from the calculation output of this step; The base attenuation factor is set based on the typical volatility of the business scenario, and the recommended range is [range missing]. ; The sensitivity adjustment coefficient is obtained by minimizing the mean squared error of prediction on the validation set through grid search, and the recommended range is... ; The current distribution drift is derived from the calculation results in step two; For sliding windows The maximum historical drift metric recorded internally, and the sliding window size. It is recommended to set it to 100 time steps, initialize it to 1.0 during system cold start, and wait for the sliding window to collect all the data. After recording a drift degree, switch to the actual maximum value; To prevent division by zero, the recommended value is [value missing]. This ensures numerical stability when the system is first started or when there is no drift.
[0039] This calculation formula reflects the negative correlation between the distribution drift and the adaptive time decay coefficient. When the distribution drift... When increased, the adaptive time decay coefficient Decrease, thus accelerating the weight decay of historical data; when the distribution drift... When decreased, the adaptive time decay coefficient Increase the weight of historical data. Introduce a small constant in the formula to prevent division by zero, ensuring numerical stability when the system is just started up or when there is no drift.
[0040] This step ultimately outputs an adaptive time decay coefficient. This adaptive time decay coefficient is organized according to time steps and proceeds to the next step for performing time-series feature weighted fusion. Through this step, the distribution drift generated in step two is transformed into a control variable that can directly participate in feature weighting, enabling the feature extraction parameters to be dynamically fine-tuned according to the real-time statistical characteristics of the input data stream.
[0041] Step 4: Weighted fusion of time-series features based on dynamic decay coefficient Step four takes the adaptive time decay coefficient output from step three and the time series feature vector set output from step one, and performs exponential weighted fusion. Step three has already generated the adaptive time decay coefficient according to the time step. This step applies the adaptive time decay coefficient to the time series feature vector set to generate the trend prediction input feature vector.
[0042] The system calculates the product of adaptive time decay coefficients for each historical time step's feature vector in the time series feature vector set, from the next time step to the current prediction time step. This product is used as the fusion weight for the feature vector at that historical time step. Since the adaptive time decay coefficients change dynamically at each time step, the system uses a product approach to accurately calculate the cumulative decay effect across at least two time steps. The feature vector needs to undergo at least one decay step from the historical time step to the current prediction time step, with each decay step controlled by the corresponding adaptive time decay coefficient.
[0043] Specifically, the trend prediction input feature vector The calculation formula is: in, Input the feature vector into the generated trend prediction; This is the current prediction time step; The time series window length, ; This represents the time step index in the set of time series feature vectors, with values ranging from... arrive ; This serves as the time step index during the multiplication process; For the first The adaptive time decay coefficient for each time step is derived from the calculation output of step three; For the first Feature vectors at each time step; Indicates from time step arrive The product of all adaptive time decay coefficients, when When the product of space and space is defined as 1.
[0044] The system calculates the first based on the above formula. The feature vectors at each time step Feature weight ratio The calculation formula is: in, This is the time step index during the summation process in the denominator. The weight percentage of this feature. This reflects the relative importance of the feature vectors at each time step in the final fusion result, and satisfies that the sum of the feature weights of all time steps is 1.
[0045] The system generates a trend prediction input feature vector by weighted summation of the time series feature vector set based on fusion weights. The system multiplies the feature vector at each time step with its corresponding fusion weight to obtain a weighted feature vector. The system then sums the weighted feature vectors corresponding to each time step in the time series feature vector set, obtaining a numerator sum. Finally, the system sums the fusion weights corresponding to each time step in the time series feature vector set, obtaining a denominator sum. The system divides the numerator sum by the denominator sum to obtain the normalized trend prediction input feature vector.
[0046] This weighted fusion process accurately reflects the time-varying decay characteristics, ensuring that the feature vector at the current time step has the highest fusion weight, while the feature vector weights at historical time steps decay exponentially with time distance. As the distribution drift increases, the adaptive time decay coefficient decreases, and the weights of historical data decay faster, causing the system to automatically shift its focus from historical data to the latest data.
[0047] In a specific implementation scenario, if the distribution drift increases continuously over several consecutive time steps, the adaptive time decay coefficient will gradually decrease, the feature weight proportion of the current time step will gradually increase, and the feature weight proportion of historical time steps will gradually decrease. This result demonstrates that after a sudden change in the consumer data stream, the system automatically adjusts the attention allocation to avoid over-reliance on historical stable data.
[0048] This step ultimately outputs a trend prediction input feature vector. This trend prediction input feature vector proceeds to the next step to perform trend prediction. Through this step, the adaptive time decay coefficient generated in step three is embedded in the feature weighting process, enabling the consumer trend prediction system to consider both historical data dependence and real-time distribution drift when generating input features.
[0049] Step 5: Nonlinear mapping and output of consumption trends based on trend prediction networks Step 5 takes the trend prediction input feature vector output from Step 4, performs trend prediction, and outputs the result. Step 4 has already generated the trend prediction input feature vector. This step inputs this trend prediction input feature vector into the pre-trained trend prediction network and outputs the consumption trend prediction result and confidence interval.
[0050] The system employs a Long Short-Term Memory (LSTM) network as the trend prediction network. The input dimension of the LSM network is consistent with the dimension of the trend prediction input feature vector. It adopts a two-layer stacked structure, with each layer containing 128 hidden units, and uses unidirectional temporal processing. The output of the final time step passes through a fully connected layer with a dimension of 64 to 1, outputting the consumption trend prediction result.
[0051] The training data for the trend prediction network consists of feature sequences and corresponding true trend labels from the past 6 months. The Huber Loss loss function is used, and the Adam optimizer is employed. The initial learning rate is set to 0.001, combined with a cosine annealing learning rate strategy. The number of training epochs is set to 100, and an early stopping mechanism is introduced: training terminates when the validation set loss does not decrease for 10 consecutive epochs.
[0052] During the inference phase, the system employs the Monte Carlo Dropout method to calculate confidence intervals. In some embodiments, the method further includes outputting confidence intervals. The dropout layers in the trend prediction network are kept active during the inference phase. A preset number of forward propagations are performed on the trend prediction input feature vector to obtain a preset number of predicted values. Based on a preset confidence level, the lower and upper quantiles of the preset number of predicted values are determined. The lower and upper quantiles are used as the lower and upper bounds of the confidence intervals, respectively.
[0053] Specifically, in one embodiment, the Dropout layer is kept active during the inference phase of the trend prediction network (a Dropout rate of 0.2 is recommended), and the same input sequence is forward-propagated K=50 times to obtain 50 predicted values. Based on a preset confidence level of 95%, the 2.5% and 97.5% quantiles of the 50 predicted values are extracted. The 2.5% quantile is used as the lower bound of the 95% confidence interval, and the 97.5% quantile is used as the upper bound of the 95% confidence interval.
[0054] Figure 3 A schematic diagram of the Monte Carlo Dropout confidence interval calculation process according to at least one embodiment of the present disclosure is shown.
[0055] The Monte Carlo Dropout method introduces randomness through multiple forward propagations, thereby estimating the uncertainty of the prediction. This method can provide confidence intervals for the prediction results without increasing computational cost, helping users understand the reliability of the predictions.
[0056] The system also executes a model retraining trigger step. The system monitors the prediction error over consecutive time steps. When the prediction error exceeds a preset error threshold for a predetermined number of consecutive time steps, the model retraining process is triggered. The system retrains the trend prediction network using data from a preset historical time period. For example, if the mean absolute percentage error exceeds 20% over 10 consecutive time steps, it retrains using data from the past 3 months.
[0057] This step ultimately outputs the consumer trend prediction results and confidence intervals. Through this step, the trend prediction input feature vector generated in step four is transformed into actual business prediction results, enabling the consumer trend prediction system to simultaneously consider dynamically weighted features and prediction uncertainty at the execution end.
[0058] This invention provides a consumption trend prediction method and system that integrates dynamic weighting algorithms. By employing a kernel method based on regenerating kernel Hilbert space to calculate distribution drift, it transforms abstract changes in consumption habits into objective mathematical measures of feature vectors in kernel space. This eliminates the reliance on subjective business experience in rule setting, significantly improving the versatility and reproducibility of the solution. Simultaneously, by introducing distribution drift detection and dynamic weight feedback mechanisms, a small adaptive time decay coefficient is automatically calculated when the underlying data distribution shifts, causing historical feature vector weights to decay exponentially. This forces the model to focus on the latest data stream, effectively solving the problem that static weights cannot cope with distribution drift, and significantly improving the accuracy and reproducibility of the prediction. This invention improves the response speed and robustness of the prediction model in scenarios with non-stationary data distribution shifts. Furthermore, through the collaborative work of drift detection, weight feedback, and weighted fusion, it constructs a low-level closed-loop control structure for distribution state monitoring and decay parameter feedback. This allows the feature weighting parameters to be dynamically fine-tuned according to the real-time statistical characteristics of the input data stream, achieving refined adaptive adjustment of feature weights. Finally, during the inference phase, the invention calculates confidence intervals using the Monte Carlo dropout layer method, providing uncertainty boundaries for prediction results for business decisions. Combined with a model retraining trigger mechanism for prediction error monitoring, this ensures that the model maintains high prediction accuracy and system stability in long-term complex operating environments.
[0059] It is worth noting that the specific workflow of the consumption trend prediction system integrating dynamic weight algorithm provided in this embodiment of the invention is the same as that of the consumption trend prediction method integrating dynamic weight algorithm described in the above embodiment, and will not be repeated here.
[0060] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications are also considered to be within the scope of protection of the present invention.
Claims
1. A consumption trend prediction method integrating dynamic weighting algorithm, characterized in that, include: A multi-source consumer behavior data stream is acquired, and the multi-source consumer behavior data stream is mapped into a set of time-series feature vectors in a high-dimensional feature space through a feature extraction network. The set of time-series feature vectors includes feature vectors in the current sliding window and feature vectors in the historical baseline window. The distribution drift between the feature vectors in the current sliding window and the feature vectors in the historical baseline window is calculated using the kernel method. The distribution drift is input into a preset nonlinear mapping function to calculate an adaptive time decay coefficient, which is negatively correlated with the distribution drift. The time series feature vector set is exponentially weighted and fused using the adaptive time decay coefficient to generate a trend prediction input feature vector. The trend prediction input feature vector is input into a pre-trained trend prediction network, which outputs the consumption trend prediction result.
2. The consumption trend prediction method based on the fusion dynamic weight algorithm according to claim 1, characterized in that, The process of mapping the multi-source consumer behavior data stream into a set of time-series feature vectors in a high-dimensional feature space through a feature extraction network includes: The multi-source consumer behavior data stream is input into a feature extraction network with an autoencoder structure, wherein the feature extraction network is a two-layer fully connected structure. The input layer dimension of the feature extraction network is the original feature dimension, and the hidden layer dimension and output layer dimension are preset dimensions; With the goal of minimizing reconstruction error, the feature extraction network is trained using historical consumption behavior data over a preset time period to obtain the pre-trained feature extraction network.
3. The consumption trend prediction method based on the fusion dynamic weight algorithm according to claim 1, characterized in that, The feature vectors within the historical baseline window are maintained using a first-in-first-out queue; The capacity of the first-in-first-out queue is the size of the historical baseline window; At each time step, the feature vector corresponding to the current time step is added to the tail of the first-in-first-out queue. When the first-in-first-out queue is full, the oldest feature vector at the head of the first-in-first-out queue is removed.
4. The consumption trend prediction method based on the fusion dynamic weight algorithm according to claim 1, characterized in that, The calculation of the distribution drift between the feature vectors in the current sliding window and the feature vectors in the historical baseline window using the kernel method includes: The maximum mean difference is used as the kernel method. The eigenvectors in the current sliding window and the eigenvectors in the historical reference window are mapped to the regenerating kernel Hilbert space using the Gaussian radial basis kernel function; The distribution drift is obtained by calculating the mean distance between the feature vectors in the current sliding window and the feature vectors in the historical reference window in the regeneration kernel Hilbert space.
5. The consumption trend prediction method based on the fusion dynamic weight algorithm according to claim 1, characterized in that, The step of inputting the distributed drift into a preset nonlinear mapping function to calculate the adaptive time decay coefficient includes: Obtain the basic attenuation factor, sensitivity adjustment coefficient, and the historical maximum drift metric recorded within the sliding window; The normalized drift is obtained by calculating the ratio of the distributed drift to the historical maximum drift value. Calculate the product of the sensitivity adjustment coefficient and the normalized drift to obtain the product result; The exponential decay factor is obtained by raising the negative power of the product of the natural constants. The adaptive time decay coefficient is obtained by multiplying the exponential decay factor by the basic decay factor.
6. The consumption trend prediction method based on the fusion dynamic weight algorithm according to claim 1, characterized in that, The step of using the adaptive time decay coefficient to perform exponential weighted fusion of the time series feature vector set to generate a trend prediction input feature vector includes: For each historical time step feature vector in the time series feature vector set, the product of the adaptive time decay coefficients corresponding to each time step from the next time step of each historical time step to the current prediction time step is used as the fusion weight of the feature vector of each historical time step. The time series feature vector set is weighted and summed based on the fusion weights to generate the trend prediction input feature vector.
7. The consumption trend prediction method based on the fusion dynamic weight algorithm according to claim 1, characterized in that, The trend prediction network is a long short-term memory network; The input dimension of the Long Short-Term Memory Network is consistent with the dimension of the trend prediction input feature vector; The Long Short-Term Memory Network adopts a stacked structure with a preset number of layers, and each layer contains a preset number of hidden units; The output of the last time step of the Long Short-Term Memory network passes through a fully connected layer to output the consumption trend prediction result. The output dimension of the fully connected layer is the prediction target dimension.
8. The consumption trend prediction method based on the fusion dynamic weight algorithm according to claim 1, characterized in that, The method further includes an output confidence interval, the output confidence interval comprising: The dropout layer in the trend prediction network remains active during the inference phase; Perform a preset number of forward propagations on the trend prediction input feature vector to obtain a preset number of predicted values; Based on a preset confidence level, determine the lower and upper quantiles of the preset number of predicted values; The lower quantile and the upper quantile are respectively used as the lower and upper bounds of the confidence interval.
9. The consumption trend prediction method based on the fusion dynamic weight algorithm according to claim 1, characterized in that, The method also includes a model retraining triggering step: Monitor prediction errors at consecutive time steps; When the prediction error exceeds a preset error threshold for a preset number of consecutive time steps, the model retraining process is triggered. The trend prediction network is retrained using data from a preset historical time period.
10. A consumer trend prediction system integrating a dynamic weighting algorithm, characterized in that, include: The data stream mapping module is used to acquire multi-source consumer behavior data streams and map the multi-source consumer behavior data streams into a set of time-series feature vectors in a high-dimensional feature space through a feature extraction network. The set of time-series feature vectors includes feature vectors in the current sliding window and feature vectors in the historical baseline window. The drift detection module is used to calculate the distribution drift between the feature vector in the current sliding window and the feature vector in the historical reference window using the kernel method; The weighted feedback module is used to input the distribution drift into a preset nonlinear mapping function and calculate the adaptive time decay coefficient, wherein the adaptive time decay coefficient is negatively correlated with the distribution drift. The weighted fusion module is used to perform exponential weighted fusion of the time series feature vector set using the adaptive time decay coefficient to generate a trend prediction input feature vector; The trend output module is used to input the trend prediction input feature vector into a pre-trained trend prediction network and output the consumption trend prediction result.
