Intelligent electric meter service life prediction method based on improved Bi-lstm network and attention mechanism

By improving the combination of Bi-lstm network and attention mechanism, the problem of medium and high-dimensional data analysis of smart meter life prediction is solved, the prediction accuracy and flexibility are improved, the waste is reduced, the scientific replacement strategy is provided, and the model is enhanced robustness and generalization ability.

CN119046632APending Publication Date: 2024-11-29STATE GRID HUNAN ELECTRIC POWER COMPANY LIMITED +2
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410991875.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-23
Publication Date
2024-11-29

AI Technical Summary

Technical Problem

The existing smart meter lifetime prediction methods cannot effectively combine time series and spatial sequence data when facing high-dimensional data. There are problems such as overfitting, long calculation time, high training cost and poor model interpretability, resulting in serious waste of smart meters. .

Method used

Using a method based on improving the Bi-lstm network and attention mechanism, the Bi-lstm network parameters are optimized through the combination of multi-head attention mechanism and adversarial attention mechanism, and the hyperparameter tuning is performed using whale optimization algorithm to enhance the robustness of the model and Generalization ability, reduce the risk of overfitting, and improve the accuracy and flexibility of life prediction.

Benefits of technology

Improve the accuracy of smart meter life prediction and generalization ability of model, reduce waste, provide more flexible and effective management strategies, provide scientific basis for smart meter replacement, and enhance the performance and robustness of the model for complex tasks. .

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119046632A_ABST
    Figure CN119046632A_ABST
Patent Text Reader

Abstract

The invention discloses an intelligent electric meter service life prediction method based on an improved Bi-lstm network and an attention mechanism, and the method comprises the steps: integrating the historical operation data and corresponding meteorological data of an intelligent electric meter, building a database, carrying out the preprocessing of the data in the database, and obtaining a sample set, calculating the service life of the intelligent electric meter of each sample in the sample set and adding into the sample set; a life prediction model is established, the model outputs a multi-head attention mechanism as the input of a Bi-lstm network, then the Bi-lstm network is optimized, an adversarial attention mechanism is introduced into the output layer of the Bi-lstm network, and finally a life prediction result is output; and training a life prediction model by using the sample set, and inputting the historical operation data and the meteorological data corresponding to the to-be-predicted smart electric meter into the trained life prediction model to obtain the predicted life of the to-be-predicted smart electric meter. The service life prediction capability of the intelligent electric meter is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a life prediction technology for power system components, and in particular to a smart meter life prediction method based on an improved Bi-LSTM network and an attention mechanism. Background Art

[0002] With the rapid development of the power industry and the country's vigorous promotion of smart grid construction, traditional power networks can no longer support the development needs of modern society. Therefore, the emergence of smart meters is based on the thinking, exploration and improvement of the defects of the original inductive mechanical meters, and has been widely used in life and production. The demand for the use of smart meters is increasing, but at present, the replacement method of smart meters in most areas still follows the fixed replacement period model used when replacing traditional meters. This means that a large number of smart meters with normal functions will be forced to be scrapped in advance because they have reached their service life, resulting in a huge waste of smart meters.

[0003] The current research on the remaining useful life of smart meters generally adopts data-driven methods, such as random forests, support vector machines, neural networks, etc. However, in the existing research methods, when faced with high-dimensional data, the data is only analyzed in one dimension. When faced with data information with time and space dimensions, it is impossible to combine the characteristics of time series data and the characteristics of spatial series data for more detailed data analysis. In addition, only adjusting the weights based on back propagation during neural network training will cause problems such as overfitting, high computing time, and high training costs, and the model has poor interpretability. In order to improve the accuracy of model prediction and enhance flexibility and interpretability during use, new prediction methods need to be designed.

[0004] Given the complex and changeable operating environment of smart meters, this means that the model needs to be able to comprehensively analyze meter data from the time series characteristics and spatial structure characteristics and have good robustness to deal with external interference, in order to improve the model's ability to identify key factors and the accuracy of life prediction. Compared with the long short-term memory network (LSTM), the bidirectional long short-term memory network (Bi-LSTM) can simultaneously consider the past and future information in the data, so as to fully mine the data in depth and predict the output results more accurately. However, the traditional Bi-LSTM model has problems such as insufficient generalization ability, weakening of long-term information, and easy to fall into the optimal solution when used.

[0005] Therefore, it is necessary to develop a method based on the traditional Bi-LSTM model that relies on the daily operation and maintenance data of smart meters and can simultaneously pay attention to the remaining life of potential historical and future information in time and space sequence data. Summary of the invention

[0006] The technical problem to be solved by the present invention is as follows: In view of the above-mentioned problems in the prior art, a method for predicting the life of smart meters based on an improved Bi-LSTM network and an attention mechanism is provided to improve the life prediction capability of smart meters, provide a more flexible and effective management strategy and a scientific theoretical basis for the replacement of smart meters, and effectively improve the current waste situation of smart meters.

[0007] In order to solve the above technical problems, the technical solution adopted by the present invention is:

[0008] A smart meter life prediction method based on an improved Bi-LSTM network and an attention mechanism comprises the following steps:

[0009] Acquire historical operation data and corresponding meteorological data of the smart meter, integrate the historical operation data and meteorological data to establish a database, pre-process the data in the database to obtain a sample set, calculate the service life of the smart meter of each sample in the sample set and add it to the sample set;

[0010] Establish a life prediction model, which inputs raw data into a multi-head attention mechanism, uses the output of the multi-head attention mechanism as the input of a Bi-LSTM network, then optimizes the Bi-LSTM network, introduces an adversarial attention mechanism into the output layer of the Bi-LSTM network, and finally outputs a life prediction result;

[0011] The sample set is used to train a life prediction model, and the historical operation data and meteorological data corresponding to the smart meter to be predicted are input into the trained life prediction model to obtain the predicted life of the smart meter to be predicted.

[0012] Furthermore, the expression of the database is as follows:

[0013]

[0014] Among them, w n Represents a relevant feature in the database. Each feature w n are composed of a set of elements a n,1 ,a n,2 ,...,a n,k Composition, a n,k It is equivalent to any variable in the set J = {v1, v2, ...} containing all input variables. The database Q starts from the second row, and each row represents a piece of smart meter historical data. tr Indicates the real life label of the faulty meter, y1...y n Indicates the service life corresponding to the first to nth faulty meters.

[0015] Furthermore, when preprocessing the data in the database to obtain a sample set, the preprocessing step includes:

[0016] Continuizing the discrete data in the database, and then normalizing the data in the database;

[0017] The L1 regularized logistic regression model is used to perform feature screening on the normalized database, and the screened features corresponding to each smart meter are used as the sample set.

[0018] Furthermore, when the original data is input into the multi-head attention mechanism, it includes:

[0019] The input vector is divided into sub-vectors at a specified time step. Each sub-vector learns the attention information through self-attention calculation to obtain the corresponding output tensor. The output tensors of all sub-vectors are concatenated to obtain the attention-weighted vector and output it.

[0020] Furthermore, when optimizing the Bi-LSTM network, the whale optimization algorithm is used to perform hyperparameter tuning, and the coefficient vector of the whale optimization algorithm is determined. The golden sine is introduced to traverse all values ​​of the sine function, and the golden section number is introduced in the position update process to reduce the solution space.

[0021] Furthermore, when the Bi-LSTM network is optimized, the expression is as follows:

[0022]

[0023] in, is a randomly selected vector, is a random number, is the distance vector from the search agent to the target, and is the coefficient vector, when Adopt the behavior of bracketing the target variable, when Using random search behavior, r2 and r3 are random numbers, r2 determines the moving speed of the individual in the next iteration, r3 determines the position update direction of the i-th individual in the next iteration, l1 and l2 are coefficients obtained by introducing the golden section line, represents the spatial position of the i-th individual in the m-dimensional individual space, t is the current iteration number, t max is the maximum number of iterations, and a is the convergence factor.

[0024] Furthermore, when the adversarial attention mechanism is introduced in the output layer of the Bi-LSTM network, it includes: using the overall loss function as the optimization target, and the overall loss function is obtained by weighting the original task loss function and the adversarial loss function, and the expression is as follows:

[0025] L all =L mse +λL adv

[0026] Among them, L adv represents the adversarial loss function, L mse represents the mean square error loss function, and λ is the weight adjustment parameter.

[0027] Furthermore, the adversarial loss function includes real sample loss and adversarial sample loss, and the expression is as follows:

[0028] L adv =a·CE(y,y tr )+(1-a)·CE(y,y adv )

[0029] Among them, a is a hyperparameter that balances the two losses, CE is the cross entropy loss function, and y adv is an adversarial sample, y tr is the true label and y is the output of the model.

[0030] Furthermore, after using the sample set to train the life prediction model, it includes: calculating a model evaluation index. If the model evaluation index does not meet the requirements, adjusting the specified parameters of the life prediction model and then using the sample set to train the life prediction model again until the model evaluation index meets the requirements.

[0031] Furthermore, the model evaluation indicators include root mean square error, mean absolute error and determination coefficient R 2 One or more of .

[0032] Compared with the prior art, the advantages of the present invention are:

[0033] The present invention combines the attention mechanism and the whale optimization algorithm of fusion optimization in the traditional Bi-LSTM model. The whale optimization algorithm can help Bi-LSTM optimize model parameters, improve the convergence speed of the model, and prevent the model from falling into the local optimal solution. The use of the dual attention mechanism can simultaneously take into account the temporal and spatial characteristics and more comprehensively capture the important features in the sequence. The multi-head attention in the dual attention mechanism can calculate the attention weights of different heads in parallel at each time step, thereby improving the computational efficiency and training speed of the model. In addition, the introduction of the adversarial attention mechanism in the multi-head attention mechanism enhances the robustness of the model. The combination of the two attention mechanisms can reduce the risk of overfitting in the model. Such a combination can improve the performance of the model on complex tasks, making the model more robust to interference and adversarial attacks and learning more generalized feature representations, thereby enhancing the model's understanding and processing capabilities of input data. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] Figure 1 is a flow chart of an embodiment of the present invention. DETAILED DESCRIPTION

[0035] The present invention is further described below in conjunction with the accompanying drawings and specific preferred embodiments, but the protection scope of the present invention is not limited thereby.

[0036] This embodiment proposes a smart meter life prediction method based on an improved Bi-LSTM network and an attention mechanism, so that the smart meter data can focus on important information extraction and enhance the reliability of the model through a dual attention network mechanism, and use a hyperparameter-optimized Bi-LSTM network to fully and accurately capture the time information of the sequence data. The integrated use of the two improves the accuracy of the remaining life prediction of the meter and the generalization ability of the model, and provides more reliable prediction results, providing a more flexible and effective management strategy and a scientific theoretical basis for the replacement of smart meters, and effectively improving the current waste of smart meters.

[0037] like Figure 1 As shown, the method of this embodiment includes the following steps:

[0038] Step 1: Obtain meter data of a smart meter, the meter data including historical operation data of the smart meter and corresponding meteorological data, integrate the historical operation data and meteorological data to establish a database, pre-process the data in the database, and obtain a standardized sample set;

[0039] Step 2: Calculate the service life of the smart meter of each sample in the sample set and add it to the sample set;

[0040] Step 3, establish a life prediction model, the life prediction model inputs the original data into the constructed multi-head attention mechanism, uses the output of the multi-head attention mechanism as the input of the Bi-lstm network, then optimizes the Bi-lstm network, introduces the adversarial attention mechanism into the output layer of the Bi-lstm network, and finally outputs the life prediction result, which can be a predicted value or a prediction curve;

[0041] Through the above steps, the remaining life prediction model of the smart meter is obtained. The sample set is used to train the life prediction model. The historical operation data and meteorological data corresponding to the smart meter to be predicted are input into the trained life prediction model to obtain the predicted life of the smart meter to be predicted.

[0042] Each step is described in detail below.

[0043] In step 1 of this embodiment, the historical operation data specifically refers to the characteristic data recorded by the manufacturer's terminal device, including: meter status, wiring mode, version, removal fault reason, removal date, removal month, installation time, user category, voltage, current, meter removal code, metering point number, metering direction, and manufacturer;

[0044] Meteorological data specifically refers to the weather conditions and characteristic data such as ambient temperature, ambient humidity information recorded by autonomously querying public meteorological data information.

[0045] When integrating the historical operation data and the meteorological data, specifically for each smart meter, the historical operation data and the meteorological data of the same period are integrated.

[0046] In step 1, the database is established as follows:

[0047] Assume that the set of all features contained in the database is W = {w1,w2,…,w n} indicates that its w n represents a relevant feature in the database, each feature w n are composed of a set of elements a n,1 ,a n,2 ,...,a n,k Composition, let J = {v1, v2, ...} be a set containing all input variables, then a n,k Equivalent to any variable in J, the database can be expressed as:

[0048]

[0049] The database Q starts from the second row, and each row represents a piece of smart meter historical data. tr Indicates the real life label of the faulty meter, y1…y n Indicates the service life corresponding to the first to nth faulty meters.

[0050] In step 1, when preprocessing the data in the database to obtain a sample set, the preprocessing steps include:

[0051] First, the discrete data in the database is made continuous, and then the data in the database is normalized;

[0052] In view of the fact that the features in the database contain continuous and discrete types, in this embodiment, the discrete features are one-hot encoded to expand the values ​​of the discrete features to the Euclidean space, so as to realize the continuity of discrete data, and the data in the database are normalized to map the values ​​to the range of [0,1] in order to eliminate the influence of the dimension. The transformation process is expressed as follows:

[0053]

[0054] Among them, x max represents the maximum value of the sample set of smart meters, x min represents the minimum value in the sample set of smart meters, x j represents the sample of smart meters in the jth dimension in the database, and x represents the sample after standardization;

[0055] Then, the L1 regularized logistic regression model is used to perform feature screening on the normalized database, and the screened features corresponding to each smart meter are used as a new sample set.

[0056] Considering that high-dimensional features with complex data types need to be screened before being input into the model, this embodiment selects the L1 regularized logistic regression method suitable for high-dimensional data sets. It generates a sparse weight matrix by sparsely calculating the coefficients of the model, so that the model focuses on features with non-zero coefficients, thereby achieving the purpose of feature selection. It is constructed using the Kears module in Python. Its working principle is as follows:

[0057]

[0058] Among them, |ω i | represents the L1 norm of the model's weight vector, that is, the absolute value of each weight, ω i represents the weight vector and n is the number of weights.

[0059] Step 2 of this embodiment specifically includes: obtaining the installation time and the removal time (including the removal date and the removal month) in the historical operation data of each sample, and calculating the corresponding service life. The calculation method is as follows:

[0060] Y=Y1-Y2 (4)

[0061] Among them, Y1 represents the removal time of the meter, Y2 represents the installation time of the meter, and Y represents the service life of the meter.

[0062] In step 3 of this embodiment, when establishing a life prediction model, the following steps are included:

[0063] 1. Establish a dual attention mechanism, which includes a multi-head attention mechanism and an adversarial attention mechanism;

[0064] The traditional Bi-LSTM network can only obtain information through limited upper and lower data windows, lacks consideration of global information, and may cause the model to be unable to fully utilize the overall data information. The multi-head attention mechanism learns multiple attention weight matrices in parallel, and each attention head can learn different feature maps, thereby better capturing the relationship and features between data and enhancing the model's ability to represent input data.

[0065] The establishment of the adversarial attention mechanism is to introduce the idea of ​​adversarial training into the model, and to constrain the model to learn more robust feature representations by introducing adversarial loss functions or adversarial samples. This helps the model better handle noise, interference or adversarial attacks and improves the generalization ability of the model.

[0066] 2. Connect the multi-head attention mechanism with the Bi-LSTM network;

[0067] The multi-head attention mechanism and the Bi-LSTM network are connected in that when the original data received by the input layer is input into the multi-head attention layer, multiple attention-weighted vectors will be output. The output of the multi-head attention mechanism is used as the input of the BiLSTM network. After the Bi-LSTM layer receives the input sequence, it generates forward and backward hidden state sequences.

[0068] The multi-head attention mechanism works as follows:

[0069] The input database Q has time series characteristics, with t as the time step, and the input vector w t (t∈(1,n)) is divided into several sub-vectors w1,w2,...,w k , each sub-vector has learned the attention information in a different way; each execution of this attention calculation results in an output tensor O i ; Finally, concatenate the k output tensors to get the final output. The calculation method is shown in the formula:

[0070] MH(w)=Concat(head i ,…,head k )W O (5)

[0071] Among them, head i represents the i-th attention head, W O is the weight parameter of the linear projection. Each attention head is obtained by performing self-attention calculation on Q, K, and V. The calculation method is as follows:

[0072]

[0073] Among them, Q, K, and V represent the query vector (query), key vector (key), and value vector (value) of the input sequence respectively. k is the dimension size of Q and K.

[0074] Correspondingly, when the life prediction model inputs the raw data into the multi-head attention mechanism, it includes:

[0075] The input vector is divided into sub-vectors at a specified time step. Each sub-vector learns the attention information through self-attention calculation to obtain the corresponding output tensor. The output tensors of all sub-vectors are concatenated to obtain the attention-weighted vector and output it.

[0076] 3. Optimize the Bi-LSTM network;

[0077] In this embodiment, the optimization of the Bi-LSTM network is specifically to use the adaptive whale optimization algorithm fused with the golden sine to perform hyperparameter tuning. The Bi-LSTM network involves a large number of hyperparameters that need to be adjusted. The use of the whale optimization algorithm can effectively process high-dimensional nonlinear parameter spaces. However, in traditional whale optimization algorithms, the convergence factor is usually a fixed parameter. The introduction of an adaptive convergence factor can adaptively adjust the value of the convergence factor according to the current search state, thereby improving the problem of inefficient use of computing resources caused by non-automatic parameter adjustment and lack of a systematic stopping criterion in the whale optimization algorithm.

[0078] Therefore, when optimizing the Bi-LSTM network, the whale optimization algorithm is used to adjust the hyperparameters. At the same time, the coefficient vector of the whale optimization algorithm is determined. The golden sine is introduced to traverse all values ​​of the sine function, that is, to search all points on the unit circle. At the same time, the golden section number is introduced in the process of updating its position to narrow the solution space so as to scan the area that may only produce good results, which greatly improves the search speed and achieves a good balance between search and development. The specific expression is as follows:

[0079]

[0080] in, is a randomly selected vector, is a random number, is the distance vector from the search agent to the target, and is the coefficient vector, when Adopt the behavior of bracketing the target variable, when Using random search behavior, r2 and r3 are random numbers, r2 determines the moving speed of the individual in the next iteration, r3 determines the position update direction of the i-th individual in the next iteration, l1 and l2 are coefficients obtained by introducing the golden section line, represents the spatial position of the i-th individual in the m-dimensional individual space, t is the current iteration number, t max is the maximum number of iterations, and a is the convergence factor.

[0081] 4. Introduce adversarial attention mechanism in the output layer of Bi-LSTM network;

[0082] The adversarial loss function of the adversarial attention mechanism contains real sample loss and adversarial sample loss, and works as follows:

[0083] L adv =a·CE(y,y tr )+(1-a)·CE(y,y adv ) (8)

[0084] Among them, a is a hyperparameter that balances the two losses, CE is the cross entropy loss function, and y adv is an adversarial sample, y tr is the true label and y is the output of the model.

[0085] When the adversarial attention mechanism is introduced in the output layer of the Bi-LSTM network, the overall loss function is used as the optimization target. The model is trained by the back propagation algorithm. The overall loss function is obtained by weighting the original task loss function and the adversarial loss function. The expression is as follows:

[0086] L all =L mse +λL adv (9)

[0087] Among them, L adv represents the adversarial loss function, L mse represents the mean square error loss function, and λ is the weight adjustment parameter.

[0088] In step 3, outputting the life prediction result specifically outputs the final result of the remaining life prediction of the smart meter through the fully connected layer of the life prediction model. In this embodiment, after using the sample set to train the life prediction model, it includes: calculating the model evaluation index, if the model evaluation index does not meet the requirements, then adjusting the specified parameters of the life prediction model and then using the sample set to train the life prediction model again until the model evaluation index meets the requirements.

[0089] The model evaluation indicators in this embodiment use root mean square error (RMSE), mean absolute error (MAE) and determination coefficient R 2 One or more of them. To measure the prediction performance and fitting effect of the model. Among them, the smaller the MAE and RMSE, the better the prediction performance of the model. 2 The closer it is to 1, the better the model fit is. The calculation formula is as follows:

[0090]

[0091] Where n is the number of samples, y tr is the true value of the sample, is the predicted value of the i-th sample, is the mean value of the sample.

[0092] This embodiment also proposes a smart meter life prediction system based on an improved Bi-LSTM network and an attention mechanism, comprising a microprocessor and a memory connected to each other, wherein the microprocessor is programmed or configured to execute the aforementioned smart meter life prediction method based on the improved Bi-LSTM network and the attention mechanism.

[0093] This embodiment also proposes a computer-readable storage medium, in which a computer program is stored. The computer program is used to be programmed or configured by a microprocessor to execute the aforementioned smart meter life prediction method based on the improved Bi-LSTM network and attention mechanism.

[0094] In summary, the present invention proposes a smart meter life prediction method based on an improved Bi-LSTM network and an attention mechanism. The attention mechanism and the whale optimization algorithm of fusion optimization are combined in the traditional Bi-LSTM model. The whale optimization algorithm can help Bi-LSTM optimize model parameters, improve the convergence speed of the model, and prevent the model from falling into a local optimal solution. The use of a dual attention mechanism can simultaneously take into account the temporal and spatial characteristics and more comprehensively capture the important features in the sequence. The multi-head attention in the dual attention mechanism can calculate the attention weights of different heads in parallel at each time step, thereby improving the computational efficiency and training speed of the model. In addition, the introduction of the adversarial attention mechanism in the multi-head attention mechanism enhances the robustness of the model. The combination of the two attention mechanisms can reduce the risk of overfitting in the model. Such a combination can improve the performance of the model on complex tasks, making the model more robust to interference and adversarial attacks and learning more generalized feature representations, thereby enhancing the model's understanding and processing capabilities of input data.

[0095] The above is only a preferred embodiment of the present invention, and the protection scope of the present invention is not limited to the above embodiments. All technical solutions under the concept of the present invention belong to the protection scope of the present invention. It should be pointed out that for ordinary technicians in this technical field, some improvements and modifications without departing from the principle of the present invention should also be regarded as the protection scope of the present invention.

Claims

1. A smart meter life prediction method based on improved Bi-LSTM network and attention mechanism, characterized in that: The following steps are involved: Acquire historical operation data and corresponding meteorological data of the smart meter, integrate the historical operation data and meteorological data to establish a database, pre-process the data in the database to obtain a sample set, calculate the service life of the smart meter of each sample in the sample set and add it to the sample set; Establish a life prediction model, which inputs raw data into a multi-head attention mechanism, uses the output of the multi-head attention mechanism as the input of a Bi-LSTM network, then optimizes the Bi-LSTM network, introduces an adversarial attention mechanism into the output layer of the Bi-LSTM network, and finally outputs a life prediction result; The sample set is used to train a life prediction model, and the historical operation data and meteorological data corresponding to the smart meter to be predicted are input into the trained life prediction model to obtain the predicted life of the smart meter to be predicted.

2. The smart meter life prediction method based on improved Bi-LSTM network and attention mechanism according to claim 1 is characterized in that: The expression of the database is as follows: Among them, w n Represents a relevant feature in the database. Each feature w n are composed of a set of elements a n,1 ,a n,2 ,...,a n,k Composition, a n,k It is equivalent to any variable in the set J = {v1, v2, ...} containing all input variables. The database Q starts from the second row, and each row represents a piece of smart meter historical data. tr Indicates the real life label of the faulty meter, y1…y n Indicates the service life corresponding to the first to nth faulty meters.

3. The smart meter life prediction method based on improved Bi-LSTM network and attention mechanism according to claim 1 is characterized in that: When preprocessing the data in the database to obtain a sample set, the preprocessing step includes: Continuizing the discrete data in the database, and then normalizing the data in the database; The L1 regularized logistic regression model is used to perform feature screening on the normalized database, and the screened features corresponding to each smart meter are used as the sample set.

4. The smart meter life prediction method based on improved Bi-LSTM network and attention mechanism according to claim 1 is characterized in that: When raw data is fed into the multi-head attention mechanism, it includes: The input vector is divided into sub-vectors at a specified time step. Each sub-vector learns the attention information through self-attention calculation to obtain the corresponding output tensor. The output tensors of all sub-vectors are concatenated to obtain the attention-weighted vector and output it.

5. The smart meter life prediction method based on improved Bi-LSTM network and attention mechanism according to claim 1 is characterized in that: When optimizing the Bi-LSTM network, the whale optimization algorithm is used to adjust the hyperparameters. At the same time, the coefficient vector of the whale optimization algorithm is determined. The golden sine is introduced to traverse all values ​​of the sine function, and the golden section number is introduced in the position update process to reduce the solution space.

6. The method for predicting the life of a smart meter based on an improved Bi-LSTM network and an attention mechanism according to claim 5 is characterized in that: When optimizing the Bi-LSTM network, the expression is as follows: in, is a randomly selected vector, is a random number, is the distance vector from the search agent to the target, and is the coefficient vector, when Adopt the behavior of bracketing the target variable, when Using random search behavior, r2 and r3 are random numbers, r2 determines the moving speed of the individual in the next iteration, r3 determines the position update direction of the i-th individual in the next iteration, l1 and l2 are coefficients obtained by introducing the golden section line, represents the spatial position of the i-th individual in the m-dimensional individual space, t is the current iteration number, t max is the maximum number of iterations, and a is the convergence factor.

7. The method for predicting the life of a smart meter based on an improved Bi-LSTM network and an attention mechanism according to claim 1 is characterized in that: When the adversarial attention mechanism is introduced in the output layer of the Bi-LSTM network, it includes: using the overall loss function as the optimization target, and the overall loss function is obtained by weighting the original task loss function and the adversarial loss function, and the expression is as follows: THE all =L mse +λL adv Among them, L adv represents the adversarial loss function, L mse represents the mean square error loss function, and λ is the weight adjustment parameter.

8. The method for predicting the life of a smart meter based on an improved Bi-LSTM network and an attention mechanism according to claim 7 is characterized in that: The adversarial loss function includes real sample loss and adversarial sample loss, and the expression is as follows: L adv =a·CE(y,y tr )+(1-a)·CE(y,y adv ) Among them, a is a hyperparameter that balances the two losses, CE is the cross entropy loss function, and y adv is an adversarial sample, y tr is the true label and y is the output of the model.

9. The method for predicting the life of a smart meter based on an improved Bi-LSTM network and an attention mechanism according to claim 1 is characterized in that: After using the sample set to train the life prediction model, it includes: calculating a model evaluation index. If the model evaluation index does not meet the requirements, adjusting the specified parameters of the life prediction model and then using the sample set to train the life prediction model again until the model evaluation index meets the requirements.

10. The smart meter life prediction method based on improved Bi-LSTM network and attention mechanism according to claim 1 is characterized in that: The model evaluation indicators include root mean square error, mean absolute error and determination coefficient R 2 One or more of .

Citation Information

Cited By

  • BiLSTM and GPR fused electronic power component residual life prediction method and system

    CN122021326A