Method for optimizing long-short term memory network model based on firefly algorithm
The firefly algorithm optimizes the hyperparameters and feature selection of long and short memory network models, and solves the problems of low accuracy and difficulty in the remaining life prediction of electric ball valves and achieves higher prediction accuracy and reliability.
Patent Information
- Application Number
- CN202411786483.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-06
- Publication Date
- 2025-03-28
AI Technical Summary
The prior art has problems such as low prediction accuracy, difficulty in optimizing hyperparameters, and insufficient use of multi-sensor data in the prediction of the remaining life of the electric ball valve.
By combining the firefly algorithm to optimize the hyperparameters and feature selection of long and short memory network models, the prediction accuracy and robustness of the model are improved.
It significantly improves the accuracy and reliability of the remaining life prediction of electric ball valves, solves the problems of low prediction accuracy and difficulty in hyperparameter optimization, and makes full use of multi-sensor data.
Smart Images

Figure CN119720024A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of electric ball valve remaining life prediction, and in particular to an electric valve life prediction method based on a firefly algorithm to optimize a long short-term memory network model. Background Art
[0002] As a key component in industrial control systems, the health status of electric valves is directly related to the performance and safety of the entire system. Especially in high-risk environments such as chemical plants, electric valves are responsible for controlling the flow of various chemical substances. Their stability and reliability play an irreplaceable role in ensuring production safety and maintaining product quality. However, with long-term use, electric valves will face a series of aging problems, such as wear, corrosion, jamming and leakage. Specifically, the valve core and valve seat of the electric valve will gradually wear during frequent switching, which will cause the sealing performance of the valve to decrease, thereby affecting its control accuracy; in an environment containing corrosive chemicals, the material of the electric valve may be eroded, causing the material performance to deteriorate and shortening the service life of the valve; due to the wear of internal mechanical parts or the intrusion of external foreign matter, the electric ball valve may become jammed, hindering its normal opening and closing action; wear and corrosion can weaken the sealing ability of the electric ball valve and increase the risk of leakage, which not only wastes resources, but also may pollute the environment. These problems will not only affect the performance of the valve, but also may cause serious safety accidents.
[0003] In response to the above problems, traditional life prediction methods, such as statistical models and simple machine learning algorithms (such as linear regression and support vector machines), perform poorly when dealing with nonlinear time series data, because it is difficult for these methods to accurately capture the complex changes in the data, thereby reducing the accuracy of the prediction. In addition, when processing data from multiple sensors, these methods often fail to fully utilize the time series characteristics of the data, further limiting the prediction effect. In the LSTM model (Long Short Term Memory Network Model) life prediction method, the prediction accuracy of the LSTM model is still limited by the design and training process of the model; traditional hyperparameter optimization methods (such as grid search and random search) are inefficient and easily fall into local optimality; they cannot effectively integrate data from multiple sensors and fully utilize their time series characteristics.
[0004] Application Contents
[0005] Therefore, in order to overcome the shortcomings of the above-mentioned prior art, this application proposes a method for predicting the remaining life of an electric ball valve based on the firefly algorithm to optimize the long-short memory network model. The present invention aims to solve the problems of low accuracy in predicting the remaining life of an electric ball valve, difficulty in optimizing hyperparameters, and insufficient use of multi-sensor data in the prior art. By combining the firefly algorithm (FA) to optimize the hyperparameters of the long-short memory network model, the prediction accuracy and robustness of the model are improved.
[0006] In order to achieve the above objectives, this application provides the following technical solutions:
[0007] A method for optimizing a long short-term memory network model based on a firefly algorithm, wherein the long short-term memory network model is used to predict the remaining life of an electric ball valve, comprising the following steps:
[0008] S1, collecting multiple working status data of the electric ball valve, wherein the multiple working status data at least include characteristic names such as working current, temperature, pressure, valve position, vibration frequency and corresponding values;
[0009] S2, optimizing the features of the plurality of working status data by using a firefly algorithm, and outputting an optimal feature combination;
[0010] S3, selecting the corresponding multiple working state data according to the optimal feature combination, bringing the values of the multiple working state data into the long short-term memory network model, and optimizing the hyperparameters of the long short-term memory network model by the firefly algorithm, and outputting the optimal hyperparameter combination;
[0011] S4, assigning values to the long short-term memory network model according to the optimal hyperparameter combination, selecting the corresponding multiple working status data according to the optimal feature combination, bringing the values of the multiple working status data into the long short-term memory network model, and optimizing the long short-term memory network model through the firefly algorithm to obtain the optimal long short-term memory network model.
[0012] Specifically, the firefly algorithm is used to optimize the characteristics of the plurality of working status data, including:
[0013] S21, selecting any several working status data from the plurality of working status data to form a plurality of feature subsets, each first firefly corresponds to one of the feature subsets, and initializing the position of the first firefly;
[0014] S22, dividing each of the feature subsets into a first training set and a first validation set, using the first training set to train a linear regression model, and using the first validation set to calculate a validation value of the linear regression model, evaluating the performance of the trained linear regression model on the first validation set, and using the validation value of the linear regression model as the brightness value of the first firefly, wherein the validation value is at least one of a sum variance, a mean square error, a standard deviation, and a judgment coefficient;
[0015] S23, define the positions of the two first fireflies as vector x i and x j , the vector x i and x jThe attraction between Among them, β0 is the initial attraction, which is set to 1.0; is the Hamming distance, which is used to measure the difference between the two first fireflies, x ik 、x jk are the vector x i 、x j The value at the kth position; γ ij is the light absorption coefficient,
[0016] w ij is a weighting factor;
[0017] S24, the first firefly with a lower brightness value moves toward the first firefly with a higher brightness value, and the moving formula is: in, are the vector x i 、x j At the position of the tth iteration; α is a random factor, set to 0.1; rand is a random number between [0,1]; when updating the position of the first firefly after moving, round the result to a binary vector;
[0018] S25, setting the first iteration number, calculating the brightness of each of the first fireflies in each iteration, and recording the position of the first firefly with the lowest brightness in each iteration as the current optimal solution;
[0019] S26, outputting the position of the first firefly with the lowest brightness after the first number of iterations as the optimal feature combination.
[0020] Specifically, the corresponding multiple working state data are selected according to the optimal feature combination, the values of the multiple working state data are brought into the long short-term memory network model, and the hyperparameters of the long short-term memory network model are optimized by the firefly algorithm to output the optimal hyperparameter combination, including:
[0021] S31, defining a reasonable range of the hyperparameter combination as a search space;
[0022] S32, each second firefly represents a set of the hyperparameter combinations, and a group of second fireflies are randomly initialized;
[0023] S33, according to the multiple working state data in the optimal feature combination, a second training set and a second validation set are constructed using the corresponding values in the multiple working state data, the second training set is used to train the long short-term memory network model, and the second validation set is used to calculate the validation value of the long short-term memory network model, the performance of the trained long short-term memory network model is evaluated on the second validation set, and the validation value on the long short-term memory network model is used as the brightness value of the second firefly, and the validation value is at least one of the sum variance, mean square error, standard deviation and judgment coefficient;
[0024] S34, define the positions of the two second fireflies as vectors x i ′、x j ′, the vector x i ′、x j The attraction between ′ is Among them, β′0 is the initial attraction, which is set to 1.0; is the Euclidean distance, which is used to measure the difference between the two fireflies mentioned in the second paragraph, x ik ′、x jk ′ are vectors x i ′、x j ′ is the value of the kth position; γ′ ij is the light absorption coefficient,
[0025] w′ ij is a weighting factor;
[0026] S35, the second firefly with a lower brightness value moves toward the second firefly with a higher brightness value, and the moving formula is as follows: i ' t+1 =x i ' t +β′ ij (x j ' t -x i ' t )+α′(rand-0.5); where x j ' t 、x i ' t are the vector x i ′、x j ′ is the position of the tth iteration; α′ is a random factor, set to 0.1; rand is a random number between [0,1];
[0027] S36, setting the number of second iteration optimization times, calculating the brightness of each second firefly in each iteration, and recording the position of the second firefly with the lowest brightness in each iteration as the current optimal solution;
[0028] S37, outputting the position of the second firefly with the lowest brightness after the set number of iterative optimizations as the optimal hyperparameter combination.
[0029] Specifically, assigning values to the long short-term memory network model according to the optimal hyperparameter combination, selecting the corresponding multiple working state data according to the optimal feature combination, bringing the values of the multiple working state data into the long short-term memory network model, and optimizing the long short-term memory network model by the firefly algorithm to obtain the optimal long short-term memory network model, including:
[0030] S41, constructing a third training set, a third validation set and a third test set according to the plurality of working status data in the optimal feature combination using the corresponding values in the plurality of working status data;
[0031] S42, assigning values to the long short-term memory network model using the optimal hyperparameter combination;
[0032] S43, using the third training set to train the long short-term memory network model, capturing the continuous dependency in the time series, and predicting the remaining life of the electric ball valve, to generate the optimal long short-term memory network model;
[0033] S44, during the training process, calculating a verification value of the third verification set on the long short-term memory network model, wherein the verification value is at least one of a sum variance, a mean square error, a standard deviation, and a judgment coefficient, and using the third verification set to evaluate the performance of the long short-term memory network model;
[0034] S45, after the training is completed, calculating the verification value of the third test set on the long short-term memory network model, the verification value is at least one of the sum variance, mean square error, standard deviation and judgment coefficient, and using the third test set to evaluate the final performance of the long short-term memory network model;
[0035] S46, saving the optimal long short-term memory network model after the training.
[0036] Specifically, the plurality of working status data are preprocessed, and the preprocessing includes at least one of missing value filling, abnormal value monitoring and processing, and normalization processing.
[0037] Specifically, the optimal long-short memory network model is used to predict the remaining life of the electric ball valve, and the corresponding value in the optimal feature combination monitored in real time is input into the optimal long-short memory network model, and the real-time predicted remaining life of the electric ball valve is output, including:
[0038] S51, collecting the numerical value corresponding to the optimal feature combination monitored in real time, and preprocessing the numerical value data corresponding to the optimal feature combination monitored in real time;
[0039] S52, inputting the corresponding value in the optimal feature combination monitored in real time into the optimal long short-term memory network model;
[0040] S53, outputting the real-time predicted remaining life of the electric ball valve according to the continuous dependency in the time series in the optimal long-short memory network model based on the corresponding numerical value in the optimal feature combination monitored in real time.
[0041] Corresponding to the above method, the present application also provides a device for optimizing a long short-term memory network model based on a firefly algorithm, the device comprising:
[0042] A data acquisition module, used for collecting multiple working status data of the electric ball valve, wherein the multiple working status data at least include numerical values corresponding to characteristic names such as working current, temperature, pressure, valve position, and vibration frequency;
[0043] A feature optimization module, used for performing feature optimization on the plurality of working state data that have undergone the preprocessing by using the firefly algorithm, and outputting an optimal feature combination;
[0044] A hyperparameter optimization module, used for selecting the corresponding multiple working state data according to the optimal feature combination, bringing the values of the multiple working state data into the long short-term memory network model, and optimizing the hyperparameters of the long short-term memory network model by the firefly algorithm, and outputting the optimal hyperparameter combination;
[0045] The long short-term memory network model optimization module is used to assign values to the long short-term memory network model according to the optimal hyperparameter combination, select the corresponding multiple working status data according to the optimal feature combination, bring the values of the multiple working status data into the long short-term memory network model, and optimize the long short-term memory network model through the firefly algorithm to obtain the optimal long short-term memory network model.
[0046] Corresponding to the above method, the present application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.
[0047] Corresponding to the above method, the present application also provides a computer-readable storage medium on which a computer program is stored, and the computer program implements the steps of the above method when executed by a processor.
[0048] Compared with the prior art, the advantages of the present application are: first, the feature selection of the working state of the electric ball valve is optimized by the firefly algorithm, and the features that best reflect the working state of the electric ball valve are selected, thereby reducing redundant information and significantly improving the prediction accuracy of the model; the hyperparameters of the long and short-term memory network model are optimized by the firefly algorithm, and the optimal hyperparameter combination is found, which significantly improves the prediction performance of the model; and multiple working state data of the electric valve are used, and the information of multiple working state data of the electric valve is integrated to provide more comprehensive data support, further improving the prediction accuracy and reliability of the model; the firefly algorithm optimizes the long and short-term memory network model so that the long and short-term memory network model can more accurately reflect the working condition of the electric valve, providing a scientific basis for the prediction of the remaining life of the electric ball valve. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0050] Figure 1 It is a flowchart of the steps of a method for optimizing a long short-term memory network model based on a firefly algorithm in an embodiment of the present application;
[0051] Figure 2 is a flowchart of the steps of optimizing the features of the plurality of working status data by using the firefly algorithm in an embodiment of the present application;
[0052] Figure 3 It is a schematic diagram of the internal structure of a computer device in an embodiment of the present application. DETAILED DESCRIPTION
[0053] The embodiments of the present application are described in detail below with reference to the accompanying drawings.
[0054] The following describes the implementation methods of the present application through specific examples, and those skilled in the art can easily understand other advantages and effects of the present application from the contents disclosed in this specification. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The present application can also be implemented or applied through other different specific implementation methods, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present application. It should be noted that, in the absence of conflict, the following embodiments and the features in the embodiments can be combined with each other. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work belong to the scope of protection of the present application.
[0055] It should be noted that various aspects of the embodiments within the scope of protection of the present application are described below. It should be apparent that the aspects described herein can be embodied in a wide variety of forms, and any specific structure and / or function described herein is merely illustrative. Based on the present application, it should be understood by those skilled in the art that an aspect described herein can be implemented independently of any other aspect, and two or more of these aspects can be combined in various ways. For example, any number and aspect described herein can be used to implement the device and / or practice the method. In addition, other structures and / or functionalities other than one or more of the aspects described herein can be used to implement this device and / or practice this method.
[0056] It should also be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present application. The drawings only show components related to the present application rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.
[0057] Additionally, in the following description, specific details are provided to facilitate a thorough understanding of the examples. However, it will be understood by those skilled in the art that the aspects described may be practiced without these specific details.
[0058] The embodiment of the present application provides a method for optimizing a long short-term memory network model based on a firefly algorithm. The long short-term memory network model is used to predict the remaining life of an electric ball valve. Figure 1 As shown, the following steps are included:
[0059] S1, collect multiple working status data of the electric ball valve, and the collected multiple working status data at least include the values corresponding to the working current, temperature, pressure, valve position, and vibration frequency. The specific method of data collection can be to install multiple sensors at the key parts of the electric ball valve, and the multiple sensors include temperature sensors, pressure sensors, current sensors, vibration sensors, etc. The sensors are mainly configured at the key parts of the electric ball valve, such as the valve core, valve seat, and motor. Temperature sensors, pressure sensors, current sensors, and vibration sensors are installed at the key parts of the electric ball valve, such as the valve core, valve seat, and motor, to monitor the working status of the electric ball valve in real time, and regularly collect the data of the working current, temperature, pressure, valve position, and vibration frequency of the electric ball valve, that is, the corresponding values. In this way, through the collection of multi-sensor data, the working status of the electric ball valve is fully reflected, and multi-sensor data is provided for subsequent predictions, providing a rich data basis.
[0060] S2, based on the multiple working state data collected in S1, the firefly algorithm is used to optimize the features of the multiple working state data, and the optimal feature combination is output. The optimal feature combination is to find the feature combination that has the greatest influence on life prediction among the multiple working state data. The firefly algorithm is used to combine any number of feature selections for comparison, position movement, and brightness calculation, and finally select the feature combination that best reflects the working state of the electric ball valve to reduce redundant information.
[0061] S3, select the corresponding multiple working state data according to the optimal feature combination, and bring the corresponding values of the multiple working state data collected based on S1 into the long short-term memory network model. The long short-term memory network model is a recursive neural network specially designed to process time series data, which can effectively capture the long-term dependencies in the data. In this embodiment, it is used to predict the remaining service life of equipment such as electric ball valves. And optimize the hyperparameters of the long short-term memory network model through the firefly algorithm, select any number of working state data from the working state data corresponding to the optimal feature combination through the firefly algorithm for comparison, as well as position movement and brightness calculation, and finally output the optimal hyperparameter combination;
[0062] S4, assign values to the long short-term memory network model according to the optimal hyperparameter combination to avoid overfitting of the long short-term memory network model and enhance the prediction performance of the long short-term memory network model. Select the corresponding multiple working state data according to the optimal feature combination, bring the values of the multiple working state data into the long short-term memory network model, and optimize the long short-term memory network model through the firefly algorithm. Select any number of working state data from the working state data corresponding to the optimal feature combination through the firefly algorithm to perform data iteration operation on the long short-term memory network model, and finally optimize to obtain the optimal long short-term memory network model.
[0063] This embodiment first optimizes the feature selection of the working state of the electric ball valve through the firefly algorithm, selects the features that best reflect the working state of the electric ball valve, reduces redundant information, and significantly improves the prediction accuracy of the model; it also optimizes the hyperparameters of the long short-term memory network model through the firefly algorithm, finds the best hyperparameter combination, and significantly improves the prediction performance of the model; and adopts multiple working state data of the electric valve, integrates the information of multiple working state data of the electric valve, provides more comprehensive data support, and further improves the prediction accuracy and reliability of the model; the firefly algorithm optimizes the long short-term memory network model so that the long short-term memory network model can more accurately reflect the working condition of the electric valve, and provides a scientific basis for the prediction of the remaining life of the electric ball valve.
[0064] In one embodiment, the firefly algorithm is used to perform feature optimization on the plurality of working status data, such as Figure 2As shown, the specific steps include:
[0065] S21, each first firefly corresponds to a feature subset, the feature subset is a combination selected from a plurality of working status data, and a plurality of feature subsets are arbitrarily selected from the plurality of working status data, that is, a combination selected from the following at least five features: working current, temperature, pressure, valve position, vibration frequency.
[0066] A feature combination refers to selecting a subset from a plurality of working state data for training a linear regression model or a long short-term memory network model, and each feature combination may include any number of features. In one embodiment, a feature combination includes temperature and vibration frequency. In one embodiment, a feature combination includes temperature, pressure, and vibration frequency. In one embodiment, a feature combination includes only vibration frequency.
[0067] Initialize the positions of a group of first fireflies. The initial position of each first firefly is randomly generated. Each position is a binary vector indicating which working state data is selected (1 indicates selected, 0 indicates unselected). In one embodiment, five working state data are defined: working current, temperature, pressure, valve position, and vibration frequency. The position of a first firefly can be expressed as [1, 0, 1, 0, 1], which indicates that the three features of working current, pressure, and vibration frequency are selected.
[0068] S22, dividing the feature subset into a first training set and a first validation set. In one embodiment, there are 1000 feature subsets, of which 700 feature subsets are divided into a first training set for training a linear regression model, and 300 feature subsets are divided into a second training set for calculating a validation value of the linear regression model to verify the performance of the linear regression model, wherein the validation value is at least one of a sum of squares, a mean square error, a standard deviation, and a judgment coefficient.
[0069] The linear regression model is trained using the first training set, and for each feature combination in the first training set, a linear regression model is used for training. In one embodiment, the model is trained using the feature combination [1,1,1,1,1], that is, the working current, temperature, pressure, valve position, and vibration frequency are used. In one embodiment, the model is trained using the feature combination [1,0,1,0,1], that is, the working current, pressure, and vibration frequency are used. In one embodiment, the model is trained using the feature combination [0,1,1,1,0], that is, the temperature, pressure, and valve position are used. In one embodiment, the model is trained using the feature combination [1,1,0,0,1], that is, the working current, temperature, and vibration frequency are used.
[0070] The first validation set is used to calculate the validation value of the linear regression model, and the performance of the trained linear regression model is evaluated on the first validation set.
[0071] The sum and variance is the sum of the squares of the errors between the fitted data and the original data. The closer the SSE (sum and variance) is to 0, the better the model selection and fitting are, and the more successful the data prediction is. The mean square error is the mean of the sum of the squares of the errors between the predicted data and the original data, that is, SSE / n. The standard deviation is also called the fitted standard deviation of the regression coefficient, which is the square root of MSE. The coefficient of determination, which means the variance score of the explained regression model, has a value range of [0,1]. The closer it is to 1, the more the independent variable can explain the variance change of the dependent variable. It is hoped that the larger the value, the better. The smaller the value, the worse the effect.
[0072] The verification value of the linear regression model is used as the brightness value of the first firefly; in one embodiment, the mean square error of the linear regression model of the first firefly is 0.05, and the brightness value of the first firefly is 0.05. In one embodiment, the mean square error of the linear regression model of the first firefly is 0.07, and the brightness value of the first firefly is 0.07. In one embodiment, in one embodiment, the mean square error of the linear regression model of the first firefly is 0.06, and the brightness value of the first firefly is 0.06.
[0073] S23, define the positions of the two first fireflies as vector x i and x j , define the attraction between the two first fireflies as vector x i and x j The attraction between them is given by
[0074] Among them, β0 is the initial attraction, which is set to 1.0;
[0075] is the Hamming distance, which is used to measure the difference between two feature combinations, specifically the number of different digits between the two feature combinations. i and x j , are binary vectors of length n, n represents the length of the feature combination vector, that is, the number of features, and the Hamming distance r ij The calculation formula is: Among them, x ik 、x jkare respectively the values of the vector at the kth position; in one embodiment, vector x1 = [1,0,1,0,1], indicating that the selected features are working current, pressure, and vibration frequency, and the unselected features are temperature and valve position. Vector x2 = [0,1,1,1,0], indicating that the selected features are temperature, pressure, and valve position, and the unselected features are working current and vibration frequency. The number of different bits between vector x1 = [1,0,1,0,1] and vector x2 = [0,1,1,1,0] is: the 1st, 2nd, 4th and 5th bit, a total of 4 different bits. The Hamming distance r between vector x1 = [1,0,1,0,1] and vector x2 = [0,1,1,1,0] 12 =4.
[0076] γ ij is the light absorption coefficient, which controls the decay rate of attraction with distance and dynamically adjusts γ according to the difference between the vectors. ij , γ ij The calculation formula for the light absorption coefficient is Among them, w ij is a weight factor that can be adjusted according to the specific application scenario. The importance and relevance of the feature combination can be considered. The Hamming distance r ij To dynamically adjust γ ij , so the greater the distance, the smaller the light absorption coefficient, and the slower the attraction decays.
[0077] S24, the first firefly with a lower brightness value moves toward the first firefly with a higher brightness value. The moving formula is: in, are the vector x i 、x j The position at the tth iteration; α is a random factor, set to 0.1; rand is a random number between [0,1]; when updating the position of the first firefly after moving, round the result to a binary vector to ensure that each position is still a binary vector.
[0078] S25, setting a first number of iterations. In one embodiment, the first number of iterations is set to 100 times.
[0079] In each iteration, the brightness of each of the first fireflies is calculated, that is, the linear regression model trained with the feature combination on the validation set.
[0080] The position of the first firefly with the lowest brightness in each iteration is recorded as the current optimal solution, and the optimal solution is updated in real time.
[0081] S26, output the position of the first firefly with the lowest brightness after the first number of iterations as the optimal feature combination. In one embodiment, after 100 iterations, the brightness value of firefly x1 is always the lowest, and finally output [1, 0, 1, 0, 1] as the optimal feature combination, that is, the working current, pressure, and vibration frequency form a combination.
[0082] In one embodiment, according to the multiple working state data in the optimal feature combination, the corresponding values in the multiple working state data are brought into the long short-term memory network model, and the hyperparameters of the long short-term memory network model are optimized by the firefly algorithm to output the optimal hyperparameter combination, which specifically includes the following steps:
[0083] S31, define a reasonable range of the hyperparameter combination as the search space. Based on experience and preliminary experiments, define a reasonable range for each hyperparameter: number of hidden layer units: [32, 128]; learning rate: [0.001, 0.1]; batch size: [16, 64]; time step: [10, 50].
[0084] S32, each second firefly represents a set of the hyperparameter combinations, and a group of second fireflies is randomly initialized; the initial position of each second firefly is randomly generated, and each position is a real number vector representing the value of the hyperparameter. In one embodiment, a second firefly represents a hyperparameter combination of 64 hidden layer units, a learning rate of 0.001, and a batch size of 32.
[0085] S33, using the collected working state data of the electric ball valve and the optimal feature combination to construct a second training set and a second validation set, defining the brightness of the firefly as its fitness value, that is, the validation value of the long short-term memory network model trained with the hyperparameter combination on the validation set, and the validation value is at least one of the sum variance, mean square error, standard deviation and judgment coefficient. The lower the brightness, the smaller the prediction error and the better the model performance.
[0086] The corresponding features are selected according to the optimal feature combination, that is, the optimal feature combination is loaded from the feature optimization of the working state data of the driven ball valve.
[0087] According to the current hyperparameter combination of the second firefly, a long-short memory network model for predicting the remaining life of the electric ball valve is assigned. In one embodiment, the hyperparameter combination [64, 0.001, 32, 20] is used to assign a long-short memory network model for predicting the remaining life of the electric ball valve; in one embodiment, the hyperparameter combination [32, 0.01, 16, 10] is used to assign a long-short memory network model for predicting the remaining life of the electric ball valve; in one embodiment, the hyperparameter combination [128, 0.005, 64, 30] is used to assign a long-short memory network model for predicting the remaining life of the electric ball valve.
[0088] The LSTM model is trained using the selected features in the second training set. The second training set is selected from the corresponding values in the plurality of working state data in the optimal feature combination.
[0089] The second validation set is used to evaluate the performance of the trained long short-term memory network model and calculate the validation value. The validation set is selected from the corresponding values of the plurality of working state data in the optimal feature combination.
[0090] The verification value on the long short-term memory network model is used as the brightness value of the second firefly; and the brightness value of the second firefly is recorded.
[0091] S34, define the positions of the two second fireflies as vectors x i ′、x j ′, the attraction between the two second fireflies is vector x i ′、x j The attractive force between them is given by
[0092] Among them, β′0 is the initial attraction, which is set to 1.0;
[0093] d ij is the Euclidean distance, which is the square root of the sum of the squares of the differences in each dimension between two real vectors, and is used to measure the difference between two hyperparameter combinations. i ′、x j ′, are all real number vectors of length m, defining four hyperparameters with m=4: number of hidden layer units, learning rate, batch size, and time step.
[0094] The calculation formula of Euclidean distance is: Used to measure the difference between two fireflies. ik ′、x jk ′ are vectors x i ′、x j' is the value of the kth position. In one embodiment, hyperparameter combination 1: x1' = [64, 0.001, 32, 20], hyperparameter combination 2: x2' = [32, 0.01, 16, 10]; calculate the Euclidean distance d between fireflies x1' and x2' 12 , that is, vector x i ′、x j The Euclidean distance d between 12 :
[0095]
[0096] γ′ ij is the light absorption coefficient, which controls the decay rate of attraction with distance, and dynamically adjusts γ′ according to the difference between the hyperparameter combinations. ij γ′ ij The calculation formula for the light absorption coefficient is: w′ ij is a weight factor that is adjusted according to the specific application scenario. The importance and relevance of the hyperparameter combination can be considered. ij To dynamically adjust γ′ ij , so the greater the distance, the smaller the light absorption coefficient, and the slower the attraction decays.
[0097] S35, the second firefly with a lower brightness value moves toward the second firefly with a higher brightness value, and the movement formula is as follows: i ' t+1 =x i ' t +β′ ij (x j ' t -x i ' t )+α′(rand-0.5); where x j ' t 、x j ' t are the vector x i ′、x j ′ is the position of the tth iteration; α′ is a random factor, set to 0.1; rand is a random number between [0,1];
[0098] S36, setting the second iteration optimization times. In one embodiment, the second iteration optimization times is set to 100 times.
[0099] In each iteration, the brightness of each second firefly is calculated, which is the verification value of the long short-term memory network model trained with this hyperparameter combination on the verification set.
[0100] Record the position of the second firefly with the lowest brightness in each iteration as the current optimal solution;
[0101] S37, output the position of the second firefly with the lowest brightness after the set number of iterative optimizations as the optimal hyperparameter combination. In one embodiment, the second iterative optimization number is 100. After 100 iterations, the brightness value of the second firefly x1′ is always the lowest, and finally output [64, 0.001, 32, 20] as the optimal feature combination, that is, the number of hidden layer units: 64, the learning rate: 0.001, the batch size: 32, and the time step: 20.
[0102] In one embodiment, the long short-term memory network model is trained based on the optimal hyperparameter combination to capture the continuous dependency in the time series, and the remaining life of the electric ball valve is obtained to generate the optimal long short-term memory network model. The specific steps include:
[0103] S41, according to the multiple working status data in the optimal feature combination, a third training set, a third validation set and a third test set are constructed using the corresponding values in the multiple working status data. The third training set is used to train the long short-term memory network model, the third validation set is used to evaluate the performance of the model during the training process to prevent overfitting; the third test set is used to finally evaluate the generalization ability of the model. In one embodiment, the data sets corresponding to the values in the multiple working status data are divided into a third training set accounting for 70%, a third validation set accounting for 15%, and a third test set accounting for 15%.
[0104] S42, use the optimal hyperparameter combination to assign values to the long short-term memory network model; in one embodiment, the optimal hyperparameter combination is [64, 0.001, 32, 20], and the assignment is as follows: number of hidden layer units: 64; learning rate: 0.001; batch size: 32; time step: 20.
[0105] S43, use the third training set to train the long short memory network model, and capture the continuous dependency in the time series according to the actual corresponding electric ball valve remaining life. Specifically, input the data in the third training set into the long short memory network model; calculate the output of the long short memory network model; calculate the verification value between the output of the long short memory network model and the true label, and the verification value is at least one of the sum variance, mean square error, standard deviation and judgment coefficient; update the long short memory network model parameters according to the gradient of the loss function. Repeat the above steps: until the predetermined number of training rounds is reached or a certain stopping condition is met (for example, the performance on the verification set is no longer improved). Generate the optimal long short memory network model;
[0106] S44, during the training process, calculating the verification value of the third verification set on the long short-term memory network model, the verification value being at least one of the sum and variance, the mean square error, the standard deviation and the judgment coefficient, and using the third verification set to evaluate the performance of the long short-term memory network model;
[0107] S45, after the training is completed, calculating the verification value of the third test set on the long short-term memory network model, the verification value is at least one of the sum variance, mean square error, standard deviation and judgment coefficient, and using the third test set to evaluate the final performance of the long short-term memory network model;
[0108] S46, saving the trained optimal long short-term memory network model, and saving the trained LSTM model to a file for subsequent use.
[0109] In one embodiment, if Figure 1 As shown in step S5, the optimal long short-term memory network model is used to predict the remaining life of the electric ball valve, the corresponding value in the optimal feature combination monitored in real time is input into the optimal long short-term memory network model, and the real-time predicted remaining life of the electric ball valve is output, and the steps are as follows:
[0110] S51, according to the above-mentioned optimal feature combination, during the monitoring process, collect the corresponding values in the optimal feature combination monitored in real time, and pre-process the corresponding values in the optimal feature combination monitored in real time to ensure the quality and consistency of the data. The pre-processing steps include: using interpolation to fill missing values, using the Z-score method to detect and process outliers, and normalizing all data to the range of [0,1] to ensure the consistency and comparability of the data.
[0111] S52, input the corresponding numerical value in the optimal feature combination monitored in real time into the optimal long short-term memory network model; convert the data collected in real time into the format required by the optimal long short-term memory network model. Usually, the long short-term memory network model needs to input a time series data, so the real-time data needs to be organized into the form of a time series. If the optimal long short-term memory network model requires a fixed-length time series input, the real-time data can be divided into windows of fixed length. For example, if the time step is 20, then the data of every 20 time points constitute an input sequence.
[0112] S53, the corresponding numerical value in the optimal feature combination monitored in real time outputs the real-time predicted remaining life of the electric ball valve according to the continuous dependency in the time series in the optimal long and short memory network model. After receiving the input data, the optimal long and short memory network model performs forward propagation calculation, and the specific steps are as follows: the input data is passed to the input layer of the optimal long and short memory network model. The optimal long and short memory network model captures the long-term dependency in the time series data through the calculation of the hidden layer. Each unit in the hidden layer is updated according to the input data and the previous hidden state, and the information is gradually transmitted and processed. Finally, the output layer of the optimal long and short memory network model generates a predicted value, which represents the remaining service life of the electric ball valve. The output layer is usually a fully connected layer, which generates the final prediction result according to the state of the hidden layer. The predicted value generated by the optimal long and short memory network model can be directly output or further processed. In one embodiment. The predicted value is converted into an easy-to-understand form, such as "the electric ball valve is expected to have an service life of X months".
[0113] In one embodiment, if Figure 1 As shown in step S6, the optimal long short-term memory network model also includes the function of fault mode recognition, which can output specific fault modes, such as "there is a slight jamming phenomenon". The indicators are:
[0114] Operating current: Abnormally high operating current may indicate that the electric ball valve's motor is overloaded or that the internal mechanical parts are worn.
[0115] Pressure: Abnormally high pressure may indicate a blockage or a poor seal inside the valve.
[0116] Vibration frequency: Abnormally high vibration frequency may indicate loose or worn internal mechanical parts.
[0117] Temperature: Abnormally high temperatures may indicate that the electric ball valve is overheating, either due to overloading or poor heat dissipation.
[0118] In one embodiment, in order to further improve the reliability of the prediction, an integrated learning method can be used, that is, training multiple optimal long short-term memory network models, and finally taking the average of the prediction results of all the optimal long short-term memory network models as the final prediction value.
[0119] In one embodiment, different failure modes identified by the optimal long short-term memory network model provide more specific maintenance suggestions to help users take timely and effective measures. The threshold is preset manually. According to the prediction results, if the remaining life is lower than the preset threshold (such as 30 days), the system will automatically trigger an alarm and provide specific maintenance suggestions, such as valve replacement, lubrication, cleaning, etc. Specific maintenance suggestions are provided based on the prediction results to help users take timely and effective measures. In one embodiment, if the prediction results show that the electric ball valve has a risk of jamming, the system will recommend lubrication; if the prediction results show that there is a risk of leakage, the system will recommend replacing the seal.
[0120] In one embodiment, the collected multiple working status data are preprocessed, and the preprocessing includes at least one of missing value filling, outlier monitoring and processing, and normalization processing. Among them, missing value filling is to fill the missing values using interpolation. Outlier detection and processing is to detect and process outliers using the Z-score method (standard score method). The Z-score method is a statistical calculation method used to measure the distance between a single sample point and the overall mean. Z-Score is applied to the standardization of data, and its purpose is to convert data of different magnitudes or units into values with a unified standard, so as to facilitate comparison and analysis. Normalization is to normalize all data to the range of [0,1] to ensure the consistency and comparability of the data.
[0121] In one embodiment, a device for optimizing a long short-term memory network model based on a firefly algorithm is provided, comprising: a data acquisition module, a feature optimization module, a hyperparameter optimization module, and a long short-term memory network model optimization module, wherein:
[0122] The data acquisition module is used to collect multiple working status data of the electric ball valve, wherein the multiple working status data at least include numerical values corresponding to characteristic names such as working current, temperature, pressure, valve position, and vibration frequency.
[0123] The feature optimization module is used to perform feature optimization on the plurality of working status data that have undergone the preprocessing by using the firefly algorithm, and output an optimal feature combination.
[0124] A hyperparameter optimization module is used to select the corresponding multiple working status data according to the optimal feature combination, bring the numerical values of the multiple working status data into the long short-term memory network model, and optimize the hyperparameters of the long short-term memory network model through the firefly algorithm to output the optimal hyperparameter combination.
[0125] The long short-term memory network model optimization module is used to assign values to the long short-term memory network model according to the optimal hyperparameter combination, select the corresponding multiple working status data according to the optimal feature combination, bring the values of the multiple working status data into the long short-term memory network model, and optimize the long short-term memory network model through the firefly algorithm to obtain the optimal long short-term memory network model.
[0126] The feature optimization module includes:
[0127] Initialize the first firefly unit, which is used to select any several working status data from the multiple working status data to form several feature subsets, each first firefly corresponds to one of the feature subsets, and initialize the position of the first firefly.
[0128] A brightness calculation unit is used to divide each of the feature subsets into a first training set and a first validation set, use the first training set to train a linear regression model, and use the first validation set to calculate a validation value of the linear regression model, evaluate the performance of the trained linear regression model on the first validation set, and use the validation value of the linear regression model as the brightness value of the first firefly.
[0129] An attraction calculation unit, used to define the positions of the two first fireflies as vectors x i and x j , the vector x i and x j The attraction between Among them, β0 is the initial attraction, which is set to 1.0; is the Hamming distance, which is used to measure the difference between the two first fireflies, x ik 、x jk are the vector x i 、x j The value at the kth position; γ ij is the light absorption coefficient, w ij is a weighting factor.
[0130] The first firefly moving unit is used to move the first firefly with a lower brightness value toward the first firefly with a higher brightness value. The moving formula is: in, are the vector x i 、x j At the position of the tth iteration; α is a random factor, set to 0.1; rand is a random number between [0,1]; when updating the position of the first firefly after moving, round the result to a binary vector.
[0131] The iterative optimization unit is used to set the first iteration number, calculate the brightness of each of the first fireflies in each iteration, and record the position of the first firefly with the lowest brightness in each iteration as the current optimal solution.
[0132] An output unit is used to output the position of the first firefly with the lowest brightness after the first number of iterations as the optimal feature combination.
[0133] The hyperparameter optimization module includes:
[0134] The range definition unit is used to define a reasonable range of the hyperparameter combination as a search space.
[0135] The second firefly initialization module is used to define each second firefly to represent a set of hyperparameter combinations and randomly initialize a group of second fireflies.
[0136] A brightness calculation unit is used to construct a second training set and a second validation set based on the multiple working status data in the optimal feature combination and the corresponding numerical values in the multiple working status data, train the long short-term memory network model with the second training set, and use the second validation set to calculate the validation value of the long short-term memory network model, evaluate the performance of the trained long short-term memory network model on the second validation set, and use the validation value on the long short-term memory network model as the brightness value of the second firefly.
[0137] An attraction calculation unit is used to define the positions of the two second fireflies as vectors x i ′、x j ′, the vector x i ′、x j The attraction between ′ is Among them, β0′ is the initial attraction, which is set to 1.0; is the Euclidean distance, which is used to measure the difference between the two fireflies mentioned in the second paragraph, x ik ′、x jk ′ are vectors x i ′、x j ′ is the value of the kth position; γ′ ij is the light absorption coefficient, w′ ij is a weighting factor.
[0138] The second firefly moving unit is used to calculate the movement of the second firefly with a lower brightness value toward the second firefly with a higher brightness value. The moving formula is as follows: i ' t+1 =x i ' t +β′ ij (x j 't -x i ' t )+α′(rand-0.5); where x j ' t 、x i ' t are the vector x i ′、x j ′ is the position of the tth iteration; α′ is a random factor, set to 0.1; rand is a random number between [0,1].
[0139] The iterative optimization unit is used to calculate the brightness of each second firefly in each iteration according to the set second iterative optimization times, and record the position of the second firefly with the lowest brightness in each iteration as the current optimal solution.
[0140] The output unit is used to output the position of the second firefly with the lowest brightness after the set number of iterative optimizations as the optimal hyperparameter combination.
[0141] The long short-term memory network model optimization module includes:
[0142] A data preparation unit is used to construct a third training set, a third validation set and a third test set according to the multiple working status data in the optimal feature combination and using the corresponding values in the multiple working status data.
[0143] The long short-term memory network model assignment unit is used to assign values to the long short-term memory network model using the optimal hyperparameter combination.
[0144] The long short-term memory network model training unit is used to train the long short-term memory network model using the third training set, capture the continuous dependency in the time series, predict the remaining life of the electric ball valve, and generate the optimal long short-term memory network model.
[0145] The long short-term memory network model evaluation unit is used to calculate the verification value of the third verification set on the long short-term memory network model during the training process, and use the third verification set to evaluate the performance of the long short-term memory network model; and after the training is completed, calculate the verification value of the third test set on the long short-term memory network model, and use the third test set to evaluate the final performance of the long short-term memory network model.
[0146] The optimal long short-term memory network model storage unit is used to store the optimal long short-term memory network model that has been trained.
[0147] For the specific definition of the device for optimizing the long short-term memory network model based on the firefly algorithm, please refer to the definition of the method for optimizing the long short-term memory network model based on the firefly algorithm above, which will not be repeated here. Each module in the above-mentioned device for optimizing the long short-term memory network model based on the firefly algorithm can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0148] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 3 As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data based on the firefly algorithm to optimize the long short memory network model. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for optimizing the long short memory network model based on the firefly algorithm is implemented.
[0149] Those skilled in the art will understand that Figure 3 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0150] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0151] S1, collecting multiple working status data of the electric ball valve, wherein the multiple working status data at least include characteristic names such as working current, temperature, pressure, valve position, vibration frequency and corresponding values;
[0152] S2, optimizing the features of the plurality of working status data by using a firefly algorithm, and outputting an optimal feature combination;
[0153] S3, selecting the corresponding multiple working state data according to the optimal feature combination, bringing the values of the multiple working state data into the long short-term memory network model, and optimizing the hyperparameters of the long short-term memory network model by the firefly algorithm, and outputting the optimal hyperparameter combination;
[0154] S4, assigning values to the long short-term memory network model according to the optimal hyperparameter combination, selecting the corresponding multiple working status data according to the optimal feature combination, bringing the values of the multiple working status data into the long short-term memory network model, and optimizing the long short-term memory network model through the firefly algorithm to obtain the optimal long short-term memory network model.
[0155] In one embodiment, a person of ordinary skill in the art who implements the above-mentioned embodiment method when the computer program is executed by the processor can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through the computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct RAMbus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM, etc.
[0156] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by any technician familiar with the technical field within the technical scope disclosed in the present application should be included in the protection scope of the present application.
Claims
1. A method for optimizing a long short-term memory network model based on a firefly algorithm, wherein the long short-term memory network model is used to predict the remaining life of an electric ball valve, characterized in that: include: S1, collecting multiple working status data of the electric ball valve, wherein the multiple working status data at least include characteristic names such as working current, temperature, pressure, valve position, vibration frequency and corresponding values; S2, optimizing the features of the plurality of working status data by using a firefly algorithm, and outputting an optimal feature combination; S3, selecting the corresponding multiple working state data according to the optimal feature combination, bringing the values of the multiple working state data into the long short-term memory network model, and optimizing the hyperparameters of the long short-term memory network model by the firefly algorithm, and outputting the optimal hyperparameter combination; S4, assigning values to the long short-term memory network model according to the optimal hyperparameter combination, selecting the corresponding multiple working status data according to the optimal feature combination, bringing the values of the multiple working status data into the long short-term memory network model, and optimizing the long short-term memory network model through the firefly algorithm to obtain the optimal long short-term memory network model.
2. The method according to claim 1, characterized in that The feature optimization of the plurality of working status data is performed by using the firefly algorithm, including: S21, selecting any several working status data from the plurality of working status data to form a plurality of feature subsets, each first firefly corresponds to one of the feature subsets, and initializing the position of the first firefly; S22, dividing each of the feature subsets into a first training set and a first validation set, using the first training set to train a linear regression model, and using the first validation set to calculate a validation value of the linear regression model, evaluating the performance of the trained linear regression model on the first validation set, and using the validation value of the linear regression model as the brightness value of the first firefly, wherein the validation value is at least one of a sum variance, a mean square error, a standard deviation, and a judgment coefficient; S23, define the positions of the two first fireflies as vector x i and x j , the vector x i and x j The attraction between Among them, β0 is the initial attraction, which is set to 1.0; is the Hamming distance, which is used to measure the difference between the two first fireflies, x ik 、x jk are the vector x i 、x j The value at the kth position; γ ij is the light absorption coefficient, w ij is a weighting factor; S24, the first firefly with a lower brightness value moves toward the first firefly with a higher brightness value, and the moving formula is: in, are the vector x i 、x j At the position of the tth iteration; α is a random factor, set to 0.1; rand is a random number between [0,1]; when updating the position of the first firefly after moving, round the result to a binary vector; S25, setting the first iteration number, calculating the brightness of each of the first fireflies in each iteration, and recording the position of the first firefly with the lowest brightness in each iteration as the current optimal solution; S26, outputting the position of the first firefly with the lowest brightness after the first number of iterations as the optimal feature combination.
3. The method according to claim 1, characterized in that The method further comprises: selecting the corresponding plurality of working state data according to the optimal feature combination, bringing the values of the plurality of working state data into the long short-term memory network model, optimizing the hyperparameters of the long short-term memory network model by the firefly algorithm, and outputting the optimal hyperparameter combination, including: S31, defining a reasonable range of the hyperparameter combination as a search space; S32, each second firefly represents a set of the hyperparameter combinations, and a group of second fireflies are randomly initialized; S33, according to the multiple working state data in the optimal feature combination, a second training set and a second validation set are constructed using the corresponding values in the multiple working state data, the second training set is used to train the long short-term memory network model, and the second validation set is used to calculate the validation value of the long short-term memory network model, the performance of the trained long short-term memory network model is evaluated on the second validation set, and the validation value on the long short-term memory network model is used as the brightness value of the second firefly, and the validation value is at least one of the sum variance, mean square error, standard deviation and judgment coefficient; S34, define the positions of the two second fireflies as vectors x i ′、x j ′, the vector x i ′、x j The attraction between ′ is Among them, β′0 is the initial attraction, which is set to 1.0; is the Euclidean distance, which is used to measure the difference between the two fireflies mentioned in the second paragraph, x ik ′、x jk ′ are vectors x i ′、x j ′ is the value of the kth position; γ′ ij is the light absorption coefficient, w′ ij is a weighting factor; S35, the second firefly with a lower brightness value moves toward the second firefly with a higher brightness value, and the moving formula is as follows: i ' t+1 =x i ' t +β′ ij (x′ j t -x j ' t )+α′(rand-0.5); where x j ' t 、x i ' t are the vector x i ′、x j ′ is the position of the tth iteration; α′ is a random factor, set to 0.1; rand is a random number between [0,1]; S36, setting the number of second iteration optimization times, calculating the brightness of each second firefly in each iteration, and recording the position of the second firefly with the lowest brightness in each iteration as the current optimal solution; S37, outputting the position of the second firefly with the lowest brightness after the set number of iterative optimizations as the optimal hyperparameter combination.
4. The method according to claim 1, characterized in that: The long short-term memory network model is assigned values according to the optimal hyperparameter combination, the corresponding multiple working state data are selected according to the optimal feature combination, the values of the multiple working state data are brought into the long short-term memory network model, and the long short-term memory network model is optimized by the firefly algorithm to obtain the optimal long short-term memory network model, including: S41, constructing a third training set, a third validation set and a third test set according to the plurality of working status data in the optimal feature combination using the corresponding values in the plurality of working status data; S42, assigning values to the long short-term memory network model using the optimal hyperparameter combination; S43, using the third training set to train the long short-term memory network model, capturing the continuous dependency in the time series, and predicting the remaining life of the electric ball valve, to generate the optimal long short-term memory network model; S44, during the training process, calculating a verification value of the third verification set on the long short-term memory network model, wherein the verification value is at least one of a sum variance, a mean square error, a standard deviation, and a judgment coefficient, and using the third verification set to evaluate the performance of the long short-term memory network model; S45, after the training is completed, calculating the verification value of the third test set on the long short-term memory network model, the verification value is at least one of the sum variance, mean square error, standard deviation and judgment coefficient, and using the third test set to evaluate the final performance of the long short-term memory network model; S46, saving the optimal long short-term memory network model after the training.
5. The method according to claim 1, characterized in that The plurality of working status data are preprocessed, wherein the preprocessing includes at least one of missing value filling, abnormal value monitoring and processing, and normalization processing.
6. The method according to claim 1, characterized in that The optimal long-short memory network model is used to predict the remaining life of the electric ball valve. The corresponding value in the optimal feature combination monitored in real time is input into the optimal long-short memory network model, and the real-time predicted remaining life of the electric ball valve is output, including: S51, collecting the numerical value corresponding to the optimal feature combination monitored in real time, and preprocessing the numerical value data corresponding to the optimal feature combination monitored in real time; S52, inputting the corresponding value in the optimal feature combination monitored in real time into the optimal long short-term memory network model; S53, outputting the real-time predicted remaining life of the electric ball valve according to the continuous dependency in the time series in the optimal long-short memory network model based on the corresponding numerical value in the optimal feature combination monitored in real time.
7. A device for optimizing a long short-term memory network model based on a firefly algorithm, characterized in that: The device comprises: A data acquisition module, used for collecting multiple working status data of the electric ball valve, wherein the multiple working status data at least include numerical values corresponding to characteristic names such as working current, temperature, pressure, valve position, and vibration frequency; A feature optimization module, used for performing feature optimization on the plurality of working state data that have undergone the preprocessing by using the firefly algorithm, and outputting an optimal feature combination; A hyperparameter optimization module, used for selecting the corresponding multiple working state data according to the optimal feature combination, bringing the values of the multiple working state data into the long short-term memory network model, and optimizing the hyperparameters of the long short-term memory network model by the firefly algorithm, and outputting the optimal hyperparameter combination; The long short-term memory network model optimization module is used to assign values to the long short-term memory network model according to the optimal hyperparameter combination, select the corresponding multiple working status data according to the optimal feature combination, bring the values of the multiple working status data into the long short-term memory network model, and optimize the long short-term memory network model through the firefly algorithm to obtain the optimal long short-term memory network model.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.