A context learning-based incremental user portrait method and system

By constructing incremental user profiling task pairs and existing context task pairs, the user profiling model is endowed with context learning capabilities, which solves the problem of the strong dependence of incremental user profiling on historical data, realizes high-precision profiling with small samples, and adapts to the actual scenario of increasing number of users and changes in electricity consumption characteristics in the power grid.

CN122432392APending Publication Date: 2026-07-21GUANGDONG POWER GRID CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
GUANGDONG POWER GRID CO LTD
Filing Date
2026-04-30
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

Existing incremental user profiling methods are highly dependent on incremental user load data, and can only work stably when there is a certain amount of historical incremental user data. Furthermore, the accuracy of profiling is insufficient when faced with small sample load data, and cannot support precise power grid planning.

Method used

The context-based incremental user profiling method constructs incremental user profiling task pairs and combines them with existing context task pairs to form test samples. It then uses a pre-trained user profiling model to obtain profiling results. During the model pre-training phase, context task pairs, task matrices, and training data pools are constructed using existing user historical data, giving the user profiling model context learning capabilities.

Benefits of technology

It enables small-sample, high-precision profiling of incremental users, breaking through the limitation of historical data volume for incremental users, improving the accuracy and applicability of the profiling, and adapting to the actual scenario of increasing user numbers and changing electricity consumption characteristics in the power grid.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122432392A_ABST
    Figure CN122432392A_ABST
Patent Text Reader

Abstract

The application discloses a kind of based on context learning's incremental user portrait method and system, belong to electric power system user portrait technical field, the method is: based on the small sample load data of to-be-tested incremental user construction incremental user portrait task pair;Obtain several current context task pairs, and incremental user portrait task pair and several current context task pairs are combined to form test sample;Based on test sample and pre-trained user portrait model, obtain incremental user portrait result;Pre-training process includes: obtaining the stock historical load data sequence set of several stock users;Based on stock historical load data sequence set, preset historical window length and preset future window length, construct the preset portrait model training data pool corresponding to several stock users;The pre-constructed basic portrait model is trained based on preset portrait model training data pool, and user portrait model is obtained, therefore, by implementing the application, small sample, high-precision portrait to incremental user can be realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of power system user profiling technology, and in particular to an incremental user profiling method and system based on context learning. Background Technology

[0002] With the rapid development of new power systems and the large-scale integration of distributed energy resources, power load characteristics are becoming increasingly complex. User-side electricity consumption behavior is exhibiting significant diversification and dynamism. Traditional power grid planning methods, relying on historical load data sequences and typical load curves, are no longer adequate to adapt to the rapid changes and personalized electricity consumption characteristics of newly connected users. Incremental user profiling technology is gradually becoming a key means to support precise power grid planning. Addressing the core issue of accurately describing electricity consumption characteristics under small sample load data for incremental user profiling, existing technologies have developed various approaches. These mainly include load characteristic index methods and similar day matching methods based on statistical learning; load pattern clustering methods based on clustering and template matching; fuzzy matching and weighted fusion methods; and parameter transfer methods and feature transfer methods based on transfer learning. These methods often characterize the similarity between incremental and existing users through Pearson correlation coefficients or Euclidean distance, or assume that incremental and existing user load data are co-distributed and achieve data alignment through simple transformations, attempting to create a profiling of incremental user electricity consumption characteristics.

[0003] However, existing incremental user profiling technologies have significant technical shortcomings in practical power grid applications, making it difficult to meet the actual needs of precise power grid planning. Most existing methods require a certain amount of historical load data sequences of incremental users to ensure the stable operation of the profiling work. They are highly dependent on incremental user load data and can only work stably when there is a certain amount of historical data of incremental users. However, in real-world scenarios, newly connected incremental users often only have a small sample of load data available, and their electricity consumption patterns may be fundamentally different from those of existing users. Furthermore, their electricity consumption characteristics also exhibit rapid changes. This strong dependence of traditional methods on incremental user load data significantly reduces the accuracy of their profiling, making it impossible to provide effective data support for precise power grid planning. The accuracy and applicability of incremental user profiling are difficult to match the actual requirements of power grid planning under the new power system. Summary of the Invention

[0004] This invention provides an incremental user profiling method and system based on context learning, which can solve the technical problems of existing incremental user profiling methods that are highly dependent on incremental user load data, can only work stably when there is a certain amount of incremental user historical data, and have insufficient profiling accuracy when faced with small sample load data of incremental users, thus failing to support precise power grid planning. This invention achieves small sample, high-precision profiling of incremental users.

[0005] This invention provides an incremental user profiling method based on context learning, comprising: The task of constructing incremental user profiles is based on the pre-acquired small sample load data of incremental users to be tested and the preset future window length. Several current context task pairs are obtained based on the training data pool of the preset profile model and the preset selection rules. The incremental user profile task pairs and the several current context task pairs are combined to form test samples. Incremental user profile results are obtained based on the test samples and the pre-trained user profile model. The pre-training process of the user profile model includes: Obtain a set of historical load data sequences for several existing users; For any existing user, several context task pairs are obtained based on the existing historical load data sequence set, the preset historical window length, and the preset future window length, and a context task matrix is ​​constructed based on the several context task pairs. The preset profile model training data pool is constructed based on several context task matrices corresponding to several existing users. The pre-constructed basic profile model is trained based on the preset profile model training data pool to obtain the user profile model.

[0006] This invention provides an incremental user profiling method based on context learning. It constructs incremental user profiling task pairs and combines existing context task pairs to form test samples, thereby obtaining profiling results based on a pre-trained user profiling model. The pre-training stage of the user profiling model utilizes existing user historical data to construct context task pairs, task matrices, and a training data pool to complete model training, endowing the user profiling model with context learning capabilities. This allows the user profiling model to learn the general patterns of load data changes from existing user historical load data sequences, and then interpret small sample data of incremental users based on these patterns. This solves the technical problems of existing incremental user profiling methods, such as strong dependence on incremental user load data, stable operation only with a certain amount of incremental user historical data, and insufficient profiling accuracy when faced with small sample load data of incremental users, thus failing to support precise power grid planning. This invention achieves high-precision profiling of incremental users with small samples, breaking through the limitations of traditional methods on the amount of incremental user historical data.

[0007] Furthermore, the task of constructing an incremental user profile based on pre-acquired small sample load data of incremental users to be tested and a preset future window length includes: Several small sample load data are obtained based on the pre-acquired small sample load data of incremental users to be tested; Several small sample load data are used as the current historical window, and the current future window is constructed based on the preset future window length and the preset zero placeholder. Then, an incremental user profile task pair is constructed based on the current historical window and the current future window.

[0008] The above scheme uses small sample workload data of incremental users as historical windows and constructs future windows with zero placeholders to form incremental profiling task pairs. This allows small sample data of incremental users to be effectively used as model input, ensuring that incremental profiling task pairs can be adapted and combined with context task pairs of existing users. This provides basic data support that conforms to input specifications for the model to accurately output incremental user profiling results.

[0009] Furthermore, the step of obtaining several current context task pairs based on a preset user profile model training data pool and preset selection rules, and combining the incremental user profile task pairs with the several current context task pairs to form test samples includes: Obtain the number of candidate task pairs, and randomly select several current context task pairs from the preset portrait model training data pool based on the number of candidate task pairs; The incremental user profiling task pairs and several current context task pairs are combined to form a test sample.

[0010] The above scheme determines the number of candidate task pairs according to preset rules and randomly selects existing context task pairs from the training data pool. These are then combined with incremental profiling task pairs to form test samples. Through fixed selection and combination rules, the input dimensions of the test samples are ensured to be consistent with the input dimensions required by the model. This solves the technical problem of dimension mismatch and the inability of the model to effectively perform context learning and reasoning when incremental profiling task pairs are input into the user profiling model alone. This enables the user profiling model to complete the profiling reasoning of incremental users with the help of existing user context task pairs, ensuring the stability and effectiveness of the user profiling process.

[0011] Further, for any existing user, obtaining several context task pairs based on the existing historical load data sequence set, a preset historical window length, and a preset future window length, and constructing a context task matrix based on the several context task pairs, includes: For any of the aforementioned existing users: Based on the existing historical load data sequence set, obtain the historical load data sequence of the existing user, and obtain the historical data length corresponding to the historical load data sequence; The number of context tasks is obtained based on the historical data length, the preset historical window length, and the preset future window length. For any current task pair position in the context task count, a stock historical window is constructed based on the context task count, historical load data sequence, and preset historical window length; a stock future window is constructed based on the context task count, historical load data sequence, preset historical window length, and preset future window length; and a context task pair is obtained based on the stock historical window and stock future window. Obtain several context task pairs corresponding to the number of context tasks, perform position encoding on several context task pairs, obtain position encoding sequences, and construct a context task matrix based on the position encoding sequences and several context task pairs.

[0012] The above solution accurately calculates the number of context tasks for existing users. It constructs context task pairs using a sliding window approach and combines this with location encoding to build a context task matrix. This effectively identifies the location information of existing users and context task pairs, enabling the user profile model to recognize the temporal and attribution characteristics of different task pairs. The method of constructing task pairs fully explores the temporal patterns of historical load data sequences of existing users, solving the technical problem of traditional methods that directly map sequences to sequences, allowing the model to learn only static mapping relationships and resulting in poor generalization. At the same time, by constructing a structured task matrix, the user profile model can effectively learn the load data patterns of existing users, improving its ability to learn dynamic mapping patterns of load data.

[0013] Further, the step of training the pre-constructed basic profile model based on the preset profile model training data pool to obtain the user profile model includes: Based on the preset fixed context sampling strategy and the preset profile model training data pool, the context sampling action is repeatedly performed to obtain a number of training samples; Based on several training samples and a preset sample division ratio, a portrait training set and a portrait verification set are obtained; The pre-built basic profile model is trained based on the profile training set and profile verification set to obtain the user profile model; The context sampling action includes: The current sample task position is randomly selected based on the training data pool of the preset portrait model, and the current training task is obtained based on the current sample task position; The training task future window of the current training task is initialized based on the initial placeholder, the training sample historical load data sequence of the current training task is used as the training task historical window, and the training profile task is constructed based on the training task historical window and the training task future window. Based on the current sample task position and the number of candidate task pairs, obtain several forward training samples, and based on the several forward training samples, obtain the training sample context task. Training samples are constructed based on the training sample context task and training profile task.

[0014] The above scheme uses a fixed context sampling strategy to obtain training samples from the training data pool. After dividing the training set and validation set, the model is trained. During the sampling process, placeholders are initialized for the future window of the training task and a training profile task is constructed. At the same time, forward training samples are obtained to form a training sample context task. This ensures that the length of the training sample data input to the model is fixed each time, which solves the technical problem of unstable batch training and low training efficiency caused by inconsistent sample dimensions during model training. Furthermore, by dividing the training set and validation set, the model performance can be evaluated in real time during training, avoiding model overfitting and ensuring the effectiveness and stability of model training.

[0015] Further, the step of obtaining several forward training samples based on the current sample task position and the number of candidate task pairs, and obtaining the training sample context task based on the several forward training samples, includes: Based on the current sample task position and the number of candidate task pairs, obtain several forward training samples; For any of the forward training samples, the sample history load data sequence of the forward training samples is used as the sample history window, and the real value data of the forward training samples is used as the sample future window. A sample context task pair is constructed based on the sample history window and the sample future window. Obtain several sample context task pairs corresponding to several forward training samples, and use several sample context task pairs as training sample context tasks.

[0016] The above scheme obtains forward training samples from the current sample task position, and constructs context task pairs by using the historical load data sequence and the true value of the forward training samples as the sample history window and future window, respectively. These context task pairs are then used as training sample context tasks. The resulting training sample context task pairs retain the true temporal sequence and numerical patterns of the existing user load data. This solves the technical problems of the lack of real data support for the construction of training sample context task pairs and the inability of the model to effectively learn the true mapping patterns of load data. As a result, the user profiling model can learn the dynamic change patterns of load data from real existing user data, further improving the learning effect and profiling accuracy of the user profiling model.

[0017] Further, the step of obtaining several sample context task pairs corresponding to several of the forward training samples, and using several sample context task pairs as training sample context tasks, includes: Obtain several sample context task pairs corresponding to several of the aforementioned forward training samples; When the number of forward training samples is insufficient based on the current sample task position and the number of candidate task pairs, the sample supplementation context task pairs are filled based on the preset mask context task pairs and several sample context task pairs to obtain a sample supplementation context task pair sequence. The sample is used to complete the context task pair sequence as the training sample context task.

[0018] The above solution addresses the technical problem of insufficient forward training samples due to the early position of sample tasks, which in turn affects batch training of the model. This is achieved by using pre-defined masked context task pairs to fill in the gaps when the number of forward training samples is insufficient. The filled task pairs are masked so as not to affect model training and optimization.

[0019] Further, the step of training the pre-built basic profile model based on the profile training set and profile verification set to obtain the user profile model includes: The user profile training set is input into the pre-built basic profile model in batches for repeated parameter optimization training. After the parameter optimization training, a verification counting operation is performed to obtain the current count value. The parameter optimization training is stopped when the preset condition of minimizing the profile error is met based on the current count value and the preset optimization threshold. The forward model parameters are then obtained, and the user profile model is obtained based on the forward model parameters. Specifically, the verification counting operation includes: Obtain the current model optimization parameters, and obtain the verification profile value based on the profile verification set, the current model optimization parameters, and the basic profile model; The true value is obtained based on the image verification set, and the current image error is calculated based on the true value and the verification image value. When it is determined that the current image error is not less than the preset forward image error, the current model optimization parameters are not saved, and the current count value is obtained by counting and accumulating based on the pre-acquired forward count value.

[0020] The above scheme improves the model's efficiency in processing large-scale training data by training in batches, and combines validation counting operations to monitor the model's training effect in real time. It solves the technical problems of overfitting, failure to converge accurately to the minimum portrait error, and inability to effectively select the optimal model parameters during training in traditional model training. This allows the model to continuously optimize parameters and retain the optimal parameters during training, ensuring that the final portrait error of the model reaches the minimum.

[0021] Furthermore, after obtaining the true value based on the image verification set and calculating the current image error based on the true value and the verification image value, the method further includes: When it is determined that the current image error is less than the preset forward image error, the pre-acquired forward count value is set to zero to obtain the current count value, and the current model optimization parameters are used as forward model parameters, and the current image error is used as the preset forward image error.

[0022] The above scheme sets the count to zero and saves the current optimized model parameters as forward model parameters for subsequent training when the current profile error is less than the preset forward profile error. This allows the model to retain better model parameters in a timely manner during training, solving the technical problem that the final model parameters may not be optimal if the optimal parameters are not updated in time during model training. At the same time, the rule of setting the count to zero allows the model to continue training to explore smaller profile errors, avoiding the model from stopping training too early, and further ensuring that the model can converge to the minimum profile error and obtain the optimal user profile model.

[0023] This invention provides an incremental user profiling method based on context learning. The entire process involves processing historical load data sequences of existing users, constructing context task pairs and a training data pool, employing a fixed-length context sampling strategy to achieve accurate model training, and then constructing adapted profiling task pairs for small sample data of incremental users, combining existing context task pairs to form test samples, and completing model inference. Firstly, it endows the user profiling model with powerful context learning capabilities, enabling it to learn the general patterns of load data changes from existing user data. This breaks through the dependence of traditional methods on the amount of historical load data sequences of incremental users, achieving high-precision profiling using only small sample load data of incremental users. Secondly, through fixed-length sampling and masking... This invention employs a series of training strategies, including code generation, batch training, and validation counting, to ensure batch processing stability and training efficiency of the model. Simultaneously, it allows the model to converge to the minimum profiling error, effectively avoiding overfitting and improving generalization and profiling accuracy. Furthermore, this invention does not require the assumption that the load data of incremental users and existing users are distributed identically. It can dynamically adapt to the electricity consumption pattern characteristics of incremental users through contextual examples, solving the problem of traditional transfer learning methods failing when data distribution shifts. In addition, new existing users can be added to the training data pool at any time without retraining the model, enabling continuous knowledge accumulation of the user profiling model. This allows the constructed user profiling model to adapt to the actual scenario of continuously increasing user numbers and constantly changing electricity consumption characteristics in the power grid. In summary, this invention achieves accuracy, efficiency, and scalability in incremental user profiling under small sample scenarios, significantly improving the quality and practicality of incremental user profiling, providing reliable technical support for precise power grid planning, and effectively solving the core problems of insufficient accuracy, poor adaptability, and low training efficiency of traditional incremental user profiling methods in actual power grid scenarios.

[0024] This invention also provides an incremental user profiling system based on context learning, comprising a preprocessing module, a sample combination module, and a user profiling module, wherein: The preprocessing module is used to construct incremental user profile task pairs based on the pre-acquired small sample load data of incremental users to be tested and the preset future window length. The sample combination module is used to obtain several current context task pairs based on a preset profile model training data pool and preset selection rules, and to combine the incremental user profile task pairs and several current context task pairs to form test samples. The user profiling module is used to obtain incremental user profiling results based on the test samples and the pre-trained user profiling model. The user profiling module is also used to perform the pre-training process of the user profiling model. Specifically, the user profiling module is also used to obtain a set of existing historical load data sequences of existing users; for any existing user, obtain a set of context task pairs based on the set of existing historical load data sequences, a preset historical window length, and a preset future window length, and construct a context task matrix based on the set of context task pairs; construct the preset profiling model training data pool based on the context task matrices corresponding to the existing users; and train the pre-constructed basic profiling model based on the preset profiling model training data pool to obtain the user profiling model.

[0025] This invention provides an incremental user profiling system based on context learning. It constructs incremental user profiling task pairs through a preprocessing module and a sample combination module, and combines existing context task pairs to form test samples. The user profiling module then obtains profiling results based on a pre-trained user profiling model. During the pre-training phase of the user profiling model, the module constructs context task pairs, a task matrix, and a training data pool using historical data of existing users to complete model training. This endows the user profiling model with context learning capabilities, enabling it to learn the general patterns of load data changes from historical load data sequences of existing users. Based on these patterns, it can interpret small sample data of incremental users, solving the technical problems of existing incremental user profiling methods that are highly dependent on incremental user load data, can only work stably with a certain amount of historical incremental user data, and have insufficient profiling accuracy when faced with small sample load data of incremental users, thus failing to support precise power grid planning. This system achieves high-precision profiling of incremental users with small samples, breaking through the limitations of traditional methods on the amount of historical incremental user data.

[0026] Furthermore, the preprocessing module includes a data acquisition submodule and a user profile task pair construction submodule, wherein: The data acquisition submodule is used to acquire several small sample load data based on the pre-acquired small sample load data of incremental users to be tested; The user profile task pair construction submodule is used to take several of the small sample load data as the current historical window, and construct the current future window based on the preset future window length and the preset zero placeholder, and then construct the incremental user profile task pair based on the current historical window and the current future window.

[0027] Furthermore, the sample combination module includes a context task pair acquisition submodule and a test sample formation submodule, including: The context task pair acquisition submodule is used to acquire the number of candidate task pairs and randomly select several current context task pairs from the preset portrait model training data pool based on the number of candidate task pairs. The test sample forming submodule is used to combine the incremental user profile task pairs and several current context task pairs to form test samples.

[0028] Furthermore, the user profiling module includes a context task matrix construction submodule. This submodule is used to, for any existing user, obtain several context task pairs based on the existing historical load data sequence set, a preset historical window length, and a preset future window length, and construct a context task matrix based on these context task pairs. Specifically, the context task matrix construction submodule is used to: for any existing user: obtain the historical load data sequence of the existing user based on the existing historical load data sequence set, and obtain the historical data length corresponding to the historical load data sequence; based on the historical data length and the preset historical window length... The system obtains the number of context tasks based on the degree and a preset future window length; for any current task pair position in the context task number, it constructs a stock historical window based on the context task number, historical load data sequence, and preset historical window length, and constructs a stock future window based on the context task number, historical load data sequence, preset historical window length, and preset future window length, and obtains context task pairs based on the stock historical window and stock future window; it obtains several context task pairs corresponding to the context task number, performs position encoding on several context task pairs, obtains a position encoding sequence, and constructs a context task matrix based on the position encoding sequence and several context task pairs.

[0029] Further, the user profiling module includes a model training submodule, which is used to train a pre-built basic profiling model based on the preset profiling model training data pool to obtain a user profiling model. Specifically, the model training submodule is used to: repeatedly perform context sampling based on a preset fixed context sampling strategy and the preset profiling model training data pool to obtain several training samples; obtain a profiling training set and a profiling validation set based on the several training samples and a preset sample division ratio; and train the pre-built basic profiling model based on the profiling training set and the profiling validation set to obtain a user profiling model; wherein, the context sampling action includes... The following steps are taken: 1) Randomly select the current sample task position based on the preset profile model training data pool, and obtain the current training task based on the current sample task position; 2) Initialize the future window of the current training task based on the initial placeholder, use the historical load data sequence of the current training task training samples as the historical window of the training task, and construct the training profile task based on the historical window and the future window of the training task; 3) Obtain several forward training samples based on the current sample task position and the number of candidate task pairs, and obtain the training sample context task based on the several forward training samples; 4) Construct training samples based on the training sample context task and the training profile task.

[0030] Furthermore, the model training submodule includes a training sample context task acquisition unit. This unit acquires several forward training samples based on the current sample task position and the number of candidate task pairs, and acquires training sample context tasks based on these forward training samples. Specifically, the training sample context task acquisition unit is used to: acquire several forward training samples based on the current sample task position and the number of candidate task pairs; for any forward training sample, use the sample history load data sequence of the forward training sample as a sample history window, use the real value data of the forward training sample as a sample future window, construct sample context task pairs based on the sample history window and the sample future window; acquire several sample context task pairs corresponding to several forward training samples, and use these sample context task pairs as training sample context tasks.

[0031] Furthermore, when the training sample context task acquisition unit acquires the sample context task pairs corresponding to the several forward training samples and uses the several sample context task pairs as training sample context tasks, specifically, the training sample context task acquisition unit is used to: acquire the sample context task pairs corresponding to the several forward training samples; when it is determined that the number of forward training samples is insufficient based on the current sample task position and the number of candidate task pairs, fill in the blanks based on the preset mask context task pairs and the several sample context task pairs to acquire a sample fill-in context task pair sequence; and use the sample fill-in context task pair sequence as training sample context tasks.

[0032] Furthermore, the model training submodule also includes an optimization training unit. This optimization training unit trains a pre-built basic profile model based on the profile training set and the profile validation set to obtain a user profile model. Specifically, the optimization training unit is used to: input the profile training set into the pre-built basic profile model in batches for repeated parameter optimization training, and perform a verification counting operation after the parameter optimization training to obtain the current count value. The parameter optimization training is stopped when the current count value and a preset optimization threshold are used to determine that a preset condition for minimizing profile error is met. Then, the forward model parameters are obtained, and the user profile model is obtained based on the forward model parameters. Specifically, the verification counting operation includes: obtaining the current model optimization parameters, and obtaining a verification profile value based on the profile validation set, the current model optimization parameters, and the basic profile model; obtaining the true value based on the profile validation set, and calculating the current profile error based on the true value and the verification profile value; when the current profile error is determined to be not less than a preset forward profile error, the current model optimization parameters are not saved, and the count is accumulated based on the pre-obtained forward count value to obtain the current count value.

[0033] Furthermore, after the optimization training unit is used to obtain the true value based on the image verification set and calculate the current image error based on the true value and the verification image value, the optimization training unit is also used to: when it is determined that the current image error is less than the preset forward image error, set the pre-acquired forward count value to zero to obtain the current count value, and use the current model optimization parameters as the forward model parameters, and use the current image error as the preset forward image error.

[0034] Another embodiment of the present invention provides a terminal device, including: a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, it implements the steps of an incremental user profiling method based on context learning as provided in the present invention.

[0035] Another embodiment of the present invention provides a computer-readable storage medium item, including: a stored computer program, which, when the computer program is running, controls the device where the computer-readable storage medium is located to perform the steps of an incremental user profiling method based on context learning provided by the present invention.

[0036] This invention provides an incremental user profiling method and system based on context learning, aiming to solve the problems of existing methods' strong dependence on incremental user load data and low profiling accuracy. By constructing context tasks using historical data of existing users to train the profiling model, the model learns the general rules of load data changes, endowing the profiling model with context learning capabilities. This enables accurate prediction of incremental users based on existing user data, even when there are fundamental differences between the electricity consumption patterns of incremental users and those of existing users. It breaks away from the reliance of traditional methods on direct feature matching based on similar data distributions, instead using existing user data to allow the model to learn the general underlying rules of power load data changes. With the help of context learning capabilities, this general rule is transferred and adapted to the small sample scenarios of incremental users, rather than simply mapping or matching the electricity consumption patterns of existing and incremental users directly. This is expected to overcome the limitations of traditional methods, achieve high-precision profiling of incremental users with small samples, and provide a better technical solution for incremental user profiling in the power grid.

[0037] Specifically, this invention constructs a large number of context task pairs from the historical load data sequences of existing users, enabling the profiling model to learn the general mapping patterns of power load changes over time and scenarios from the existing data. These include common characteristics of power load such as load fluctuations over time and date, and the temporal evolution logic of electricity consumption behavior, rather than the specific electricity consumption patterns of a particular type of existing user. These general patterns represent the underlying commonalities of electricity user behavior. Even if the electricity consumption patterns of new users differ fundamentally from those of existing users, the changes in their load data still follow the basic temporal patterns of power load. Once the model grasps these general patterns, it can be adapted to new users with different electricity consumption patterns, freeing it from the requirement of similarity between existing and new user patterns. Simultaneously, this invention endows the user profiling model with core context learning capabilities. When predicting new users, small sample load data of new users is used to construct incremental profiling task pairs, which are then combined with context task pairs selected from the existing data pool to form test sample input models. The model can use this contextual example of small sample data from new users to dynamically adapt the learned general patterns of power load to the personalized electricity consumption characteristics of each new user. This invention eliminates the need for incremental and existing users to have similar electricity consumption patterns. It allows the model to accurately predict the electricity consumption patterns of incremental users using only a small sample of data. Furthermore, it avoids the distribution assumptions of traditional methods, requiring no co-distribution of existing and incremental data. Through training with contextual task pairs, the model adapts to different load distributions. Even if the distribution of incremental user data differs significantly from that of existing users, the model can still predict the load of incremental users based on general patterns and contextual cues from small incremental samples. Additionally, this invention utilizes a fixed-length contextual sampling strategy to fully mine the temporal features of historical data from existing users, allowing the model to comprehensively learn the general patterns of load data. Preferably, the user profiling model constructed in this invention is based on a self-attention mechanism, a feedforward neural network, and inter-layer residual connections. The self-attention mechanism captures the temporal correlations and feature weights of load data, while residual connections ensure the model's deep learning ability and generalization. This allows the model to fully learn the general patterns of existing data and flexibly adjust the adaptation method when faced with heterogeneous electricity consumption patterns of incremental users, achieving accurate prediction. Attached Figure Description

[0038] To more clearly illustrate the technical solution of this application, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0039] Figure 1 This is a schematic diagram of an incremental user profiling method based on context learning provided in this embodiment; Figure 2 This is a schematic diagram of an incremental user profiling system based on context learning provided in this embodiment. Detailed Implementation

[0040] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings of the embodiments. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0041] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the application; the terms “comprising” and “having”, and any variations thereof, in the specification, claims, and foregoing description of the drawings are intended to cover non-exclusive inclusion.

[0042] In the description of the embodiments of this application, technical terms such as "first" and "second" are used only to distinguish different objects and should not be construed as indicating or implying relative importance or implicitly specifying the number, specific order, or primary and secondary relationship of the indicated technical features. In the description of the embodiments of this application, "multiple" means two or more, unless otherwise explicitly defined.

[0043] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

[0044] In the description of the embodiments in this application, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this document generally indicates that the preceding and following related objects have an "or" relationship.

[0045] In the description of the embodiments of this application, the term "multiple" refers to two or more (including two), similarly, "multiple sets" refers to two or more (including two sets), and "multiple pieces" refers to two or more (including two pieces).

[0046] In the description of the embodiments of this application, unless otherwise expressly specified and limited, technical terms such as "installation," "connection," "joining," and "fixing" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral part; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; they can refer to the internal communication of two components or the interaction between two components. For those skilled in the art, the specific meaning of the above terms in the embodiments of this application can be understood according to the specific circumstances.

[0047] Example 1: This embodiment provides an incremental user profiling method based on context learning, such as... Figure 1 As shown, it includes: S1. Construct incremental user profiles based on pre-acquired small sample load data of incremental users to be tested and a preset future window length; S2. Based on the preset profile model training data pool and preset selection rules, obtain several current context task pairs, and combine the incremental user profile task pairs and several current context task pairs to form test samples. S3. Obtain incremental user profile results based on the test samples and the pre-trained user profile model; The pre-training process of the user profile model includes: S31. Obtain a set of historical load data sequences for several existing users; S32. For any existing user, obtain several context task pairs based on the existing historical load data sequence set, the preset historical window length, and the preset future window length, and construct a context task matrix based on the several context task pairs. S33. Construct the preset profile model training data pool based on several context task matrices corresponding to several existing users; S34. Train the pre-constructed basic profile model based on the preset profile model training data pool to obtain the user profile model.

[0048] In the specific implementation process, this embodiment obtains a set of existing historical load data sequences for several existing users, wherein the historical load data sequences are used as... It means that, among them, The small sample load data of the incremental users to be tested, which are to be acquired in advance, are used for It means that among them Where R is the set of real numbers, and These are the lengths of the existing historical load data sequence set for existing users and the sequence composed of small sample load data for incremental users to be tested, respectively. and These represent the number of existing users and the number of new users, respectively.

[0049] Data cleaning is required during the acquisition of existing historical load data sequences and small sample load data of incremental users to be tested.

[0050] Optionally, step S1 includes: Several small sample load data are obtained based on the pre-acquired small sample load data of incremental users to be tested; Several small sample load data are used as the current historical window, and the current future window is constructed based on the preset future window length and the preset zero placeholder. Then, an incremental user profile task pair is constructed based on the current historical window and the current future window.

[0051] In the specific implementation process, the above scheme of this embodiment is illustrated using a single incremental user as an example. After obtaining the small sample load data of the incremental user to be tested, an incremental profile task pair is constructed using several small sample load data. Similarly, for the small sample load data of the incremental user to be tested that includes several incremental users, the small sample load data of several incremental users is first traversed, and the small sample load data of each incremental user is used as the current historical window of the context task pair. The current future window is filled with a preset zero placeholder (i.e., 0 placeholder) based on the preset future window length, thereby generating an incremental user profile task pair corresponding to each incremental user.

[0052] Optionally, step S2 includes: Obtain the number of candidate task pairs, and randomly select several current context task pairs from the preset portrait model training data pool based on the number of candidate task pairs; The incremental user profiling task pairs and several current context task pairs are combined to form a test sample.

[0053] In the specific implementation process, the number M of candidate task pairs is a pre-set fixed parameter. From the preset user profile model training data pool, M-1 existing user context task pairs are randomly selected as the current context task pairs, and together with one incremental user profile task pair, they form a test sample. This sample is then input into the trained user profile model to obtain the incremental user profile results.

[0054] Optionally, step S32 includes: For any of the aforementioned existing users: Based on the existing historical load data sequence set, obtain the historical load data sequence of the existing user, and obtain the historical data length corresponding to the historical load data sequence; The number of context tasks is obtained based on the historical data length, the preset historical window length, and the preset future window length. For any current task pair position in the context task count, a stock historical window is constructed based on the context task count, historical load data sequence, and preset historical window length; a stock future window is constructed based on the context task count, historical load data sequence, preset historical window length, and preset future window length; and a context task pair is obtained based on the stock historical window and stock future window. Obtain several context task pairs corresponding to the number of context tasks, perform position encoding on several context task pairs, obtain position encoding sequences, and construct a context task matrix based on the position encoding sequences and several context task pairs.

[0055] In the specific implementation process, this embodiment traverses the historical load data sequence of existing users. For any existing user, a context task pair is constructed, and a context task matrix is ​​constructed for each existing user. Specifically: a preset historical window length is defined. and preset future window length First, for existing users Calculate the number of context tasks The specific formula is as follows: ; in, Indicates existing users The historical data length corresponds to the historical load data sequence; the preset historical window length is determined by the length of the sequence composed of small sample load data of incremental users to be tested, while the preset future window length is determined by the requirements of the profiling task and is determined in advance according to the specific application scenario.

[0056] Next, using a sliding window method, context task pairs are generated from the historical load data sequences of existing users, as shown in the following formula: ; ; In the formula, For the context task pair index, This represents the existing history window for the k-th context task pair of the u-th existing user. This represents the existing future window for the k-th context task pair of the u-th existing user. This represents the historical load data sequence of the u-th existing user. This indicates taking the historical load data sequence of the u-th existing user from the k-th sampling time to the 1st sampling time. Load data at each sampling time point, This indicates that the historical load data sequence of the u-th existing user is taken from the set of existing users. From the sampling time to the... Load data at each sampling time.

[0057] Finally, for each existing user, position encoding is performed on several of the aforementioned context task pairs to obtain the position encoding sequence, thereby constructing the context task matrix. It has the following formula: ; In the formula, Let u be the context task matrix of the existing user. The position code in the position coding sequence is used to identify the existing user u and the context task pair position k.

[0058] Optionally, step S34 includes: Based on the preset fixed context sampling strategy and the preset profile model training data pool, the context sampling action is repeatedly performed to obtain a number of training samples; Based on several training samples and a preset sample division ratio, a portrait training set and a portrait verification set are obtained; The pre-built basic profile model is trained based on the profile training set and profile verification set to obtain the user profile model; The context sampling action includes: The current sample task position is randomly selected based on the training data pool of the preset portrait model, and the current training task is obtained based on the current sample task position; The training task future window of the current training task is initialized based on the initial placeholder, the training sample historical load data sequence of the current training task is used as the training task historical window, and the training profile task is constructed based on the training task historical window and the training task future window. Based on the current sample task position and the number of candidate task pairs, obtain several forward training samples, and based on the several forward training samples, obtain the training sample context task. Training samples are constructed based on the training sample context task and training profile task.

[0059] Optionally, the step of obtaining several forward training samples based on the current sample task position and the number of candidate task pairs, and obtaining the training sample context task based on the several forward training samples, includes: Based on the current sample task position and the number of candidate task pairs, obtain several forward training samples; For any of the forward training samples, the sample history load data sequence of the forward training samples is used as the sample history window, and the real value data of the forward training samples is used as the sample future window. A sample context task pair is constructed based on the sample history window and the sample future window. Obtain several sample context task pairs corresponding to several forward training samples, and use several sample context task pairs as training sample context tasks.

[0060] Optionally, obtaining the plurality of sample context task pairs corresponding to the plurality of the plurality of the forward training samples, and using the plurality of sample context task pairs as training sample context tasks, includes: Obtain several sample context task pairs corresponding to several of the aforementioned forward training samples; When the number of forward training samples is insufficient based on the current sample task position and the number of candidate task pairs, the sample supplementation context task pairs are filled based on the preset mask context task pairs and several sample context task pairs to obtain a sample supplementation context task pair sequence. The sample is used to complete the context task pair sequence as the training sample context task.

[0061] In its implementation, this embodiment uses a concatenated context task matrix of all existing users as a training data pool for a pre-defined user profile model. A fixed context length sampling strategy is employed to divide this training data pool, thereby generating a user profile training set and a user profile validation set. Specifically: By concatenating the context task matrix of all existing users, a training data pool for the pre-defined user profile model can be obtained. The specific formula is as follows: ; in, , This is for splicing operations.

[0062] To ensure consistency in batch processing during model training, this embodiment first employs a preset fixed context sampling strategy to perform context sampling, thereby obtaining several training samples. This preset fixed context sampling strategy includes: each training sample contains a fixed number M (i.e., the number of candidate task pairs, consistent with the number of context task pairs when constructing test samples) of context task pairs, including M-1 context tasks and 1 portrait task. In the 1 context task pair serving as the portrait task, all future windows are replaced with initial placeholders. In this embodiment, 0 placeholders are used as initial placeholders, indicating that the output of the user portrait model should fill the future window in this portrait task. The actual value of the original future window is then saved separately as the sample label in the newly linked sample pair. That is, each training sample pair consists of the aforementioned M context task pairs and sample labels. Each time a sample pair is generated, a portrait task position (i.e., the current sample task position) m is randomly selected from the portrait model training data pool. For a randomly selected current sample task position m, if at least M-1 preceding training samples are available, these M-1 preceding training samples are used to construct a context task pair as the context task in the training samples. If insufficient, a padding strategy is adopted, using special padding context task pairs (i.e., the preset masked context task pairs) to supplement the quantity, resulting in a sample padding context task pair sequence, which is then used as the training sample context task. This preset masked context task pair is masked during input model computation, without affecting model training optimization, aiming to ensure all training samples have the same input dimension and support efficient batch training. The above context sampling action is repeated to generate B training sample pairs. These pairs are then divided into a portrait training set and a portrait validation set according to a preset sample partitioning ratio. In this embodiment, the preset sample partitioning ratio is 8:2. Sample pairs in the portrait training set participate in all parameter optimization training processes of the model, while sample pairs in the portrait validation set do not participate in gradient updates during parameter optimization training; they are only used to evaluate the performance of the portrait model and perform validation counting operations.

[0063] Optionally, training the pre-built basic profile model based on the profile training set and profile verification set to obtain the user profile model includes: The user profile training set is input into the pre-built basic profile model in batches for repeated parameter optimization training. After the parameter optimization training, a verification counting operation is performed to obtain the current count value. The parameter optimization training is stopped when the preset condition of minimizing the profile error is met based on the current count value and the preset optimization threshold. The forward model parameters are then obtained, and the user profile model is obtained based on the forward model parameters. Specifically, the verification counting operation includes: Obtain the current model optimization parameters, and obtain the verification profile value based on the profile verification set, the current model optimization parameters, and the basic profile model; The true value is obtained based on the image verification set, and the current image error is calculated based on the true value and the verification image value. When it is determined that the current image error is not less than the preset forward image error, the current model optimization parameters are not saved, and the current count value is obtained by counting and accumulating based on the pre-acquired forward count value.

[0064] Optionally, after obtaining the true value based on the image verification set and calculating the current image error based on the true value and the verification image value, the method further includes: When it is determined that the current image error is less than the preset forward image error, the pre-acquired forward count value is set to zero to obtain the current count value, and the current model optimization parameters are used as the forward model parameters, and the current image error is used as the preset forward image error.

[0065] In the specific implementation process, after constructing the basic portrait model, this embodiment uses the portrait training set and the portrait verification set to train the portrait model in batches with the goal of minimizing the portrait error.

[0066] In this embodiment, the pre-constructed basic portrait model consists of a self-attention mechanism, a feedforward neural network, and layer normalization operations. The model is composed of inter-layer residual connections, with the specific connection relationships as follows: the output of layer q of the basic portrait model is generated based on the output of layer q-1, and the output of layer q is composed of two parallel residual branches working together. The processing of the first residual branch is as follows: first, layer normalization is performed on the output of layer q-1; then, the result after layer normalization is input into the self-attention mechanism, where feature extraction and association modeling are completed; finally, the output of the self-attention mechanism and the output of layer q-1 are added together through residual connections to complete the feature fusion and output of the first residual branch. The processing of the second residual branch is as follows: First, layer normalization is performed on the output of layer q-1. Then, the result after layer normalization is input into the self-attention mechanism, which completes feature extraction and association modeling. Next, the output of the self-attention mechanism is added to the output of layer q-1 through a residual connection to complete preliminary feature fusion. This preliminary fused feature is then input into the feedforward neural network, which performs nonlinear transformation and deep extraction of features. Finally, layer normalization is performed on the features processed by the feedforward neural network, completing the feature processing and output of the second residual branch. Ultimately, the basic portrait model achieves multi-level and multi-dimensional extraction and modeling of input features through parallel processing and feature fusion of the first and second residual branches, ensuring the model's deep learning and feature representation capabilities. Specifically, the basic portrait model is expressed as follows: ; In the formula, and These are the outputs of the image model at layers q and q-1, respectively. For the self-attention mechanism of the q-th layer, For layer normalization operation, It is a feedforward neural network of the qth layer.

[0067] Among them, the image error The calculation formula is as follows: ; In the formula, This represents the portrait value output by the portrait model when the k-th context task of the u-th existing user is used as the portrait task in the training sample; and These represent the total number of users in the profile verification set and the total number of context task pairs, respectively.

[0068] Among them, batch training refers to setting the batch size to b, and in each round of training of the portrait model, inputting b training samples from the portrait training set to perform parameter optimization training on the basic portrait model.

[0069] At the start of model training, the initial image error is set to infinity, which becomes the preset forward image error for the first round. A counter is set to 0, which becomes the forward count value for the first round. After each round of parameter optimization training, the current image error is calculated using the image validation set and the current image model formed based on the optimized parameters of the current round and the base image model. If the current image error is less than the preset forward image error, the current model optimization parameters and the current image loss are saved, and the current model optimization parameters are used as the forward model parameters for the next round. The calculated current image error is used as the preset forward image error for the next round, and the pre-acquired forward count value is set to zero. If the current round image error is greater than or equal to the preset forward image error, the current model optimization parameters and the current image loss are not saved, and the count is incremented based on the pre-acquired forward count value. When the value of the counter is greater than the preset optimization threshold, in this embodiment the preset optimization threshold is set to 5. At this time, it is determined that the preset condition of minimizing the profile error is met, the parameter optimization training is stopped, the forward model parameters retained at this time are obtained, and then the user profile model is obtained.

[0070] This embodiment provides an incremental user profiling method based on context learning. It proposes a complete implementation method for constructing relevant datasets, building the profiling model, and training the profiling model. By constructing context task pairs as input to the profiling model, the context learning capability of the profiling model is activated, enhancing its profiling ability in scenarios where incremental user load data is scarce. A method for constructing context task pairs from historical data of existing users is proposed, breaking through the direct mapping of sequences to sequences in traditional incremental user profiling methods. The constructed profiling model can learn the dynamic mapping pattern of load from historical data, preventing overfitting when the model only learns static mapping relationships and enhancing the generalization ability of the profiling model. A fixed-length context sampling strategy is proposed to ensure that the length of the training sample data input to the model is fixed each time, thereby effectively ensuring the stability of batch processing during model training and improving model training efficiency. Compared with existing technologies, it has the following core advantages: It has the ability to process small samples. This embodiment only requires a few hours of incremental user data to accurately profile users, breaking through the dependence of traditional methods on the amount of data; It extracts and deploys without distribution assumptions and dynamically adapts to new users through contextual examples, solving the pain point of transfer learning failing when the distribution shifts; It can achieve continuous knowledge accumulation. New and existing users can be added to the preset profile model training data pool at any time without retraining. It can achieve accurate, interpretable and efficient incremental user profiles in zero-sample scenarios, providing a new technical path for the refined planning of the power grid.

[0071] Example 2: This embodiment also provides an incremental user profiling system based on context learning, such as... Figure 2 As shown, it includes a preprocessing module, a sample combination module, and a user profiling module, wherein: The preprocessing module is used to construct incremental user profile task pairs based on the pre-acquired small sample load data of incremental users to be tested and the preset future window length. The sample combination module is used to obtain several current context task pairs based on a preset profile model training data pool and preset selection rules, and to combine the incremental user profile task pairs and several current context task pairs to form test samples. The user profiling module is used to obtain incremental user profiling results based on the test samples and the pre-trained user profiling model. The user profiling module is also used to perform the pre-training process of the user profiling model. Specifically, the user profiling module is also used to obtain a set of existing historical load data sequences of existing users; for any existing user, obtain a set of context task pairs based on the set of existing historical load data sequences, a preset historical window length, and a preset future window length, and construct a context task matrix based on the set of context task pairs; construct the preset profiling model training data pool based on the context task matrices corresponding to the existing users; and train the pre-constructed basic profiling model based on the preset profiling model training data pool to obtain the user profiling model.

[0072] This embodiment provides an incremental user profiling system based on context learning. It constructs incremental user profiling task pairs through a preprocessing module and a sample combination module, and combines existing context task pairs to form test samples. The user profiling module then obtains profiling results based on a pre-trained user profiling model. During the pre-training phase of the user profiling model, the user profiling module constructs context task pairs, a task matrix, and a training data pool using historical data of existing users to complete model training. This endows the user profiling model with context learning capabilities, enabling it to learn the general patterns of load data changes from historical load data sequences of existing users. Based on these patterns, it can interpret small sample data of incremental users, solving the technical problems of existing incremental user profiling methods that are highly dependent on incremental user load data, can only work stably with a certain amount of historical incremental user data, and have insufficient profiling accuracy when faced with small sample load data of incremental users, thus failing to support precise power grid planning. This system achieves high-precision profiling of incremental users with small samples, breaking through the limitations of traditional methods on the amount of historical incremental user data.

[0073] Optionally, the preprocessing module includes a data acquisition submodule and a user profile task pair construction submodule, wherein: The data acquisition submodule is used to acquire several small sample load data based on the pre-acquired small sample load data of incremental users to be tested; The user profile task pair construction submodule is used to take several of the small sample load data as the current historical window, and construct the current future window based on the preset future window length and the preset zero placeholder, and then construct the incremental user profile task pair based on the current historical window and the current future window.

[0074] Optionally, the sample combination module includes a context task pair acquisition submodule and a test sample formation submodule, including: The context task pair acquisition submodule is used to acquire the number of candidate task pairs and randomly select several current context task pairs from the preset portrait model training data pool based on the number of candidate task pairs. The test sample forming submodule is used to combine the incremental user profile task pairs and several current context task pairs to form test samples.

[0075] Optionally, the user profiling module includes a context task matrix construction submodule. This submodule is used to, for any existing user, obtain several context task pairs based on the existing historical load data sequence set, a preset historical window length, and a preset future window length, and construct a context task matrix based on these context task pairs. Specifically, the context task matrix construction submodule is used to: for any existing user: obtain the historical load data sequence of the existing user based on the existing historical load data sequence set, and obtain the historical data length corresponding to the historical load data sequence; based on the historical data length and the preset historical window length... The system obtains the number of context tasks based on the degree and a preset future window length; for any current task pair position in the context task number, it constructs a stock historical window based on the context task number, historical load data sequence, and preset historical window length, and constructs a stock future window based on the context task number, historical load data sequence, preset historical window length, and preset future window length, and obtains context task pairs based on the stock historical window and stock future window; it obtains several context task pairs corresponding to the context task number, performs position encoding on several context task pairs, obtains a position encoding sequence, and constructs a context task matrix based on the position encoding sequence and several context task pairs.

[0076] Optionally, the user profiling module includes a model training submodule. This submodule is used to train a pre-built basic profiling model based on the preset profiling model training data pool to obtain a user profiling model. Specifically, the model training submodule is used to: repeatedly perform context sampling based on a preset fixed context sampling strategy and the preset profiling model training data pool to obtain several training samples; obtain a profiling training set and a profiling validation set based on the several training samples and a preset sample division ratio; and train the pre-built basic profiling model based on the profiling training set and the profiling validation set to obtain a user profiling model. The context sampling action includes: The current sample task position is randomly selected based on the training data pool of the preset profile model, and the current training task is obtained based on the current sample task position; the future window of the training task of the current training task is initialized based on the initial placeholder, the historical load data sequence of the training samples of the current training task is used as the historical window of the training task, and the training profile task is constructed based on the historical window of the training task and the future window of the training task; several forward training samples are obtained based on the current sample task position and the number of candidate task pairs, and the training sample context task is obtained based on the several forward training samples; training samples are constructed based on the training sample context task and the training profile task.

[0077] Optionally, the model training submodule includes a training sample context task acquisition unit. This unit acquires several forward training samples based on the current sample task position and the number of candidate task pairs, and acquires training sample context tasks based on these forward training samples. Specifically, the training sample context task acquisition unit is used to: acquire several forward training samples based on the current sample task position and the number of candidate task pairs; for any forward training sample, use the sample history load data sequence of the forward training sample as a sample history window, use the real value data of the forward training sample as a sample future window, construct sample context task pairs based on the sample history window and the sample future window; acquire several sample context task pairs corresponding to several forward training samples, and use these sample context task pairs as training sample context tasks.

[0078] Optionally, when the training sample context task acquisition unit acquires the sample context task pairs corresponding to the several forward training samples and uses the several sample context task pairs as training sample context tasks, specifically, the training sample context task acquisition unit is used to: acquire the sample context task pairs corresponding to the several forward training samples; when it is determined that the number of forward training samples is insufficient based on the current sample task position and the number of candidate task pairs, fill in the blanks based on the preset mask context task pairs and the several sample context task pairs to acquire a sample filling context task pair sequence; and use the sample filling context task pair sequence as training sample context tasks.

[0079] Optionally, the model training submodule further includes an optimization training unit. This optimization training unit trains a pre-built basic profile model based on the profile training set and the profile validation set to obtain a user profile model. Specifically, the optimization training unit is used to: input the profile training set into the pre-built basic profile model in batches for repeated parameter optimization training; perform a validation counting operation after the parameter optimization training to obtain the current count value; stop the parameter optimization training when the current count value and a preset optimization threshold are determined to meet a preset condition for minimizing profile error; obtain the forward model parameters; and obtain the user profile model based on the forward model parameters. Specifically, the validation counting operation includes: obtaining the current model optimization parameters; obtaining a validation profile value based on the profile validation set, the current model optimization parameters, and the basic profile model; obtaining the true value based on the profile validation set; calculating the current profile error based on the true value and the validation profile value; and when the current profile error is determined to be not less than a preset forward profile error, not saving the current model optimization parameters, and accumulating the count based on the pre-obtained forward count value to obtain the current count value.

[0080] Optionally, after the optimization training unit is used to obtain the true value based on the image verification set and calculate the current image error based on the true value and the verification image value, the optimization training unit is further used to: when it is determined that the current image error is less than the preset forward image error, set the pre-acquired forward count value to zero to obtain the current count value, and use the current model optimization parameters as the forward model parameters, and use the current image error as the preset forward image error.

[0081] It is understood that the above system item embodiments correspond to the method item embodiments of the present invention, and can implement the incremental user profiling method based on context learning provided by any of the above method item embodiments of the present invention.

[0082] It should be noted that the system embodiments described above are merely illustrative, and some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Furthermore, in the accompanying drawings of the device embodiments provided by this invention, the connection relationships between modules indicate that they have communication connections, which can specifically be implemented as one or more communication buses or signal lines. Those skilled in the art can understand and implement this without any creative effort.

[0083] Example 3: This embodiment provides an implementation process for incremental user profiling based on context learning, specifically including: collecting historical load data sequences of 1000 existing users over the past year, with a sampling interval of 15 minutes. Small sample load data of 50 incremental users over 7 days (one week). The sampling interval is 15 minutes, and the sample loading data is small. The length of the sequence is Then, data cleaning is performed. At this point, a high-precision profile of the incremental user for the following week can be generated based on the data from the previous week. The specific operations for data cleaning are as follows: traverse the user load data, remove outliers from the data using a 3-standard-deviation criterion, mark the positions of the removed outliers as new data to be filled, and then use linear interpolation to fill in the original missing values ​​and the new data to be filled in the load data.

[0084] For existing users Define the history window length and future window length Calculate the number of context tasks The specific formula is as follows: ; Using a sliding window approach, context task pairs are generated from the existing user historical load data sequence. Specifically, taking user 1 as an example, the historical data of the first week is used as the historical window for the first context task pair, the historical data of the second week is used as the future window for the first context task pair, the historical data from the second day of the first week to the first day of the second week is used as the historical window for the second context task pair, the historical data from the second day of the second week to the first day of the third week is used as the future window for the second context task pair, and so on, constructing... A context task pair.

[0085] For each existing user, construct a context task matrix, such as the context task matrix for user 1. Specifically, it can be represented as follows: ; By concatenating the task matrix of all existing users, we obtain the training data pool for the user profile model. .

[0086] Training samples are obtained from the portrait model training data pool using a preset fixed context sampling strategy. Each training sample pair consists of 99 context tasks and 1 portrait task, generating a total of B=333 training samples. Based on this, the portrait training set and portrait validation set are obtained.

[0087] A basic user profile model is constructed using a user profile training set and a user profile validation set. The basic user profile model is trained in batches with the goal of minimizing profile error. In this embodiment, batch training means setting the batch size to b=11, and inputting b training samples to train the model in each round of parameter optimization training. Incremental user small-sample load data is traversed, and the small-sample load data of each incremental user is used as the historical window of the context task pair. The future window is filled with 0 placeholders, generating incremental user profile task pairs for each incremental user. In this embodiment, the 7-day load data of each incremental user is used as the historical window of the incremental user profile task pair, and the future window of the incremental user profile task pair is filled with 672 0 placeholders. Finally, M-1=99 existing user context task pairs are randomly selected from the preset user profile model training data pool and combined with the incremental user profile task pairs to form test samples, which are then input into the obtained user profile model to obtain the incremental user profile results.

[0088] Example 4: Based on the context-learning-based incremental user profiling method provided in the above embodiments, another embodiment of the present invention provides a terminal device, which includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, it implements the context-learning-based incremental user profiling method of any embodiment of the present invention.

[0089] For example, in this embodiment, the computer program can be divided into one or more modules, which are stored in the memory and executed by the processor to complete the present invention. The one or more modules may be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of the computer program in the terminal device.

[0090] The terminal device may be a desktop computer, laptop, handheld computer, or cloud server, etc. The terminal device may include, but is not limited to, a processor and a memory.

[0091] The processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor. The processor is the control center of the terminal device, connecting all parts of the terminal device via various interfaces and lines.

[0092] Example 5: Based on the above-described method embodiments, another embodiment of the present invention provides a computer-readable storage medium including a stored computer program, wherein, when the computer program is executed, it controls the device where the computer-readable storage medium is located to execute the incremental user profiling method based on context learning as described in any of the above-described method embodiments of the present invention.

[0093] The modules / units integrated in the device / terminal equipment, if implemented as software functional units and sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the above embodiments of the present invention can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium, etc.

[0094] 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. An incremental user profiling method based on context learning, characterized in that, include: The task of constructing incremental user profiles is based on the pre-acquired small sample load data of incremental users to be tested and the preset future window length. Several current context task pairs are obtained based on the training data pool of the preset profile model and the preset selection rules. The incremental user profile task pairs and the several current context task pairs are combined to form test samples. Incremental user profile results are obtained based on the test samples and the pre-trained user profile model. The pre-training process of the user profile model includes: Obtain a set of historical load data sequences for several existing users; For any existing user, several context task pairs are obtained based on the existing historical load data sequence set, the preset historical window length, and the preset future window length, and a context task matrix is ​​constructed based on the several context task pairs. The preset profile model training data pool is constructed based on several context task matrices corresponding to several existing users. The pre-constructed basic profile model is trained based on the preset profile model training data pool to obtain the user profile model.

2. The incremental user profiling method based on context learning as described in claim 1, characterized in that, The task pair for constructing incremental user profiles based on pre-acquired small sample load data of incremental users to be tested and a preset future window length includes: Several small sample load data are obtained based on the pre-acquired small sample load data of incremental users to be tested; Several small sample load data are used as the current historical window, and the current future window is constructed based on the preset future window length and the preset zero placeholder. Then, an incremental user profile task pair is constructed based on the current historical window and the current future window.

3. The incremental user profiling method based on context learning as described in claim 1, characterized in that, The process involves obtaining several current context task pairs based on a preset user profile model training data pool and preset selection rules, and combining the incremental user profile task pairs with the several current context task pairs to form a test sample, including: Obtain the number of candidate task pairs, and randomly select several current context task pairs from the preset portrait model training data pool based on the number of candidate task pairs; The incremental user profiling task pairs and several current context task pairs are combined to form a test sample.

4. The incremental user profiling method based on context learning as described in claim 1, characterized in that, For any existing user, several context task pairs are obtained based on the existing historical load data sequence set, a preset historical window length, and a preset future window length, and a context task matrix is ​​constructed based on the several context task pairs, including: For any of the aforementioned existing users: Based on the existing historical load data sequence set, obtain the historical load data sequence of the existing user, and obtain the historical data length corresponding to the historical load data sequence; The number of context tasks is obtained based on the historical data length, the preset historical window length, and the preset future window length. For any current task pair position in the context task count, a stock historical window is constructed based on the context task count, historical load data sequence, and preset historical window length; a stock future window is constructed based on the context task count, historical load data sequence, preset historical window length, and preset future window length; and a context task pair is obtained based on the stock historical window and stock future window. Obtain several context task pairs corresponding to the number of context tasks, perform position encoding on several context task pairs, obtain position encoding sequences, and construct a context task matrix based on the position encoding sequences and several context task pairs.

5. The incremental user profiling method based on context learning as described in claim 3, characterized in that, The step of training a pre-constructed basic profile model based on the preset profile model training data pool to obtain a user profile model includes: Based on the preset fixed context sampling strategy and the preset profile model training data pool, the context sampling action is repeatedly performed to obtain a number of training samples; Based on several training samples and a preset sample division ratio, a portrait training set and a portrait verification set are obtained; The pre-built basic profile model is trained based on the profile training set and profile verification set to obtain the user profile model; The context sampling action includes: The current sample task position is randomly selected based on the training data pool of the preset portrait model, and the current training task is obtained based on the current sample task position; The training task future window of the current training task is initialized based on the initial placeholder, the training sample historical load data sequence of the current training task is used as the training task historical window, and the training profile task is constructed based on the training task historical window and the training task future window. Based on the current sample task position and the number of candidate task pairs, obtain several forward training samples, and based on the several forward training samples, obtain the training sample context task. Training samples are constructed based on the training sample context task and training profile task.

6. The incremental user profiling method based on context learning as described in claim 5, characterized in that, The process of obtaining several forward training samples based on the current sample task position and the number of candidate task pairs, and obtaining the training sample context task based on the several forward training samples, includes: Based on the current sample task position and the number of candidate task pairs, obtain several forward training samples; For any of the forward training samples, the sample history load data sequence of the forward training samples is used as the sample history window, and the real value data of the forward training samples is used as the sample future window. A sample context task pair is constructed based on the sample history window and the sample future window. Obtain several sample context task pairs corresponding to several forward training samples, and use several sample context task pairs as training sample context tasks.

7. The incremental user profiling method based on context learning as described in claim 6, characterized in that, The step of obtaining several sample context task pairs corresponding to several of the forward training samples, and using several sample context task pairs as training sample context tasks, includes: Obtain several sample context task pairs corresponding to several of the aforementioned forward training samples; When the number of forward training samples is insufficient based on the current sample task position and the number of candidate task pairs, the sample supplementation context task pairs are filled based on the preset mask context task pairs and several sample context task pairs to obtain a sample supplementation context task pair sequence. The sample is used to complete the context task pair sequence as the training sample context task.

8. The incremental user profiling method based on context learning as described in claim 5, characterized in that, The step of training the pre-built basic profile model based on the profile training set and profile verification set to obtain the user profile model includes: The user profile training set is input into the pre-built basic profile model in batches for repeated parameter optimization training. After the parameter optimization training, a verification counting operation is performed to obtain the current count value. The parameter optimization training is stopped when the preset condition of minimizing the profile error is met based on the current count value and the preset optimization threshold. The forward model parameters are then obtained, and the user profile model is obtained based on the forward model parameters. Specifically, the verification counting operation includes: Obtain the current model optimization parameters, and obtain the verification profile value based on the profile verification set, the current model optimization parameters, and the basic profile model; The true value is obtained based on the image verification set, and the current image error is calculated based on the true value and the verification image value. When it is determined that the current image error is not less than the preset forward image error, the current model optimization parameters are not saved, and the current count value is obtained by counting and accumulating based on the pre-acquired forward count value.

9. The incremental user profiling method based on context learning as described in claim 8, characterized in that, After obtaining the true value based on the image verification set and calculating the current image error based on the true value and the verification image value, the method further includes: When it is determined that the current image error is less than the preset forward image error, the pre-acquired forward count value is set to zero to obtain the current count value, and the current model optimization parameters are used as the forward model parameters, and the current image error is used as the preset forward image error.

10. An incremental user profiling system based on context learning, characterized in that, It includes a preprocessing module, a sample combination module, and a user profiling module, among which: The preprocessing module is used to construct incremental user profile task pairs based on the pre-acquired small sample load data of incremental users to be tested and the preset future window length. The sample combination module is used to obtain several current context task pairs based on a preset profile model training data pool and preset selection rules, and to combine the incremental user profile task pairs and several current context task pairs to form test samples. The user profiling module is used to obtain incremental user profiling results based on the test samples and the pre-trained user profiling model. The user profiling module is also used to perform the pre-training process of the user profiling model. Specifically, the user profiling module is also used to obtain a set of existing historical load data sequences of existing users; for any existing user, obtain a set of context task pairs based on the set of existing historical load data sequences, a preset historical window length, and a preset future window length, and construct a context task matrix based on the set of context task pairs; construct the preset profiling model training data pool based on the context task matrices corresponding to the existing users; and train the pre-constructed basic profiling model based on the preset profiling model training data pool to obtain the user profiling model.