Incremental and stock data identification method and system based on adaptive deep learning

By applying an adaptive deep learning method in the power system, using twin networks and Transformer encoders to feature extraction and distinction of incremental data and stock data, the complex time dependence and feature change identification problems in the prior art are solved, and efficient and accurate incremental data identification and processing are achieved.

CN119782983APending Publication Date: 2025-04-08STATE GRID INFORMATION & TELECOMM BRANCH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411838641.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-13
Publication Date
2025-04-08

AI Technical Summary

Technical Problem

The prior art exhibits limitations when processing incremental data of complex time-dependent and feature changes, especially in the case of device upgrades, environmental fluctuations and user behavior changes, and it is difficult to efficiently identify and process incremental data in the form of time series.

Method used

Adaptive deep learning method is adopted, and feature extraction and distinction between incremental data and stock data is performed through twin networks and Transformer encoders. The model is optimized by using a comparison loss function to make similar stock data feature vectors close, and the incremental data and the feature vectors of stock data are kept at a large distance.

Benefits of technology

It realizes efficient identification and processing of complex time series incremental data, can flexibly respond to equipment upgrades, environmental fluctuations and user behavior changes, and improves the accuracy and efficiency of incremental data identification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119782983A_ABST
    Figure CN119782983A_ABST
Patent Text Reader

Abstract

The present invention provides a method and system for identifying incremental and stock data based on adaptive deep learning, including: obtaining a sequence to be identified; substituting the sequence to be identified into a pre-trained deep learning model to calculate the feature vectors of the sequence to be identified and the reference sequence, and calculating the Euclidean distance between the feature vectors of the sequence to be identified and the reference sequence, and then determining the label of the sequence to be identified, the label including incremental data and stock data; wherein the deep learning model includes: a twin network and a Transformer encoder; the trained deep learning model is obtained by training the twin network and the Transformer encoder based on historical stock data and incremental data. The present invention uses a trained deep learning model to flexibly deal with the problem of poor recognition effect caused by equipment upgrades, environmental fluctuations, user behavior changes, etc., and can accurately distinguish incremental data from stock data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of power system data processing and artificial intelligence, and specifically relates to a method and system for identifying incremental and stock data based on adaptive deep learning. Background Art

[0002] Existing incremental data recognition technologies show great limitations in dealing with complex time dependencies and feature changes, especially in situations such as equipment upgrades, environmental fluctuations, and changes in user behavior, and are unable to respond flexibly.

[0003] At present, there is no mature research result that can effectively solve the feature extraction and distinction of incremental data and stock data in the form of time series. It is difficult to efficiently identify and process incremental data in the form of time series.

[0004] Existing incremental data recognition technologies can be roughly divided into the following categories:

[0005] Timestamp-based incremental data recognition: simple and easy to implement, low resource overhead, suitable for data with high real-time requirements, but dependent on the time consistency of the data. When the data is delayed or erroneous, it is easy to cause recognition errors. It is suitable for scenarios with high real-time requirements such as electricity consumption monitoring.

[0006] Incremental recognition based on event triggering: This method is based on the triggering conditions of events. When a specific event occurs (such as equipment anomaly, alarm information, etc.), the system will automatically identify the new data under the event, thereby realizing incremental recognition. It has high accuracy and can identify important incremental data in a timely manner, but it depends on the accuracy of event detection and the event definition is relatively complex. It is suitable for scenarios such as equipment alarms and anomaly detection.

[0007] Incremental data identification based on version number: By assigning version numbers to data, the version number is increased each time the data is updated to determine the update status of the data. It is easy to operate and suitable for scenarios with low data update frequency. However, the data update granularity is large and it is difficult to adapt to high-frequency update scenarios. It is suitable for scenarios with low update frequency, such as system parameter management and static configuration information.

[0008] Incremental recognition based on hash values: This method identifies changes by calculating the hash value of the data. If the hash value of the new data is different from the hash value of the existing data, the data is judged to have changed. It is more efficient for incremental recognition of large-scale data and can achieve accurate data matching. However, it has a large amount of calculation, high resource requirements, and is not sensitive to small changes in data. It is suitable for incremental update recognition of large data tables.

[0009] These methods have great limitations in dealing with complex time dependencies and feature changes, especially in situations such as equipment upgrades, environmental fluctuations, and changes in user behavior. In addition, there are currently no mature research results that can effectively solve the feature extraction and distinction between incremental data and stock data in the form of time series.

[0010] According to the previous article, several major incremental data recognition technologies have the following limitations:

[0011] Incremental data recognition based on timestamps relies on the temporal consistency of data, and is prone to recognition errors when data is delayed or erroneous.

[0012] Incremental recognition based on event triggering relies on the accuracy of event detection, but event definition is relatively complex.

[0013] This may lead to inaccurate detection problems in practical applications.

[0014] The incremental data identification based on version number has a large data update granularity and is difficult to adapt to the needs of high-frequency update scenarios.

[0015] Incremental recognition based on hash values ​​has a large amount of computation, high resource requirements, and is insensitive to small changes in data. In some scenarios, the recognition effect is not ideal.

[0016] According to the above analysis, the prior art has the following disadvantages:

[0017] Since incremental data in power systems usually exist in the form of time series, with complex time dependencies and characteristic variation problems, existing incremental data identification technologies show great limitations in dealing with these complexities.

[0018] Equipment upgrades, environmental fluctuations, changes in user behavior, etc. will cause the characteristics of incremental data to change, and existing methods cannot flexibly respond to these changes, so the recognition effect in these situations is not good.

[0019] At present, there are no relatively mature research results that can effectively solve the problem of feature extraction and distinction between incremental data and stock data in the form of time series, which makes it difficult to efficiently identify and process incremental data in the form of time series.

[0020] To sum up, it is precisely because of the complex characteristics of incremental data in the form of time series and the limitations of existing technologies that it is difficult to efficiently and accurately identify and process incremental data in practical applications of power systems. There is an urgent need for a new method that can overcome these shortcomings. Summary of the invention

[0021] In order to solve the problem that it is difficult to efficiently identify and process incremental data in the form of time series in the power system, the present invention proposes an incremental and stock data identification method based on adaptive deep learning, including:

[0022] Obtain the sequence to be identified;

[0023] Substituting the sequence to be identified into a pre-trained deep learning model to calculate the feature vectors of the sequence to be identified and the reference sequence, and calculating the Euclidean distance between the feature vectors of the sequence to be identified and the reference sequence, thereby determining the label of the sequence to be identified, wherein the label includes incremental data and stock data;

[0024] Among them, the deep learning models include: Siamese network and Transformer encoder;

[0025] The trained deep learning model is obtained by training the twin network and Transformer encoder based on historical stock data and incremental data.

[0026] Optionally, the training of the deep learning model includes:

[0027] Acquire incremental data and stock data, and normalize the incremental data and stock data;

[0028] Constructing positive sample pairs and negative sample pairs based on the normalized incremental data and stock data, and the positive sample pairs and negative sample pairs constitute a sample pair set;

[0029] Dividing the sample pair set into a training set, a validation set and a test set according to a set ratio;

[0030] Training the deep learning model based on the training set to obtain a preliminarily trained deep learning model;

[0031] The deep learning model after preliminary training is verified and tested based on the verification set and the test set, and the deep learning model after preliminary training that passes the verification and test is used as the trained deep learning model.

[0032] Optionally, constructing positive sample pairs and negative sample pairs based on normalized incremental data and stock data includes:

[0033] Select two sample sequences from the normalized stock data to construct positive sample pairs;

[0034] A sample sequence is selected from each of the normalized incremental data and stock data to construct a negative sample pair.

[0035] Optionally, the deep learning model uses a twin network combined with a Transformer encoder.

[0036] Optionally, the training the deep learning model based on the training set to obtain a preliminarily trained deep learning model includes:

[0037] The two sequences in the sample pair are respectively input into the two sub-networks in the twin network, and linear transformation is performed to map the feature dimension to the model dimension; and position encoding is added to the position of the element in the sequence after linear transformation;

[0038] The sequence with positional encoding is input into the Transformer encoder, and features are extracted from the sequence through a multi-head self-attention mechanism and a feedforward neural network, and a feature vector is obtained through global average pooling.

[0039] A contrast loss function is used to calculate the contrast loss function based on the feature vector, the gradient of the deep learning model parameters is calculated based on the contrast loss function, and the deep learning model parameters are updated using an optimizer to obtain a deep learning model after preliminary training.

[0040] Optionally, the contrast loss function is as follows:

[0041]

[0042] In the formula, is the contrast loss function, y is the label of the sample pair, d is the distance between the feature vectors, and m is the preset interval.

[0043] Optionally, the verifying and testing the preliminarily trained deep learning model based on the verification set and the test set, and using the preliminarily trained deep learning model that passes the verification and the test as a trained deep learning model, includes:

[0044] Substitute the sample pairs in the validation set into the deep learning model after preliminary training for iterative training. At the end of each round of iteration, evaluate the classification performance of the deep learning model after preliminary training on the validation set and select the optimal distance threshold.

[0045] After multiple iterations, the contrast loss function of the sample pair at each iteration is calculated;

[0046] When the comparison loss function does not decrease for a set number of consecutive times, the deep learning model after the preliminary training passes the verification;

[0047] Substitute the sample pairs in the test set into the deep learning model that has been preliminarily trained and verified to obtain the predicted labels;

[0048] Determine the predicted label and compare it with the true label corresponding to the sample pair in the test set, and calculate the evaluation index;

[0049] When the evaluation index meets the set requirements, the verified preliminary trained deep learning model passes the test to obtain a trained deep learning model.

[0050] On the other hand, the present invention also provides an incremental and stock data identification system based on adaptive deep learning, comprising:

[0051] An acquisition module, used for acquiring a sequence to be identified;

[0052] An identification module is used to substitute the sequence to be identified into a pre-trained deep learning model to calculate the feature vectors of the sequence to be identified and the reference sequence, and calculate the Euclidean distance between the feature vectors of the sequence to be identified and the reference sequence, thereby determining the label of the sequence to be identified, wherein the label includes incremental data and stock data;

[0053] Among them, the deep learning models include: Siamese network and Transformer encoder;

[0054] The trained deep learning model is obtained by training the twin network and Transformer encoder based on historical stock data and incremental data.

[0055] Optionally, it also includes: a training module, including:

[0056] A normalization processing unit, used to obtain incremental data and stock data, and perform normalization processing on the incremental data and stock data;

[0057] A sample set processing unit, used to construct positive sample pairs and negative sample pairs based on the normalized incremental data and stock data, wherein the positive sample pairs and negative sample pairs constitute a sample pair set;

[0058] A set division unit, used for dividing the sample pair set into a training set, a validation set and a test set according to a set ratio;

[0059] A training unit, used to train the deep learning model based on the training set to obtain a preliminarily trained deep learning model;

[0060] The verification and testing unit is used to verify and test the preliminarily trained deep learning model based on the verification set and the test set, and use the preliminarily trained deep learning model that passes the verification and test as the trained deep learning model.

[0061] Optionally, the sample set processing unit is specifically used for:

[0062] Select two sample sequences from the normalized stock data to construct positive sample pairs;

[0063] A sample sequence is selected from each of the normalized incremental data and stock data to construct a negative sample pair.

[0064] Optionally, the deep learning model uses a twin network combined with a Transformer encoder.

[0065] Optionally, the training unit is specifically used for:

[0066] The two sequences in the sample pair are respectively input into the two sub-networks in the twin network, and linear transformation is performed to map the feature dimension to the model dimension; and position encoding is added to the position of the element in the sequence after linear transformation;

[0067] The sequence with positional encoding is input into the Transformer encoder, and features are extracted from the sequence through a multi-head self-attention mechanism and a feedforward neural network, and a feature vector is obtained through global average pooling.

[0068] A contrast loss function is used to calculate the contrast loss function based on the feature vector, the gradient of the deep learning model parameters is calculated based on the contrast loss function, and the deep learning model parameters are updated using an optimizer to obtain a deep learning model after preliminary training.

[0069] Optionally, the contrast loss function is as follows:

[0070]

[0071] In the formula, is the contrast loss function, y is the label of the sample pair, d is the distance between the feature vectors, and m is the preset interval.

[0072] Optionally, the verification test unit is specifically used for:

[0073] Substitute the sample pairs in the validation set into the deep learning model after preliminary training for iterative training. At the end of each round of iteration, evaluate the classification performance of the deep learning model after preliminary training on the validation set and select the optimal distance threshold.

[0074] After multiple iterations, the contrast loss function of the sample pair at each iteration is calculated;

[0075] When the comparison loss function does not decrease for a set number of consecutive times, the deep learning model after the preliminary training passes the verification;

[0076] Substitute the sample pairs in the test set into the deep learning model that has been preliminarily trained and verified to obtain the predicted labels;

[0077] Determine the predicted label and compare it with the true label corresponding to the sample pair in the test set, and calculate the evaluation index;

[0078] When the evaluation index meets the set requirements, the verified preliminary trained deep learning model passes the test to obtain a trained deep learning model.

[0079] In another aspect, the present application further provides an electronic device, comprising: at least one processor and a memory; the memory and the processor are connected via a bus;

[0080] The memory is used to store one or more programs;

[0081] When the one or more programs are executed by the at least one processor, an incremental and stock data identification method based on adaptive deep learning as described above is implemented.

[0082] On the other hand, the present application also provides a readable storage medium having an execution program stored thereon. When the execution program is executed, it implements the incremental and stock data identification method based on adaptive deep learning as described above.

[0083] Compared with the prior art, the present invention has the following beneficial effects:

[0084] The present invention provides a method for identifying incremental and stock data based on adaptive deep learning, including: obtaining a sequence to be identified; substituting the sequence to be identified into a pre-trained deep learning model to calculate the feature vectors of the sequence to be identified and the reference sequence, and calculating the Euclidean distance between the feature vectors of the sequence to be identified and the reference sequence, and then determining the label of the sequence to be identified, the label including incremental data and stock data; wherein the deep learning model includes: a twin network and a Transformer encoder; the trained deep learning model is obtained by training the twin network and the Transformer encoder based on historical stock data and incremental data. The present invention uses a trained deep learning model to flexibly deal with the problem of poor recognition effect caused by equipment upgrades, environmental fluctuations, user behavior changes, etc., and can accurately distinguish incremental data from stock data. BRIEF DESCRIPTION OF THE DRAWINGS

[0085] Figure 1 This is a flow chart of a method for identifying incremental and stock data based on adaptive deep learning according to the present invention;

[0086] Figure 2 It is a main process step diagram of the incremental and stock data identification method of the present invention;

[0087] Figure 3 Schematic diagram of the twin network structure used to extract sequence data features;

[0088] FIG4( a ) is a graph showing the change of the loss function on the training set and the validation set during the training process of the embodiment;

[0089] FIG4( b ) is a graph showing changes in accuracy on a training set and a validation set during the training process of the embodiment;

[0090] Figure 5 The performance of the embodiment on the test set after training is completed.

[0091] Figure 6 The figure is a schematic diagram of the structure of an electronic device of the present invention. DETAILED DESCRIPTION

[0092] Aiming at the characteristics of incremental data in terms of time-related characteristics and changes in complex feature patterns, the present invention proposes an incremental and stock data identification method based on adaptive deep learning to improve the accuracy and efficiency of incremental data identification.

[0093] Specifically, it involves an incremental and stock data identification method based on adaptive deep learning, which is suitable for incremental data access and management in power systems and data middle stations. Incremental data usually exists in the form of time series in power systems, and its feature extraction and management face complex time dependency and feature change problems.

[0094] In order to better understand the present invention, the content of the present invention is further described below in conjunction with the accompanying drawings and embodiments.

[0095] Embodiment 1:

[0096] A method for identifying incremental and stock data based on adaptive deep learning, such as Figure 1 As shown, including:

[0097] Step 1: Get the sequence to be identified;

[0098] Step 2: Substitute the sequence to be identified into a pre-trained deep learning model to calculate the feature vectors of the sequence to be identified and the reference sequence, and calculate the Euclidean distance between the feature vectors of the sequence to be identified and the reference sequence, thereby determining the label of the sequence to be identified, wherein the label includes incremental data and stock data;

[0099] Among them, the deep learning models include: Siamese network and Transformer encoder;

[0100] The trained deep learning model is obtained by training the twin network and Transformer encoder based on historical stock data and incremental data.

[0101] The steps of the present invention are further described below:

[0102] Step 1: Get the sequence to be identified.

[0103] In this embodiment, data of a certain month can be selected from the energy consumption readings of 5,567 London households in the low-carbon London project led by the UK power network, and the data of the month can be sorted in chronological order to form a sequence; the sequence can be used as a sequence to be identified after pre-processing such as normalization.

[0104] Before step 2, it also includes: training of the deep learning model.

[0105] Among them, the deep learning model uses a twin network combined with a Transformer encoder as the model architecture. The input sequence is linearly transformed and positionally encoded, and then input into a multi-layer Transformer encoder. The encoder extracts features from the sequence through a multi-head self-attention mechanism and a feedforward neural network. The final output sequence is subjected to global average pooling to obtain a fixed-length feature vector, which is then mapped to the final embedding space through a fully connected layer. The contrastive loss function is used during model training. For positive sample pairs, the optimization goal is to minimize the Euclidean distance between feature vectors; for negative sample pairs, the optimization goal is to make the distance between feature vectors greater than the preset margin. In this way, the model learns to map the features of similar sequences to similar positions in the embedding space, and the features of dissimilar sequences to positions farther away. The early stopping method is used during model training, and training is stopped when the loss on the validation set does not decrease after k consecutive iterations. At the end of each round of iteration, the model classification performance is evaluated on the validation set, and the distance threshold with the best classification performance is selected as the final classification threshold.

[0106] Training of this deep learning model involves:

[0107] Acquire incremental data and stock data, and normalize the incremental data and stock data;

[0108] Constructing positive sample pairs and negative sample pairs based on the normalized incremental data and stock data, and the positive sample pairs and negative sample pairs constitute a sample pair set;

[0109] Dividing the sample pair set into a training set, a validation set and a test set according to a set ratio;

[0110] Training the deep learning model based on the training set to obtain a preliminarily trained deep learning model;

[0111] The deep learning model after preliminary training is verified and tested based on the verification set and the test set, and the deep learning model after preliminary training that passes the verification and test is used as the trained deep learning model.

[0112] Furthermore, constructing positive sample pairs and negative sample pairs based on the normalized incremental data and stock data includes:

[0113] Select two sample sequences from the normalized stock data to construct positive sample pairs;

[0114] A sample sequence is selected from each of the normalized incremental data and stock data to construct a negative sample pair.

[0115] Furthermore, the deep learning model is trained based on the training set to obtain a preliminarily trained deep learning model, including:

[0116] The two sequences in the sample pair are respectively input into the two sub-networks in the twin network, and linear transformation is performed to map the feature dimension to the model dimension; and position encoding is added to the position of the element in the sequence after linear transformation;

[0117] The sequence with positional encoding is input into the Transformer encoder, and features are extracted from the sequence through a multi-head self-attention mechanism and a feedforward neural network, and a feature vector is obtained through global average pooling.

[0118] A contrast loss function is used to calculate the contrast loss function based on the feature vector, the gradient of the deep learning model parameters is calculated based on the contrast loss function, and the deep learning model parameters are updated using an optimizer to obtain a deep learning model after preliminary training.

[0119] The specific process is as follows: the core of the algorithm model is a Siamese Network with Transformer, which is designed to extract features and measure similarity of time series data, thereby identifying the differences between incremental data and stock data.

[0120] The twin network consists of two sub-networks that share weights. Each sub-network receives one of the input sequence pairs and outputs a feature vector after feature extraction. Due to the shared weights, the two sub-networks extract features in exactly the same way. This structure ensures that for similar inputs, the model will generate similar outputs, making it easier to compare.

[0121] The shape of the sequence S input to the subnetwork is (L, D), where L is the sequence length and D is the feature dimension. First, the input sequence is linearly transformed to map the feature dimension from D to the model dimension d model :

[0122]

[0123] Where x is the L×d output of the linear transformation model dimensional tensor, = L×d model dimensional tensor space;

[0124] Next, in order to make the model aware of the position of elements in the sequence, positional encoding is added:

[0125] x pos =x+PE

[0126] In the formula, x pos is the output result of the position coding sequence, PE is the position coding;

[0127] The calculation method of the position code PE is:

[0128]

[0129]

[0130] Among them, PE (pos,2i) Represents the sinusoidal position encoding element of the even encoding dimension at pos, PE (pos,2i+1) represents the cosine position encoding element of the odd encoding dimension at pos, d model Represents the dimension of the model, pos represents the position index, and i represents the dimension index. The introduction of position encoding enables the model to distinguish elements at different positions in the sequence and capture the sequential information of the time series.

[0131] The position-encoded sequence is input into the multi-layer Transformer encoder. The Transformer encoder processes sequence data through a multi-head self-attention mechanism and a feedforward neural network. The multi-head self-attention mechanism can capture the association between any two positions in the sequence:

[0132]

[0133] Where Q, K, and V are query, key, and value matrices respectively, k is the dimension of the key. The feedforward neural network performs a nonlinear transformation on the output of each position:

[0134] FFN(x)=ReLU(xW1+b1)W2+b2

[0135] Where FFN(x) is the feedforward network function, ReLU is the rectified linear unit activation function, W1 is the weight matrix, b1 is the bias vector, and b2 is another bias vector.

[0136] The Transformer encoder can effectively capture the global and local features in the sequence. The output of the encoder is subjected to global average pooling to aggregate the sequence information into a feature vector of fixed length:

[0137]

[0138] The feature vector h represents the comprehensive features of the input sequence and captures the overall information of the sequence; L represents the sequence length of the input data. represents the output of the encoder at position i, and i represents the index variable of the sum. Subsequently, the feature vector is mapped to the final embedding space through a fully connected layer:

[0139] h final =ReLU(hW+b)

[0140] Finally, each input sequence is mapped to a fixed-length embedding vector h final , used for subsequent similarity calculation, W represents the weight matrix, and b represents the deviation vector.

[0141] The twin network completes the task of extracting features from the sequence and maps the L×D sequence to an E-dimensional embedding space.

[0142] f(·;θ):R L×D →R E

[0143] Among them, θ is the network parameter, R L×D is the input space, R E is the embedding space of the output. E is the dimension of the embedding space, and f(·;θ) represents the function that transforms the input sequence using the neural network parameters θ.

[0144] In the training process of the twin network of this embodiment, the contrastive loss function is used to guide the model to learn to map similar sequences to similar embedding space positions and dissimilar sequences to farther positions. is defined as follows:

[0145]

[0146] Where d = ‖ha -h b ‖2 The Euclidean distance between the embedding vectors of two sequences, h a The embedding vector generated for the first sequence in the sequence pair, h b The embedding vector generated for the second sequence, y∈{0,1} is the label of the sample pair, y=0 represents a similar sample pair, i.e. a positive sample pair, and y=1 represents a dissimilar sample pair, i.e. a negative sample pair. m is a preset margin, which is used to control the minimum distance between dissimilar sample pairs.

[0147] For similar sample pairs (y = 0), the loss function is actually The optimization will make the distance d between the embedding vectors as small as possible, thus encouraging the model to minimize the distance between similar sample pairs. For dissimilar sample pairs, the loss function is actually When d is less than m, a loss occurs. It is hoped that the distance d between the embedded vectors is at least greater than the interval m. The optimization will enable the model to increase the distance between dissimilar sample pairs.

[0148] When the model is trained, for each input sample pair (S a ,S b ,y), and feed forward h through the twin network a =f(S a ;θ),h b =f(S b ; θ), calculate the distance between the embedded vectors d = ‖h a -h b ‖2, calculate the contrast loss function Based on the gradient of the loss function with respect to the model parameters Use the optimizer to update the model parameters Where η is the learning rate, f(S a ; θ) represents the use of neural network parameters θ to analyze the input sequence S a The function for conversion, f(S b ; θ), which means using the neural network parameter θ to analyze the input sequence S b The function for conversion, S a is a sequence in the input pair, S b is another sequence, and θ is all the learnable parameters of the model.

[0149] This embodiment uses the early stopping method to determine the actual number of iterations required. When the contrast loss function on the validation set does not decrease for k = 5 consecutive times, the training is stopped. During the training iteration process, at the end of each round of iteration, the classification performance of the model is evaluated on the validation set, and the optimal distance threshold δ is selected. *, so that the classification performance of the model on the validation set is optimal. After the training is completed, the optimal distance threshold δ * , used to evaluate the model performance on the test set.

[0150] First, we calculate each pair of embedding vectors (h ai ,h bi ) between i =‖h ai -h bi ‖2, where d i is the calculated Euclidean distance, h ai is the embedding vector calculated for the first sequence in the i-th sequence pair in the validation set, h bi The embedding vector calculated for the second sequence in the i-th sequence pair in the validation set is then traversed over different thresholds δ, and the corresponding true positive rate (TPR) and false positive rate (FPR) are calculated for each threshold to construct the ROC curve.

[0151]

[0152] Among them, y i is the true label of the i-th pair of compared sequences, i is the index variable for summation, N is the total number of sequence pairs in the validation set, and Youden's J statistic J(δ) = TPR(δ) - FPR(δ) is calculated. The threshold that maximizes J(δ) is selected as the optimal threshold δ * = argmax δ J(δ). When evaluating the model performance on the test set, use the optimal threshold δ determined on the validation set during training. * , the distance d to the embedding vector in the test set i To classify:

[0153]

[0154] The predicted label and the true label y i Compare and calculate evaluation indicators such as accuracy, precision, recall, and F1 score to evaluate the performance of the model on the test set.

[0155] Step 2: Substitute the sequence to be identified into a pre-trained deep learning model to calculate the feature vectors of the sequence to be identified and the reference sequence, and calculate the Euclidean distance between the feature vectors of the sequence to be identified and the reference sequence, and then determine whether the sequence to be identified is incremental data or stock data, including:

[0156] Substituting the sequence to be identified into a pre-trained deep learning model to calculate the Euclidean distance between the feature vectors of the sequence to be identified and the reference sequence;

[0157] If the Euclidean distance between the feature vectors of the sequence to be identified and the reference sequence is less than a set threshold, the sequence to be identified is stock data, otherwise it is incremental data.

[0158] The present invention specifically targets incremental data in the form of time series and proposes an incremental and stock data identification method based on adaptive deep learning, aiming to solve the problem in the prior art that it is difficult to efficiently identify and process incremental data.

[0159] The object of the present invention is:

[0160] The limitation of existing incremental data recognition technology in dealing with complex time dependencies and feature changes is solved. The present invention adopts an incremental data feature representation generation algorithm based on deep learning, and realizes rapid recognition and access of incremental data by comparing the feature distribution of incremental data with stock data, so as to overcome the problem that existing methods cannot flexibly respond to equipment upgrades, environmental fluctuations, user behavior changes, etc., resulting in poor recognition results.

[0161] The problem that there is no mature research result that can effectively solve the problem of feature extraction and differentiation of incremental data and stock data in the form of time series is solved. The present invention designs an adaptive feature extraction method that can capture the time-related characteristics of data, and enhances the recognition ability of complex feature patterns through a deep learning model, thereby comprehensively extracting the global and local features of the data, effectively solving the limitations of traditional methods in dealing with time dependence and feature changes in incremental data.

[0162] An efficient and accurate method for automatically identifying incremental data is provided. The present invention adopts a contrastive learning method to compare the features of stock data and incremental data. By optimizing the contrast loss function, similar feature vectors of stock data are close to each other, while the feature vectors of dissimilar incremental data and stock data are kept at a large distance, thereby realizing automatic identification of incremental data. In particular, the process is aimed at incremental data in the form of time series, and by modeling the time features and comparing them with the feature representation of stock data, it is determined whether the input time series data is incremental data.

[0163] To sum up, the purpose of the present invention is to address the shortcomings of the prior art and propose a method for identifying incremental and stock data based on adaptive deep learning, so as to solve the problem that it is difficult to efficiently identify and process incremental data in the form of time series in the power system, and to improve the accuracy and efficiency of incremental data identification.

[0164] The present invention proposes a method for identifying incremental and stock data based on adaptive deep learning, the main steps of which are as follows: Figure 2As shown, it mainly includes the following key technical links:

[0165] Incremental data feature extraction: This paper designs an adaptive feature extraction method specifically for incremental data in the form of time series, which can capture the time-related characteristics of the data. Through the deep learning model, the recognition ability of complex feature patterns is enhanced, so that the global and local features of the data can be fully extracted.

[0166] Incremental data feature representation generation: The feature representation of incremental data is generated by processing the extracted features. This feature representation can effectively capture the key characteristics of incremental data, facilitate rapid comparison with existing data, and thus identify changes in data features. The feature representation generation algorithm is based on the Siamese network structure. By comparing and training the feature vectors of positive and negative sample pairs, the model's sensitivity to data similarity is improved, thereby effectively distinguishing incremental data from existing data.

[0167] Automatic identification of incremental data: The present invention adopts a contrastive learning method to compare the features of stock data and incremental data, thereby realizing automatic identification of incremental data. By using the contrastive loss function to optimize the model, similar stock data feature vectors are close to each other, while the feature vectors of dissimilar incremental data and stock data are kept at a large distance, thereby realizing efficient and accurate incremental data identification. In particular, this process is aimed at incremental data in the form of time series, and by modeling the time features and comparing them with the feature representation of stock data, it is determined whether the input time series data is incremental data.

[0168] In summary, the method for feature extraction and differentiation of incremental data and stock data based on adaptive deep learning proposed in the present invention effectively solves the problem that the existing technology is difficult to efficiently identify and process incremental data in the form of time series through three key technical links: incremental data feature extraction, feature representation generation and automatic recognition.

[0169] Example 2

[0170] A specific embodiment of the technical solution of the present invention is as follows:

[0171] 1) Data preparation and preprocessing

[0172] This example uses the daily_dataset subset in the "Smart meters in London" dataset of Kaggle, which contains energy consumption readings of 5,567 London households in the Low Carbon London Project led by British Power Networks from November 2011 to February 2014. The daily_dataset subset provides daily electricity consumption data information, including the minimum, maximum, average, median, sum and standard deviation of electricity consumption. The data columns and the first two rows of data in this subset are shown in Table 1.

[0173] The daily_dataset subset has a total of 3,510,418 rows of data. Each row of data covers the following fields: LCLid, which is the household unique identifier; day, which represents the date; energy_median, which is the median of daily energy consumption; energy_mean, which is the average of daily energy consumption; energy_max, which is the maximum value of daily energy consumption; energy_count, which is the count of daily energy consumption; energy_std, which is the standard deviation of daily energy consumption; energy_sum, which is the sum of daily energy consumption; energy_min, which is the minimum value of daily energy consumption. This example uses the three features of energy_max, energy_min, and energy_median in the dataset as the features of the time series.

[0174] Table 1

[0175]

[0176] This example selects summer (June, July, and August) data as stock data, winter (December, January, and February) data as incremental data, and selects three features, energy_max, energy_min, and energy_median, to construct time series samples. The three features are normalized respectively, the time series length is set to 30 days, and the sample sequence is constructed by sliding windows. Next, summer sequence pairs are randomly selected as positive samples (stock-stock), summer and winter sequence pairs are selected as negative samples (stock-increment), and are divided into training set, validation set, and test set in a ratio of 8:1:1.

[0177] The specific process is as follows: First, according to the value of the date (day) column, the rows of June, July, and August are extracted as summer data, and their row index is month() is the date from the ith row (day i ) to extract the month value; day i For the date of the i-th row, extract the rows of December, January, and February as winter data, and its row index is

[0178] The three features of energy_max, energy_min, and energy_median extracted from the summer and winter data are normalized respectively. For feature x, the normalization method is: x i is the x feature value before normalization of the i-th row, is the normalized value, x min is the minimum value of feature x, x max is the maximum value of feature x.

[0179] The time series length L is set to capture the pattern of data changes within L time steps. In this embodiment, L=30 is set to capture the pattern and trend of power consumption data in a one-month time window. The summer and winter index sets are traversed separately to find the starting index that can form a sequence (called a valid sequence) that continuously contains L time steps. For summer data, the starting index set for:

[0180]

[0181] For the winter data, the starting index set for:

[0182]

[0183] For each valid starting index i, extract the sequence Each element in the sequence is a vector of dimension D = 3, Get the summer sequence collection

[0184] and Winter Sequence Collection Among them, S i represents a sequence in the summer sequence set, consisting of L continuous normalized eigenvectors. i represents the sequence from the set The starting position index of the sequence extracted from is the first normalized eigenvector in the sequence, is the second normalized eigenvector in the sequence, is the L-1th normalized eigenvector in the sequence, is the first normalized eigenvector in the winter series, is the second normalized eigenvector in the winter series, is the L-1th normalized eigenvector in the winter sequence, k is the number of features from the winter sequence The starting position index of the winter sequence selected in S krepresents a sequence in the winter sequence set, consisting of k consecutive normalized eigenvectors;

[0185] Randomly select N pairs of sequences from the summer sequence set as the positive sample pair set, and the corresponding label is 0. The meaning of a positive sample pair is that both sample sequences come from the stock data (summer):

[0186]

[0187] In the formula, is the set of positive sample pairs, For the two sequences in the summer data set, form a pair, y n is the label assigned to these pairs, n is the sample index, and N is the total number of positive pairs being generated;

[0188] Randomly select one sequence from each of the summer sequence set and the winter sequence set, a total of N pairs, as the negative sample pair set, and the corresponding label is 1. The meaning of the negative sample pair is that the two sample sequences come from the stock data (summer) and the incremental data (winter) respectively:

[0189]

[0190] In the formula, is the set of negative sample pairs, For the winter dataset sequence;

[0191] Merge positive and negative sample pairs into a sample pair set The order of samples is randomly shuffled and then divided into training set, validation set and test set. In this embodiment, the ratio of the number of samples in the three sets is set to 8:1:1. is the training set, is the validation set, For the test set.

[0192] 2) Model architecture and training

[0193] This embodiment uses a twin network combined with a Transformer encoder as the model architecture. The input sequence is linearly transformed and positionally encoded, and then input into a multi-layer Transformer encoder. The encoder extracts features from the sequence through a multi-head self-attention mechanism and a feedforward neural network. The final output sequence is subjected to global average pooling to obtain a feature vector of fixed length, which is then mapped to the final embedding space through a fully connected layer. The contrastive loss function is used for model training. For positive sample pairs, the optimization goal is to minimize the Euclidean distance between feature vectors; for negative sample pairs, the optimization goal is to make the distance between feature vectors greater than a preset margin. In this way, the model learns to map the features of similar sequences to similar positions in the embedding space, and the features of dissimilar sequences to positions farther away. The early stopping method is used for model training, and training is stopped when the loss on the validation set does not decrease after k consecutive iterations. At the end of each round of iteration, the model classification performance is evaluated on the validation set, and the distance threshold at which the classification performance is optimal is selected as the final classification threshold.

[0194] The specific process is as follows: the core of the algorithm model is a Siamese Network with Transformer, which is designed to extract features and measure similarity of time series data, thereby identifying the differences between incremental data and stock data.

[0195] The twin network consists of two sub-networks that share weights. Each sub-network receives one of the input sequence pairs and outputs a feature vector after feature extraction. Due to the shared weights, the two sub-networks extract features in exactly the same way. This structure ensures that for similar inputs, the model will generate similar outputs, making it easier to compare.

[0196] The shape of the sequence S input to the subnetwork is (L, D), where L is the sequence length and D is the feature dimension. First, the input sequence is linearly transformed to map the feature dimension from D to the model dimension d model :

[0197]

[0198] Next, in order to make the model aware of the position of elements in the sequence, positional encoding is added:

[0199] x pos =x+PE

[0200] The calculation method of the position code PE is:

[0201]

[0202] Where pos represents the position index and i represents the dimension index. The introduction of position encoding enables the model to distinguish elements at different positions in the sequence and capture the sequential information of the time series.

[0203] The position-encoded sequence is input into the multi-layer Transformer encoder. The Transformer encoder processes sequence data through a multi-head self-attention mechanism and a feedforward neural network. The multi-head self-attention mechanism can capture the association between any two positions in the sequence:

[0204]

[0205] Where Q, K, and V are query, key, and value matrices respectively, k is the dimension of the key. The feedforward neural network performs a nonlinear transformation on the output of each position:

[0206] FFN(x)=ReLU(xW1+b1)W2+b2

[0207] The Transformer encoder can effectively capture the global and local features in the sequence. The output of the encoder is subjected to global average pooling to aggregate the sequence information into a feature vector of fixed length:

[0208]

[0209] The feature vector h represents the comprehensive features of the input sequence and captures the overall information of the sequence. Subsequently, the feature vector is mapped to the final embedding space through a fully connected layer:

[0210] h final =ReLU(hW+b)

[0211] Finally, each input sequence is mapped to a fixed-length embedding vector h final , used for subsequent similarity calculation.

[0212] The twin network completes the task of extracting features from the sequence and maps the L×D sequence to an E-dimensional embedding space.

[0213] f(·;θ):R L×D →R E

[0214] Where θ is the network parameter. E is the dimension of the embedding space

[0215] In the training process of the twin network of this embodiment, the contrastive loss function is used to guide the model to learn to map similar sequences to similar embedding space positions and dissimilar sequences to farther positions. The definition of the contrastive loss function is as follows:

[0216]

[0217] Where d = ‖h a -h b ‖2 is the Euclidean distance between the embedding vectors of two sequences, y∈{0,1} is the label of the sample pair, y=0 represents a similar sample pair, i.e. a positive sample pair, and y=1 represents a dissimilar sample pair, i.e. a negative sample pair. m is a preset margin, which is used to control the minimum distance of dissimilar sample pairs.

[0218] For similar sample pairs (y = 0), the loss function is actually The optimization will make the distance d between the embedding vectors as small as possible, thus encouraging the model to minimize the distance between similar sample pairs. For dissimilar sample pairs, the loss function is actually When d is less than m, a loss occurs. It is hoped that the distance d between the embedded vectors is at least greater than the interval m. The optimization will enable the model to increase the distance between dissimilar sample pairs.

[0219] When the model is trained, for each input sample pair (S a ,S b ,y), and feed forward h through the twin network a =f(S a ; θ),h b =f(S b ; θ), calculate the distance between the embedded vectors d = ‖h a -h b ‖2, calculate the contrast loss function Based on the gradient of the loss function with respect to the model parameters Use the optimizer to update the model parameters Where η is the learning rate.

[0220] This embodiment uses the early stopping method to determine the actual number of iterations required. When the contrast loss function on the validation set does not decrease for k = 5 consecutive times, the training is stopped. During the training iteration process, at the end of each round of iteration, the classification performance of the model is evaluated on the validation set, and the optimal distance threshold δ is selected. * , so that the classification performance of the model on the validation set is optimal. After the training is completed, the optimal distance threshold δ * , used to evaluate the model performance on the test set.

[0221] First, we calculate each pair of embedding vectors (h ai ,h bi ) between i =‖h ai -h bi ‖2, then, traverse different thresholds δ, calculate the corresponding true positive rate (TPR) and false positive rate (FPR) for each threshold, and construct the ROC curve.

[0222]

[0223] Calculate Youden's J statistic J(δ) = TPR(δ) - FPR(δ), and select the threshold that maximizes J(δ) as the optimal threshold δ * = argmax δ J(δ). When evaluating the model performance on the test set, use the optimal threshold δ determined on the validation set during training. * , the distance d to the embedding vector in the test set i To classify:

[0224]

[0225] The predicted label and the true label y i Compare and calculate evaluation indicators such as accuracy, precision, recall, and F1 score to evaluate the performance of the model on the test set.

[0226] 3) Incremental data identification

[0227] For a new sequence to be identified, a certain number of reference sequences and their labels (0 / 1) are first selected from the stock / incremental data. The feature vectors of the sequence to be identified and the reference sequence are calculated using the trained model, and the Euclidean distance between the feature vectors of the sequence to be identified and the reference sequence is calculated. Next, the k closest reference sequences are selected, and the label (stock / incremental) of the sequence to be identified is determined by majority voting.

[0228] The specific process is as follows: First, a certain number of sequences are selected from the summer and winter datasets as reference samples, and the labels y and i = 0 (summer / stock data) and y i =1 (winter / incremental data). For each reference sequence S i , use the trained model to calculate its embedding vector: h i =f(S i ). Use these references to embed h i and its corresponding label y iTrain a KNN classifier and use the embedding vector as a feature for classifier training. For the new sequence S to be classified new , and similarly calculate its embedding vector: h new =f(S new ). Then, we calculate the Euclidean distance between the new sequence embedding and all reference embeddings: d i =‖h new -h i ‖2. By selecting the k closest reference embeddings (i.e., the k smallest d i ), use the labels of these neighboring samples to perform majority voting and predict the label of the new sequence (Stock data / incremental data). Among them, y (k) Represents the label of the kth nearest neighbor reference sample, k takes values ​​of 1, 2, etc., and mode is the mode function.

[0229] 4) Experimental verification

[0230] In order to verify the effectiveness of the method proposed in the present invention, this embodiment constructs the following Figure 3 The twin network shown in the figure was constructed, and the first 1000 rows of data were taken from the daily_dataset subset for training and verification. In the experiment, 681 stock data sequences (summer) and 739 incremental data sequences (winter) were constructed, and 1000 positive sample pairs and 1000 negative sample pairs were randomly paired. During the training process, the changes in the loss function and the accuracy rate on the training set and the verification set are shown in Figure 4(a) and Figure 4(b). It can be seen that the method of this embodiment converged after about 30 iterations of training. After the training, the performance on the test set is as follows Figure 5 As shown, high accuracy, precision, recall and F1 value were achieved.

[0231] The present invention proposes a method for identifying incremental and stock data based on adaptive deep learning, which significantly improves the recognition and processing efficiency of incremental data in the form of time series in the power system. By designing an adaptive feature extraction method, the problems of complex time dependency and feature changes are successfully solved; the feature representation generation algorithm based on the twin network and the comparative learning method are adopted to improve the accuracy and efficiency of incremental data recognition, filling the technical gap in the feature extraction and differentiation of incremental data in the form of time series. This method has good versatility and scalability, and its effectiveness has been verified by experiments. It has achieved high accuracy and excellent performance on actual data sets, which is of great significance to the data management and analysis of power systems.

[0232] The present invention adopts a Siamese Network structure and generates feature representations of incremental data by comparing and training the feature vectors of positive and negative sample pairs, thereby improving the model's sensitivity to data similarity and effectively distinguishing incremental data from stock data.

[0233] The method of generating feature representation using the twin network structure, including the design of twin networks with shared weights, the optimization of contrastive loss functions, and its application to time series data, enhances the model's ability to capture feature differences.

[0234] By optimizing the contrastive loss function, similar feature vectors of stock data are brought close to each other, while feature vectors of incremental data and stock data are kept at a large distance, thus achieving efficient and automatic recognition of incremental data.

[0235] In the recognition of incremental data in time series, the method of applying contrastive learning strategy and contrastive loss function for model training improves the accuracy and robustness of incremental data recognition.

[0236] An incremental data recognition process based on the training model and reference sequence was designed. The feature vector distance between the sequence to be recognized and the reference sequence was calculated and combined with the K nearest neighbor (KNN) classifier to achieve rapid recognition of incremental data.

[0237] The invention discloses a method for incremental data recognition using feature vector distance and KNN classifier, including reference sequence selection, distance calculation, and label determination mechanism based on majority voting.

[0238] Example 3

[0239] The present invention based on the same inventive concept also provides an incremental and stock data identification system based on adaptive deep learning, comprising:

[0240] An acquisition module, used for acquiring a sequence to be identified;

[0241] An identification module is used to substitute the sequence to be identified into a pre-trained deep learning model to calculate the feature vectors of the sequence to be identified and the reference sequence, and calculate the Euclidean distance between the feature vectors of the sequence to be identified and the reference sequence, thereby determining the label of the sequence to be identified, wherein the label includes incremental data and stock data;

[0242] Among them, the deep learning models include: Siamese network and Transformer encoder;

[0243] The trained deep learning model is obtained by training the twin network and Transformer encoder based on historical stock data and incremental data.

[0244] Optionally, it also includes: a training module, including:

[0245] A normalization processing unit, used to obtain incremental data and stock data, and perform normalization processing on the incremental data and stock data;

[0246] A sample set processing unit, used to construct positive sample pairs and negative sample pairs based on the normalized incremental data and stock data, wherein the positive sample pairs and negative sample pairs constitute a sample pair set;

[0247] A set division unit, used for dividing the sample pair set into a training set, a validation set and a test set according to a set ratio;

[0248] A training unit, used to train the deep learning model based on the training set to obtain a preliminarily trained deep learning model;

[0249] The verification and testing unit is used to verify and test the preliminarily trained deep learning model based on the verification set and the test set, and use the preliminarily trained deep learning model that passes the verification and test as the trained deep learning model.

[0250] Optionally, the sample set processing unit is specifically used for:

[0251] Select two sample sequences from the normalized stock data to construct positive sample pairs;

[0252] A sample sequence is selected from each of the normalized incremental data and stock data to construct a negative sample pair.

[0253] Optionally, the deep learning model uses a twin network combined with a Transformer encoder.

[0254] Optionally, the training unit is specifically used for:

[0255] The two sequences in the sample pair are respectively input into the two sub-networks in the twin network, and linear transformation is performed to map the feature dimension to the model dimension; and position encoding is added to the position of the element in the sequence after linear transformation;

[0256] The sequence with positional encoding is input into the Transformer encoder, and features are extracted from the sequence through a multi-head self-attention mechanism and a feedforward neural network, and a feature vector is obtained through global average pooling.

[0257] A contrast loss function is used to calculate the contrast loss function based on the feature vector, the gradient of the deep learning model parameters is calculated based on the contrast loss function, and the deep learning model parameters are updated using an optimizer to obtain a deep learning model after preliminary training.

[0258] Optionally, the contrast loss function is as follows:

[0259]

[0260] In the formula, is the contrast loss function, y is the label of the sample pair, d is the distance between the feature vectors, and m is the preset interval.

[0261] Optionally, the verification test unit is specifically used for:

[0262] Substitute the sample pairs in the validation set into the deep learning model after preliminary training for iterative training. At the end of each round of iteration, evaluate the classification performance of the deep learning model after preliminary training on the validation set and select the optimal distance threshold.

[0263] After multiple iterations, the contrast loss function of the sample pair at each iteration is calculated;

[0264] When the comparison loss function does not decrease for a set number of consecutive times, the deep learning model after the preliminary training passes the verification;

[0265] Substitute the sample pairs in the test set into the deep learning model that has been preliminarily trained and verified to obtain the predicted labels;

[0266] Determine the predicted label and compare it with the true label corresponding to the sample pair in the test set, and calculate the evaluation index;

[0267] When the evaluation index meets the set requirements, the verified preliminary trained deep learning model passes the test to obtain a trained deep learning model.

[0268] Example 4

[0269] like Figure 6 As shown, the present invention also provides an electronic device, which may be a computer device, a single-chip device, an intelligent mobile device, etc. The electronic device in this embodiment may include a processor, a memory, a transceiver component, etc. The memory, the processor, and the transceiver component are connected via a bus; the memory may be used to store an execution program, and an exemplary execution program may include instructions; the processor is used to execute the instructions stored in the memory. The memory may also be used to store data, which may be called and / or modified when the instructions are executed.

[0270] The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. It is the computing core and control core of the terminal, which is suitable for implementing one or more instructions, specifically suitable for loading and executing one or more instructions in a storage medium to implement the corresponding method flow or corresponding functions, so as to realize the steps of the incremental and stock data recognition method based on adaptive deep learning in the above-mentioned embodiment.

[0271] Example 5

[0272] Based on the same inventive concept, the present invention also provides a readable storage medium, specifically an electronic device readable storage medium (Memory), which is a memory device in an electronic device for storing programs and data. It can be understood that the storage medium here can include both built-in storage media in electronic devices and, of course, extended storage media supported by electronic devices. The storage medium provides a storage space that stores the operating system of the terminal. In addition, one or more instructions suitable for being loaded and executed by a processor are also stored in the storage space, and these instructions can be one or more execution programs (including program codes). It should be noted that the storage medium here can be a high-speed RAM memory or a non-volatile memory, such as at least one disk storage. The processor loads and executes one or more instructions stored in the storage medium, which can implement the steps of the incremental and stock data recognition method based on adaptive deep learning in the above embodiment.

[0273] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0274] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0275] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0276] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0277] The above are merely embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention are included in the scope of the claims of the present invention to be approved.

Claims

1. A method for identifying incremental and stock data based on adaptive deep learning, characterized in that: include: Obtain the sequence to be identified; Substituting the sequence to be identified into a pre-trained deep learning model to calculate the feature vectors of the sequence to be identified and the reference sequence, and calculating the Euclidean distance between the feature vectors of the sequence to be identified and the reference sequence, thereby determining the label of the sequence to be identified, wherein the label includes incremental data and stock data; Among them, the deep learning models include: Siamese network and Transformer encoder; The trained deep learning model is obtained by training the twin network and Transformer encoder based on historical stock data and incremental data.

2. The method according to claim 1, characterized in that The training of the deep learning model includes: Acquire incremental data and stock data, and normalize the incremental data and stock data; Constructing positive sample pairs and negative sample pairs based on the normalized incremental data and stock data, and the positive sample pairs and negative sample pairs constitute a sample pair set; Dividing the sample pair set into a training set, a validation set and a test set according to a set ratio; Training the deep learning model based on the training set to obtain a preliminarily trained deep learning model; The deep learning model after preliminary training is verified and tested based on the verification set and the test set, and the deep learning model after preliminary training that passes the verification and test is used as the trained deep learning model.

3. The method according to claim 2, characterized in that The constructing of positive sample pairs and negative sample pairs based on normalized incremental data and stock data includes: Select two sample sequences from the normalized stock data to construct positive sample pairs; A sample sequence is selected from each of the normalized incremental data and stock data to construct a negative sample pair.

4. The method according to claim 3, characterized in that The deep learning model uses a twin network combined with a Transformer encoder.

5. The method according to claim 4, characterized in that The step of training the deep learning model based on the training set to obtain a preliminarily trained deep learning model includes: The two sequences in the sample pair are respectively input into the two sub-networks in the twin network, and linear transformation is performed to map the feature dimension to the model dimension; and position encoding is added to the position of the element in the sequence after linear transformation; The sequence with positional encoding is input into the Transformer encoder, and features are extracted from the sequence through a multi-head self-attention mechanism and a feedforward neural network, and a feature vector is obtained through global average pooling. A contrast loss function is used to calculate the contrast loss function based on the feature vector, the gradient of the deep learning model parameters is calculated based on the contrast loss function, and the deep learning model parameters are updated using an optimizer to obtain a deep learning model after preliminary training.

6. The method according to claim 1, characterized in that The contrast loss function is shown as follows: In the formula, is the contrast loss function, y is the label of the sample pair, d is the distance between the feature vectors, and m is the preset interval.

7. The method according to claim 5, characterized in that The method of verifying and testing the preliminarily trained deep learning model based on the verification set and the test set, and using the preliminarily trained deep learning model that has passed the verification and the test as a trained deep learning model, includes: Substitute the sample pairs in the validation set into the deep learning model after preliminary training for iterative training. At the end of each round of iteration, evaluate the classification performance of the deep learning model after preliminary training on the validation set and select the optimal distance threshold. After multiple iterations, the contrast loss function of the sample pair at each iteration is calculated; When the comparison loss function does not decrease for a set number of consecutive times, the deep learning model after the preliminary training passes the verification; Substitute the sample pairs in the test set into the deep learning model that has been preliminarily trained and verified to obtain the predicted labels; Determine the predicted label and compare it with the true label corresponding to the sample pair in the test set, and calculate the evaluation index; When the evaluation index meets the set requirements, the verified preliminary trained deep learning model passes the test to obtain a trained deep learning model.

8. An incremental and stock data identification system based on adaptive deep learning, characterized in that: include: An acquisition module, used for acquiring a sequence to be identified; An identification module is used to substitute the sequence to be identified into a pre-trained deep learning model to calculate the feature vectors of the sequence to be identified and the reference sequence, and calculate the Euclidean distance between the feature vectors of the sequence to be identified and the reference sequence, thereby determining the label of the sequence to be identified, wherein the label includes incremental data and stock data; Among them, the deep learning models include: Siamese network and Transformer encoder; The trained deep learning model is obtained by training the twin network and Transformer encoder based on historical stock data and incremental data.

9. An electronic device, characterized in that: include: at least one processor and memory; The memory and the processor are connected via a bus; The memory is used to store one or more programs; When the one or more programs are executed by the at least one processor, an incremental and stock data identification method based on adaptive deep learning as described in any one of claims 1 to 7 is implemented.

10. A readable storage medium, characterized in that: An execution program is stored thereon, and when the execution program is executed, an incremental and stock data identification method based on adaptive deep learning as described in any one of claims 1 to 7 is implemented.