Precise power marketing prediction method based on machine learning
By constructing a dynamic learning network for feature weights and using multi-source data fusion technology, the problem of static feature weights in power marketing forecasting was solved, enabling adaptive adjustment to dynamic factors in the power market and improving the accuracy and stability of power purchase forecasting.
Patent Information
- Application Number
- CN202511878341.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-12
- Publication Date
- 2026-03-03
AI Technical Summary
In existing electricity marketing forecasting methods, the static setting of feature weights is difficult to adapt to dynamic factors in electricity marketing scenarios, such as seasonal changes, holiday changes, emergencies, and the long-term evolution of user value. This results in insufficient adaptability and accuracy of the forecasting model in different spatiotemporal contexts.
A feature weight dynamic learning network is constructed, which combines a temporal context awareness module and a customer value dynamic evaluation module. Through multi-source data fusion and Stacking model fusion technology, the feature weights are dynamically and adaptively adjusted to capture the long-term evolution trend of customer value and respond to short-term temporal context changes.
It significantly improves the adaptability and prediction accuracy of the forecasting model in the complex and ever-changing power market environment, enhances the accuracy, stability and robustness of electricity purchase forecasting, and strengthens its adaptability.
Smart Images

Figure CN121599707A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of electricity marketing technology, specifically a precise electricity marketing forecasting method based on machine learning. Background Technology
[0002] With the deepening of the electricity market and the rapid development of information technology, power companies have accumulated massive amounts of user electricity consumption data, marketing data, and environmental data. This data contains valuable information reflecting user electricity consumption behavior and market demand patterns, providing a foundation for achieving precise electricity marketing forecasting through data-driven methods. Against this backdrop, machine learning technology, due to its powerful data fitting and pattern recognition capabilities, has been widely applied in the field of electricity marketing. The aim is to more accurately predict electricity demand through the analysis of historical data, thereby formulating effective marketing strategies, optimizing resource allocation, and improving the operational efficiency and market competitiveness of power companies.
[0003] Currently, existing electricity marketing forecasting methods are constantly evolving. Patent CN118941319A discloses a machine learning-based precision electricity marketing method, which mainly includes steps such as data collection, data preprocessing, initial cluster center selection, clustering, optimization of clustering parameters, and generation of electricity marketing strategies. This scheme aims to improve the accuracy and discriminative power of clustering and reduce the randomness of initial cluster center selection through benchmark feature selection and refined data space partitioning. The core of this type of clustering-based method lies in improving the quality of user segmentation by refining the clustering process itself, thereby providing a basis for marketing strategy formulation. However, this method and similar technologies generally share a common limitation: during model construction, the feature weights input to the model are usually statically preset or determined once through offline optimization. This static feature processing mechanism is difficult to adapt to the dynamic changes in feature importance caused by seasonal changes, holiday variations, unexpected events, and the long-term evolution of user value in electricity marketing scenarios, thus limiting the adaptive ability and accuracy of the forecasting model in different spatiotemporal contexts.
[0004] Therefore, it is urgent to address the core issue of the mismatch between static feature weight settings in existing technologies and the dynamic scenarios of electricity marketing. Specifically, a key challenge in achieving accurate electricity marketing forecasting is how to enable feature weights to respond synchronously to short-term changes in time context while simultaneously capturing the long-term evolution trends of customer value and electricity consumption patterns. Existing technologies have not yet provided an effective solution regarding the dynamic adaptability of feature weights.
[0005] In summary, while existing electricity marketing forecasting methods have made progress in areas such as clustering algorithm optimization, they suffer from significant shortcomings in the dynamic adaptive adjustment of feature weights. This limits the forecasting models' ability to accurately perceive and rapidly adapt to the complex and volatile electricity market. Summary of the Invention
[0006] The purpose of this invention is to overcome the shortcomings of existing technologies and provide a precise electricity marketing forecasting method based on machine learning. By constructing a feature weight dynamic learning network, combining a time-series context awareness module to extract time features, and a customer value dynamic evaluation module to calculate long-term customer value, the feature weights are dynamically and adaptively adjusted. At the same time, multi-source data fusion and Stacking model fusion technologies are adopted to improve the accuracy of electricity purchase forecasting.
[0007] To solve the above-mentioned technical problems, this invention provides the following technical solution: a machine learning-based method for accurate electricity marketing forecasting, comprising the following steps:
[0008] Step 1: Collect multi-source data from the electricity marketing system, including user-side data, environmental data, and time data.
[0009] Step 2: Perform fusion processing on the multi-source data to obtain standardized feature data;
[0010] Step 3: Input the standardized feature data into the pre-trained feature weight dynamic learning network to obtain the dynamic feature weight matrix. The feature weight dynamic learning network is jointly driven by the output of the temporal context awareness module and the output of the customer value dynamic evaluation module to generate the dynamic feature weight matrix.
[0011] Step 4: Use the dynamic feature weight matrix to weight the standardized feature data to generate weighted feature data;
[0012] Step 5: Input the weighted feature data into the electricity purchase forecasting model to obtain the electricity purchase forecasting result;
[0013] The time-series context awareness module is used to extract time feature vectors, and the customer value dynamic assessment module is used to calculate the value superiority reflecting the long-term value of customers.
[0014] Furthermore, the step two, which involves fusing multi-source data to obtain standardized feature data, specifically includes:
[0015] For unstructured text data in user-side data, a pre-trained word embedding model is used to vectorize it to obtain text semantic feature vectors;
[0016] Calendar information in environmental and time data is encoded to obtain a time encoding vector, which includes periodic codes, holiday markers, and seasonal factors.
[0017] Discrete cosine transform is performed on historical daily electricity consumption data from the user side to identify key fluctuation cycles and extract cycle feature vectors.
[0018] The text semantic feature vector, time encoding vector, periodic feature vector, and other numerical features in the user-side data are concatenated and standardized to form the standardized feature data.
[0019] Furthermore, the temporal context awareness module extracts temporal feature vectors, specifically as follows:
[0020] The time-series context awareness module receives current time information, which includes year, month, day, hour, minute, and holiday markers.
[0021] The current time information is mapped into a time feature vector by a time encoder, which is implemented using a multi-layer feedforward neural network.
[0022] The time feature vector is used to characterize the influence pattern of short-term time context on the feature weights of electricity marketing.
[0023] Furthermore, the customer value dynamic assessment module calculates the value excellence, specifically including:
[0024] Customer value evaluation indicators are calculated based on the multi-source data. These indicators include power factor, customer credit status, customer relationship level, and the proportion of purchases from major suppliers.
[0025] The customer value evaluation index is processed using a variable-weighted extensibility model, and the weights of the variable-weighted extensibility model are dynamically adjusted according to the distribution of index values.
[0026] The variable-weighted material element extension model outputs the value superiority, which is a continuous scalar used to quantify the long-term value status of customers.
[0027] The calculation process of the variable weight matter-element extension model is as follows:
[0028]
[0029] in, Indicates the degree of value excellence. This indicates the number of customer value evaluation indicators. Indicates the first Standardized values of individual customer value evaluation indicators. This represents a vector composed of all customer value evaluation indicators. Indicates the first Dynamic weighting function for each customer value evaluation indicator. Represents a classical field matrix. Indicates the first Extensional correlation function for customer value evaluation indicators.
[0030] Furthermore, the dynamic feature weight learning network in step three generates a dynamic feature weight matrix, specifically including:
[0031] The feature weight dynamic learning network includes a long-term weight evolution unit and a short-term weight fine-tuning unit;
[0032] The long-term weight evolution unit receives the value superiority and user group identifier output by the customer value dynamic evaluation module, queries the long-term weight lookup table, and outputs the benchmark feature weight vector.
[0033] The short-term weight fine-tuning unit receives the time feature vector output by the time-series context-aware module and calculates the feature weight offset by fine-tuning the neural network.
[0034] The dynamic feature weight matrix is obtained by adding the baseline feature weight vector to the feature weight offset.
[0035] Wherein, the dynamic feature weight matrix Calculated using the following formula:
[0036]
[0037] in, This represents the baseline feature weight vector output by the long-term weighted evolution unit, which is the value superiority. and user group identifiers The function, This represents the feature weight offset output by the short-term weight fine-tuning unit, and is a time feature vector. The function.
[0038] Furthermore, the update method for the long-term weighted lookup table is as follows:
[0039] Regularly collect weighted feature data of all users within a set time period and the error between the corresponding predicted and actual electricity purchases;
[0040] With the goal of minimizing the error, the gradient descent method is used to optimize all the baseline feature weight vectors in the long-term weight lookup table;
[0041] The update cycle of the long-term weight lookup table is longer than the update cycle of the electricity purchase prediction model.
[0042] Furthermore, the electricity purchase prediction model is constructed using Stacking model fusion technology, specifically including:
[0043] The underlying layer includes multiple heterogeneous basic prediction models, including gradient boosting tree models and long short-term memory network models.
[0044] The upper layer includes a meta-learner that employs a linear regression model;
[0045] The basic prediction model takes the weighted feature data as input and outputs preliminary prediction results.
[0046] The meta-learner takes the combination of preliminary prediction results from all basic prediction models as input and outputs the final electricity purchase prediction result.
[0047] Furthermore, the method also includes:
[0048] Step Six: Online Learning and Model Update: Continuously monitor the prediction error of the electricity purchase prediction model on the latest data. When the prediction error continuously exceeds a preset threshold, it is determined that concept drift has occurred. In response to the determination of concept drift, an incremental learning algorithm is used to update the short-term weight fine-tuning unit in the feature weight dynamic learning network and the meta-learner in the electricity purchase prediction model. The incremental learning algorithm uses recent small-batch data and fixes the parameters of the long-term weight evolution unit in the feature weight dynamic learning network.
[0049] Compared with existing technologies, this machine learning-based precision electricity marketing forecasting method has the following advantages:
[0050] I. This invention constructs a dynamic learning network for feature weights and combines it with a temporal context awareness module and a dynamic customer value assessment module to achieve dynamic adaptive adjustment of feature weights. The network captures the long-term evolution trend of customer value through a long-term weight evolution unit and responds to short-term temporal context changes with the help of a short-term weight fine-tuning unit. This allows the feature weights to flexibly adapt to changes in customer value and temporal context, significantly improving the adaptive capability and prediction accuracy of the prediction model in the complex and ever-changing power market environment.
[0051] Second, this invention integrates heterogeneous data resources through multi-source data fusion processing technology, constructs a power purchase prediction model using Stacking model fusion technology, and addresses concept drift by combining online learning and model update mechanisms. Multi-source data fusion ensures the comprehensiveness and effectiveness of feature information, Stacking model fusion realizes the complementary advantages of different basic prediction models, and the online learning mechanism can quickly adapt to changes in data distribution. The synergistic effect of these three factors not only further improves the accuracy and stability of power purchase prediction, but also enhances the robustness and practical application adaptability of the model.
[0052] Other advantages, objectives and features of the invention will be set forth in part in the description which follows, and in part will be apparent to those skilled in the art from the following examination or study, or may be learned from the practice of the invention. Attached Figure Description
[0053] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are merely some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without any creative effort.
[0054] Figure 1 This is a system architecture diagram of the present invention;
[0055] Figure 2 This is a diagram illustrating the dynamic weight generation mechanism of the present invention;
[0056] Figure 3 This is a flowchart of the process of the present invention. Detailed Implementation
[0057] To further illustrate the technical means and effects of the present invention in achieving its intended purpose, the following detailed description of the specific implementation methods, structures, features, and effects of the present invention, in conjunction with the accompanying drawings and preferred embodiments, is provided below.
[0058] Example 1
[0059] like Figures 1 to 3 As shown in the figure, this embodiment discloses the specific implementation process of a machine learning-based precision electricity marketing forecasting method. The specific implementation process is described in detail below.
[0060] In some alternative implementations, the data acquisition process needs to cover two main categories: user-side data and environmental and temporal data, to ensure the comprehensiveness and timeliness of the data and provide a reliable foundation for subsequent feature extraction and model training.
[0061] Specifically, the sources of user-side data collection include, but are not limited to: historical daily electricity consumption data, voltage and current data collected by smart meters; customer profile data in the electricity marketing system; unstructured text data in the customer service work order system; and payment records and overdue payment information in the financial system. Among these, the historical daily electricity consumption data is collected over the past 3 years, with a sampling frequency of once per day; the unstructured text data is collected from valid work order records over the past year.
[0062] The sources of environmental and temporal data include: meteorological data such as daily average temperature, precipitation, and wind speed published by meteorological departments; standard calendar data; and data indicating statutory holidays and industry-specific holidays. The collection frequency of meteorological and temporal data is consistent with that of electricity data to ensure time sequence alignment.
[0063] It is understandable that the process of collecting multi-source data needs to meet data quality requirements. Preprocessing operations such as outlier detection and missing value imputation are used to ensure the integrity and validity of the data.
[0064] This step aims to transform heterogeneous, multi-source data into standardized feature data, which is achieved through the following sub-steps:
[0065] Vectorization of Unstructured Text Data: For unstructured text data in user-side data, in some optional implementations, a pre-trained word embedding model is used for vectorization. Specifically, the BERT-base pre-trained model is selected as the base model, which has strong semantic understanding capabilities and can capture contextual information in the text.
[0066] The processing steps are as follows: First, the text data is cleaned to remove punctuation marks, special characters, and meaningless stop words. Then, the cleaned text sequence is input into the BERT model, and the output vector at the [CLS] position is taken as the text semantic feature vector. For example, the dimension of the text semantic feature vector is set to 768 dimensions. This dimension ensures the integrity of semantic information while controlling the feature dimension to avoid redundancy.
[0067] Time-encoded vector generation: Encoding calendar information in environmental and time data to generate time-encoded vectors containing periodic, holiday, and seasonal features. Specifically:
[0068] Periodic coding employs a sine-cosine coding method to encode time dimensions such as year, month, day, hour, and minute, in order to capture periodic patterns at different time scales. The coding formula is as follows:
[0069]
[0070] in, Represents the position index in the time series. Index representing the encoded dimension, The total dimension of the time-encoded vector is 64 dimensions in this embodiment. This encoding method can transform discrete time information into a continuous vector representation while preserving the periodicity of time.
[0071] Holiday markers use binary encoding. If a certain point in time is a statutory holiday or a special holiday for an industry, it is marked as 1; otherwise, it is marked as 0.
[0072] The seasonal factor is set according to the four seasons in the Northern Hemisphere, with spring, summer, autumn and winter each corresponding to a different numerical code, in order to quantify the impact of seasonal changes on electricity consumption behavior.
[0073] The periodic encoding vector, holiday marker vector, and seasonal factor vector are concatenated to form a 64-dimensional time encoding vector.
[0074] Periodic Feature Vector Extraction: A discrete cosine transform is performed on historical daily electricity consumption data from the user-side data to identify key fluctuation cycles in electricity load and extract periodic feature vectors. Specifically:
[0075] Let the historical daily electricity data sequence be... ,in For data length, in this embodiment =1095, corresponding to 3 years of daily data, its DCT transformation formula is:
[0076]
[0077] in, Indicates the first DCT coefficients, For normalization coefficients, when =0 ,when hour , Indices representing the index of a data sequence Indicates the index of the frequency component.
[0078] The electricity data is transformed from the time domain to the frequency domain using DCT transformation, and the first 32 DCT coefficients with the largest amplitude are selected to form a periodic feature vector. It can be understood that the first 32 coefficients already contain the main periodic information of the electricity data, effectively characterizing the fluctuation pattern of electricity load.
[0079] Feature concatenation and standardization: The above-mentioned text semantic feature vector, time encoding vector, periodic feature vector, and other numerical features in the user-side data are concatenated to form an initial feature vector.
[0080] The initial feature vectors are then standardized using the Z-score standardization method, as shown in the following formula:
[0081]
[0082] in, Represents the first eigenvector in the initial eigenvector. 1 eigenvalue, This represents the mean of the feature on the training dataset. This represents the standard deviation of the feature on the training dataset. This represents the standardized feature values. Standardization eliminates dimensional differences between different features, ensuring the stability and convergence speed of model training. The resulting standardized feature data is then used as input to the subsequent model.
[0083] This step generates a dynamic feature weight matrix through a feature weight dynamic learning network. This network consists of a long-term weight evolution unit and a short-term weight fine-tuning unit, and is jointly driven by the outputs of the temporal context awareness module and the customer value dynamic assessment module. The specific implementation process is as follows:
[0084] Temporal Context Awareness Module: This module extracts temporal feature vectors corresponding to short-term time contexts to capture the impact of short-term factors such as holidays and seasonal changes on feature weights. Specifically:
[0085] This module receives current time information including year, month, day, hour, minute, and holiday markers. A multi-layer feedforward neural network is used as the time encoder. The network structure includes an input layer, two hidden layers, and an output layer. The input layer dimension is the same as the time encoding vector dimension, the hidden layer activation function is ReLU, and the output layer dimension is set to be the same as the standardized feature data dimension, i.e., the time feature vector dimension is 872.
[0086] During training, the time encoder uses mean squared error loss as its loss function, the optimizer uses the Adam optimizer, and the learning rate employs an adaptive adjustment strategy. This network maps discrete time information into a continuous time feature vector, which characterizes the impact pattern of various features on electricity purchase prediction under different time contexts.
[0087] Customer Value Dynamic Assessment Module: This module calculates the value superiority index, which reflects the long-term value of a customer. This index is a continuous scalar with a value range of [0,1], where a higher value indicates a higher long-term customer value. The specific implementation process is as follows:
[0088] Customer value evaluation index calculation: Four core customer value evaluation indicators are calculated based on multi-source data, as follows:
[0089] Power factor: The average power factor over the past three months is used to reflect the rationality and stability of the customer's electricity consumption;
[0090] Customer credit status: Calculated based on payment records, number of overdue payments, and duration of overdue payments over the past year, using a percentage-based quantification.
[0091] Customer relationship level: Based on a comprehensive quantification of customer cooperation years and business development depth, the value range is [0,1].
[0092] Major supplier procurement ratio: The proportion of electricity purchased by a customer from this company to its total electricity consumption, reflecting customer loyalty.
[0093] The standardization of the above four indicators all adopts the Min-Max standardization method, which maps the indicator values to the [0,1] interval to ensure the comparability between indicators.
[0094] Value superiority calculation using the variable-weighted matter-element extension model: The variable-weighted matter-element extension model is used to process the above customer value evaluation indicators. This model can dynamically adjust the weights of each indicator based on the distribution of indicator values, thus more accurately quantifying long-term customer value. The model calculation formula is as follows:
[0095]
[0096] in, Value superiority is a continuous scalar value output by the model, ranging from [0,1], used to quantify the long-term value status of customers. The number of customer value evaluation indicators, in this embodiment =4, : No. The standardized values of each customer value evaluation indicator range from [0,1]. These correspond to power factor, customer credit status, customer relationship level, and the proportion of purchases from major suppliers, respectively. A vector composed of all customer value evaluation indicators, i.e. , : No. The dynamic weighting function for each customer value evaluation indicator has weight values ranging from [0,1] and satisfies the following conditions: This function dynamically adjusts based on the distribution of indicator values. For example, when a customer's power factor is significantly lower than the industry average, the weight of that indicator will be increased accordingly to highlight its negative impact on customer value. The specific form of the dynamic weighting function is as follows:
[0097]
[0098] in, For the first The initial weights of each indicator are determined based on the analytic hierarchy process (AHP). In this embodiment... , For the first The average of each indicator across all customers. The adjustment coefficient is set to 2 in this embodiment to control the sensitivity of weight adjustment;
[0099] The classical domain matrix is used to define the ideal value range of each indicator. In this embodiment, the classical domain matrix is set as follows:
[0100]
[0101] Each row corresponds to the ideal value range of an indicator. : No. An extension correlation function for each customer value evaluation indicator is used to measure the degree of closeness between the indicator value and the classical domain, with a value range of [0,1]. This embodiment uses a linear correlation function, specifically in the following form:
[0102]
[0103] in, For the first Each indicator corresponds to a classical domain range. When the indicator value is within the classical domain, a higher correlation value indicates better indicator performance; when the indicator value exceeds the classical domain, the correlation value decreases as the degree of deviation increases.
[0104] By using the aforementioned variable-weight matter-element extension model and inputting the standardized values of four customer value evaluation indicators, the customer's value superiority can be calculated. This indicator can dynamically and comprehensively reflect the long-term value level of customers.
[0105] Feature Weight Dynamic Learning Network: The feature weight dynamic learning network generates a dynamic feature weight matrix based on the outputs of the long-term weight evolution unit and the short-term weight fine-tuning unit. The specific implementation process is as follows:
[0106] Long-term weighted evolution unit: The long-term weighted evolution unit receives the value superiority output from the customer value dynamic evaluation module. That is, the aforementioned value superiority and user group identifiers The baseline feature weight vector is output by querying the long-term weight lookup table. .
[0107] Specifically, the long-term weighted lookup table is constructed as follows: Value superiority is... The value range [0,1] is divided into 10 intervals, each interval corresponding to a weight level; combined with user group identifiers This embodiment includes three user groups, forming Each weight combination corresponds to a baseline feature weight vector with 872 dimensions. The value of each element in the vector ranges from [0,1], representing the basic importance of the corresponding feature within the user group and value range.
[0108] The initial values of the long-term weight lookup table are determined through offline training: using standardized feature data, value superiority, user group identifiers and corresponding actual electricity purchases from historical data, with the goal of minimizing the electricity purchase prediction error, the initial baseline feature weight vector is obtained through grid search algorithm optimization.
[0109] Short-term weight fine-tuning unit: The short-term weight fine-tuning unit receives the time feature vector output by the time-series context-aware module. The feature weight offset is calculated by fine-tuning the neural network. This fine-tuned neural network uses a feedforward neural network with one hidden layer, an input layer dimension of 872, a sigmoid activation function for the hidden layer, and an output layer dimension of 872.
[0110] Feature weight offset The value range is [-0.2, 0.2], which is used to fine-tune the baseline feature weight vector to adapt to changes in short-term time context. For example, during holidays, the weight offset of residential electricity consumption-related features is positive, increasing the importance of such features; during weekday industrial production periods, the weight offset of industrial electricity consumption-related features is positive.
[0111] Dynamic feature weight matrix calculation: The baseline feature weight vector output by the long-term weight evolution unit. Feature weight offset from the output of the short-term weight fine-tuning unit Adding them together yields the dynamic feature weight matrix. The formula is as follows:
[0112]
[0113] in, The vector has 872 dimensions. In this embodiment, the standardized feature data is a one-dimensional vector, so the dynamic feature weight matrix degenerates into vector form. If the feature data is in matrix form, the weight is a matrix of the corresponding dimension, and each element in the vector represents the dynamic weight of the corresponding feature. To ensure the effectiveness of the weights, the summation result is truncated so that the weight values are limited to the interval [0,1].
[0114] Long-term weighted lookup table update: The long-term weighted lookup table adopts a periodic update mechanism, with an update cycle set to 3 months. The specific update process is as follows:
[0115] Collect and update weighted feature data of all users within the update period, along with corresponding electricity purchase forecasts and actual electricity purchase data.
[0116] Calculate the electricity purchase prediction error for each user; with the goal of minimizing the average prediction error for all users, use gradient descent to optimize the weight vectors of all benchmark features in the long-term weight lookup table.
[0117] During the optimization process, the parameters of the neural network are fixed and only the baseline feature weight vector is updated to ensure the long-term stability of the weights.
[0118] This update mechanism enables the baseline feature weight vector to adapt to the long-term evolution of customer value and electricity consumption patterns, thereby improving the model's long-term predictive performance.
[0119] In this implementation, the generation of weighted feature data and the prediction of electricity purchase volume are carried out as follows:
[0120] Weighted feature data generation: using the dynamic feature weight matrix described above The standardized feature data is weighted using element-wise multiplication, as shown in the following formula:
[0121]
[0122] in, To standardize feature data, This represents element-wise multiplication. This is weighted feature data. This operation increases the weight of important features, allowing them to play a more significant role in subsequent prediction models, while suppressing interference from irrelevant features.
[0123] Electricity purchase prediction model: The electricity purchase prediction model is constructed using Stacking model fusion technology. Through the synergistic effect of multiple heterogeneous basic prediction models at the bottom layer and the upper-layer meta-learner, the prediction accuracy and generalization ability are improved. The specific implementation is as follows:
[0124] The underlying basic prediction model includes two heterogeneous basic prediction models: the gradient boosting tree model and the long short-term memory network model. The two types of models capture data features from different perspectives and complement each other.
[0125] Gradient Boosting Tree Model: Employing the XGBoost algorithm, this model effectively captures non-linear correlations and high-order interaction features between features. The model hyperparameters are set as follows: number of decision trees: 100-300; tree depth: 3-8 layers; learning rate: adaptive adjustment strategy; regularization coefficient: determined based on cross-validation results. The model takes weighted feature data as input and outputs preliminary predictions of daily electricity purchases.
[0126] Long Short-Term Memory (LSTM) network model: This model effectively captures long- and short-term dependencies in time-series data, making it suitable for processing the time-series characteristics of electricity consumption data. The network structure is as follows: it contains 2-4 LSTM hidden layers, with 64-256 hidden units per layer. Dropout is used to prevent overfitting, and the output layer is a fully connected layer. The model input is a time-series sequence composed of weighted feature data, and the output is a preliminary prediction of daily electricity purchases.
[0127] Upper-level meta-learner: The upper-level meta-learner adopts a linear regression model, which has a simple structure, strong interpretability, and can effectively integrate the prediction results of multiple base models. The model takes a two-dimensional vector composed of the preliminary prediction results of two base prediction models as input, optimizes the model parameters through the least squares method, and outputs the final electricity purchase prediction result.
[0128] Specifically, let the preliminary prediction result of the gradient boosting tree model be... The preliminary prediction results of the LSTM model are as follows: The output of the meta-learner is The formula for the linear regression model is as follows:
[0129]
[0130] in, and These are the weighting coefficients of the prediction results from the two base models. This is the bias term. During model training, optimization is achieved through cross-validation. , and The value of is determined to ensure the accuracy of the final prediction result.
[0131] Online Learning and Model Updates: To address concept drift in electricity marketing scenarios, this method establishes an online learning and model update mechanism, implemented as follows:
[0132] Continuously monitor the prediction error of the electricity purchase forecasting model: adopt a sliding window mechanism, with 7 days as a statistical period, and calculate the average prediction error in each period;
[0133] Concept drift determination: A preset prediction error threshold is set. When the average prediction error of three consecutive statistical periods exceeds this threshold, concept drift is determined to have occurred.
[0134] Model Update: In response to concept drift detection, an incremental learning algorithm is used to update the short-term weight fine-tuning unit in the feature weight dynamic learning network and the meta-learner in the electricity purchase prediction model. During the update process, recent mini-batch data is used for training, while the parameters of the long-term weight evolution unit and the underlying basic prediction model are fixed. Only the parameters of the short-term weight fine-tuning unit and the meta-learner are updated.
[0135] This update mechanism can quickly adapt to changes in data distribution while ensuring model stability, thus ensuring the continued accuracy of the prediction model.
[0136] In summary, the machine learning-based precision electricity marketing forecasting method in this embodiment achieves dynamic adaptive adjustment of feature weights through a dynamic feature weight learning network, capturing both the long-term evolution trend of customer value and adapting to short-term changes in time context; it improves prediction accuracy through Stacking model fusion technology; and it enhances the robustness of the model through an online learning mechanism.
[0137] In practical application tests, the method's average absolute percentage error in predicting daily electricity purchases for industrial, commercial, and residential users is less than 4%. Compared with existing prediction methods based on static feature weights, the prediction accuracy is improved by 15%-20%, demonstrating significant practical application value.
[0138] Example 2
[0139] like Figure 3 As shown, based on the machine learning-based precision electricity marketing forecasting method described in Embodiment 1, this embodiment elaborates on the specific workflow of this method in practical applications. This workflow embodiment is presented in step-by-step form to clearly demonstrate the execution sequence and key operational steps of the method.
[0140] In some optional implementations, the workflow of the machine learning-based precision electricity marketing forecasting method includes the following detailed steps:
[0141] Step 1: Multi-source data acquisition
[0142] Specifically, multi-source data is collected from the electricity marketing system and related external data sources. This multi-source data mainly includes two categories: user-side data and environmental and temporal data. User-side data is collected from sources including historical daily electricity consumption data recorded by smart meters, user profile data, unstructured text data from the customer service work order system, and payment and credit data from the financial system. Environmental and temporal data is collected from sources including daily meteorological data provided by meteorological departments and standard calendar information. For example, the collection period for historical daily electricity consumption data can be set to the past three years, and the collection frequency of meteorological data and electricity consumption data should be consistent, for example, once daily, to ensure time-series data alignment. It is understood that preliminary data quality control is required during the data collection process. For example, outlier detection methods based on statistical principles are used to identify and process extreme values in the electricity consumption data, and interpolation methods are used to fill in any missing meteorological data to ensure the completeness and validity of the input data.
[0143] Step 2: Multi-source data fusion processing
[0144] The multi-source data collected in Step 1 is fused to transform heterogeneous data into unified, standardized feature data, providing consistent and effective input for subsequent models. This includes the following sub-steps:
[0145] First, the unstructured text data in the user-side data is vectorized. In some optional implementations, a pre-trained word embedding model, such as the BERT model, is used to extract semantic vectors from the cleaned text, resulting in text semantic feature vectors.
[0146] Secondly, the calendar information in the environmental and time data is encoded. Specifically, a sine-cosine encoding method is used to generate periodic encoding vectors for time dimensions such as year, month, day, hour, and minute. At the same time, holiday markers and seasonal factors are extracted to jointly form the time encoding vector.
[0147] Next, frequency domain transformation is performed on the historical daily electricity consumption data from the user side. For example, discrete cosine transform is used to process the electricity consumption sequence, identify its key fluctuation periods, and extract the first few DCT coefficients with higher amplitudes to form a periodic feature vector.
[0148] Finally, the aforementioned text semantic feature vector, temporal encoding vector, periodic feature vector, and other numerical features from the user-side data are concatenated to form an initial feature vector. This initial feature vector is then standardized, for example using Z-score standardization, to eliminate dimensional differences between different features, ultimately yielding standardized feature data. It is understandable that standardization helps improve the stability and convergence speed of subsequent model training.
[0149] Step 3: Dynamic Learning of Feature Weights
[0150] The standardized feature data obtained in step two is input into a pre-trained dynamic feature weight learning network to obtain a dynamic feature weight matrix. The core of this network lies in its ability to dynamically adjust feature weights based on short-term temporal context and long-term customer value.
[0151] Specifically, the driving force of the feature weight dynamic learning network relies on two modules: a temporal context awareness module and a customer value dynamic evaluation module.
[0152] The temporal context awareness module receives current time information and maps it into a temporal feature vector through a time encoder. This vector is used to characterize the potential influence patterns of short-term time factors on the importance of various features.
[0153] The dynamic customer value assessment module calculates several customer value evaluation indicators based on multi-source data, such as power factor, customer credit status, customer relationship level, and the proportion of purchases from major suppliers. These indicators are then processed using a variable-weight matter-element extension model. The weights of this model can be dynamically adjusted according to the actual distribution of indicator values, rather than remaining fixed, thus more accurately quantifying the long-term value status of customers and outputting a continuous value scalar.
[0154] The dynamic feature weight learning network internally comprises a long-term weight evolution unit and a short-term weight fine-tuning unit. The long-term weight evolution unit, based on the value superiority and user group identifiers output by the customer value dynamic assessment module, queries a long-term weight lookup table and outputs a baseline feature weight vector. This vector reflects the feature importance benchmark based on long-term customer value. The short-term weight fine-tuning unit, based on the time feature vector output by the temporal context awareness module, calculates a feature weight offset using a fine-tuning neural network. This offset is used to fine-tune the baseline weights for short-term scenarios. Finally, the baseline feature weight vector and the feature weight offset are added to obtain the dynamic feature weight matrix.
[0155] It is understandable that the long-term weighted lookup table itself is not static, but rather it is periodically updated by collecting the prediction error based on the latest data and optimizing it with the goal of minimizing the error, thereby capturing the long-term evolution trend of customer value and electricity consumption patterns.
[0156] Step 4: Generation of Weighted Feature Data
[0157] The standardized feature data from step two is weighted using the dynamic feature weight matrix obtained in step three. Specifically, each feature value in the standardized feature data is multiplied by its corresponding dynamic weight to generate weighted feature data. This step aims to strengthen features more important to the current prediction task while weakening the interference of secondary or irrelevant features, making the data input to the prediction model more discriminative.
[0158] Step 5: Electricity Purchase Forecast
[0159] The weighted feature data generated in step four is input into the electricity purchase prediction model to obtain the final electricity purchase prediction result. The electricity purchase prediction model is constructed using Stacking model fusion technology.
[0160] Specifically, the model comprises two parts: a bottom layer and an upper layer. The bottom layer consists of multiple heterogeneous base prediction models, such as gradient boosting tree models and long short-term memory network models. These base models learn from weighted feature data from different perspectives and output preliminary electricity purchase prediction results. The upper layer is a meta-learner, such as a linear regression model, whose input is a combination of the preliminary prediction results output by all the bottom base models. The meta-learner is responsible for weighting and fusing these preliminary results to output a final, more accurate electricity purchase prediction value. In some optional implementations, the parameters of the bottom base models and the upper meta-learner are determined through training and cross-validation using historical data.
[0161] Step Six: Online Learning and Model Updates
[0162] To address potential concept drift in practical applications, this method also incorporates online learning and model update mechanisms.
[0163] Specifically, the prediction error of the electricity purchase forecasting model on the latest data is continuously monitored. When the prediction error exceeds a preset threshold for several consecutive periods, concept drift is determined to have occurred. Once concept drift is determined, the model update process is triggered. In response to the update trigger, an incremental learning algorithm is used to update the parameters of the short-term weight fine-tuning unit in the feature weight dynamic learning network and the meta-learner in the electricity purchase forecasting model using recent small batches of data. In related technologies, this update process typically fixes the parameters of the long-term weight evolution unit and the parameters of the underlying basic prediction model, updating only the short-term adaptive part and the meta-learner. This allows for rapid adaptation to new data patterns while maintaining the stability of the core model structure, ensuring the continuity of prediction accuracy.
[0164] Through the complete workflow consisting of the above six steps, the method of the present invention realizes a closed loop from data preparation, dynamic feature weighting to accurate prediction and model adaptation, effectively improving the accuracy and environmental adaptability of electricity purchase forecasting in electricity marketing.
[0165] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any way. Although the present invention has been disclosed above with reference to preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art can make some modifications or alterations to the above-disclosed technical content to create equivalent embodiments without departing from the scope of the present invention. Any simple modifications, equivalent changes and alterations made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the scope of the present invention.
Claims
1. A precise electricity marketing forecasting method based on machine learning, characterized in that, Includes the following steps: Step 1: Collect multi-source data from the electricity marketing system, including user-side data, environmental data, and time data. Step 2: Perform fusion processing on the multi-source data to obtain standardized feature data; Step 3: Input the standardized feature data into the pre-trained feature weight dynamic learning network to obtain the dynamic feature weight matrix. The feature weight dynamic learning network is jointly driven by the output of the temporal context awareness module and the output of the customer value dynamic evaluation module to generate the dynamic feature weight matrix. Step 4: Use the dynamic feature weight matrix to weight the standardized feature data to generate weighted feature data; Step 5: Input the weighted feature data into the electricity purchase forecasting model to obtain the electricity purchase forecasting result; The time-series context awareness module is used to extract time feature vectors, and the customer value dynamic assessment module is used to calculate the value superiority reflecting the long-term value of customers.
2. The machine learning-based precision electricity marketing forecasting method according to claim 1, characterized in that, Step two, which involves fusing multi-source data to obtain standardized feature data, specifically includes: For unstructured text data in user-side data, a pre-trained word embedding model is used to vectorize it to obtain text semantic feature vectors; Calendar information in environmental and time data is encoded to obtain a time encoding vector, which includes periodic codes, holiday markers, and seasonal factors. Discrete cosine transform is performed on historical daily electricity consumption data from the user side to identify key fluctuation cycles and extract cycle feature vectors. The text semantic feature vector, time encoding vector, periodic feature vector, and other numerical features in the user-side data are concatenated and standardized to form the standardized feature data.
3. The precise electricity marketing forecasting method based on machine learning according to claim 1, characterized in that, The time-series context-aware module extracts time feature vectors, specifically as follows: The time-series context awareness module receives current time information, which includes year, month, day, hour, minute, and holiday markers. The current time information is mapped into a time feature vector by a time encoder, which is implemented using a multi-layer feedforward neural network. The time feature vector is used to characterize the influence pattern of short-term time context on the feature weights of electricity marketing.
4. The machine learning-based precision electricity marketing forecasting method according to claim 1, characterized in that, The customer value dynamic assessment module calculates the value excellence, specifically including: Customer value evaluation indicators are calculated based on the multi-source data. These indicators include power factor, customer credit status, customer relationship level, and the proportion of purchases from major suppliers. The customer value evaluation index is processed using a variable-weighted extensibility model, and the weights of the variable-weighted extensibility model are dynamically adjusted according to the distribution of index values. The variable-weighted material element extension model outputs the value superiority, which is a continuous scalar used to quantify the long-term value status of customers. The calculation process of the variable weight matter-element extension model is as follows: in, Indicates the degree of value excellence. This indicates the number of customer value evaluation indicators. Indicates the first Standardized values of individual customer value evaluation indicators. This represents a vector composed of all customer value evaluation indicators. Indicates the first Dynamic weighting function for each customer value evaluation indicator. Represents a classical field matrix. Indicates the first Extensional correlation function for customer value evaluation indicators.
5. The precise electricity marketing forecasting method based on machine learning according to claim 1, characterized in that, The dynamic feature weight learning network in step three generates a dynamic feature weight matrix, specifically including: The feature weight dynamic learning network includes a long-term weight evolution unit and a short-term weight fine-tuning unit; The long-term weight evolution unit receives the value superiority and user group identifier output by the customer value dynamic evaluation module, queries the long-term weight lookup table, and outputs the benchmark feature weight vector. The short-term weight fine-tuning unit receives the time feature vector output by the time context awareness module and calculates the feature weight offset by fine-tuning the neural network. The dynamic feature weight matrix is obtained by adding the baseline feature weight vector to the feature weight offset. Wherein, the dynamic feature weight matrix Calculated using the following formula: in, The baseline feature weight vector, output by the long-term weighted evolution unit, represents the value superiority. and user group identifiers The function, This represents the feature weight offset output by the short-term weight fine-tuning unit, and is a time feature vector. The function.
6. The machine learning-based precision electricity marketing forecasting method according to claim 5, characterized in that, The update method for the long-term weight lookup table is as follows: Regularly collect weighted feature data of all users within a set time period and the error between the corresponding predicted and actual electricity purchases; With the goal of minimizing the error, the gradient descent method is used to optimize all the benchmark feature weight vectors in the long-term weight lookup table; The update cycle of the long-term weight lookup table is longer than the update cycle of the electricity purchase prediction model.
7. The precise electricity marketing forecasting method based on machine learning according to claim 1, characterized in that, The electricity purchase prediction model is constructed using Stacking model fusion technology, specifically including: The underlying layer includes multiple heterogeneous basic prediction models, including gradient boosting tree models and long short-term memory network models. The upper layer includes a meta-learner that employs a linear regression model; The basic prediction model takes the weighted feature data as input and outputs preliminary prediction results. The meta-learner takes the combination of preliminary prediction results from all basic prediction models as input and outputs the final electricity purchase prediction result.
8. The precise electricity marketing forecasting method based on machine learning according to claim 1, characterized in that, The method further includes: Step Six: Online Learning and Model Update: Continuously monitor the prediction error of the electricity purchase prediction model on the latest data. When the prediction error continuously exceeds a preset threshold, it is determined that concept drift has occurred. In response to the determination of concept drift, an incremental learning algorithm is used to update the short-term weight fine-tuning unit in the feature weight dynamic learning network and the meta-learner in the electricity purchase prediction model. The incremental learning algorithm uses recent small-batch data and fixes the parameters of the long-term weight evolution unit in the feature weight dynamic learning network.
Citation Information
Patent Citations
Precise power marketing method based on machine learning
CN118941319A