An application method based on harmony search algorithm in deep learning model optimization
By optimizing the harmony search algorithm and combining ShuffleNetV2 and single-path mean sampling, neural architecture search and hyperparameter optimization of deep learning models is solved, and the problems of slow optimization speed and insufficient model performance in traditional methods are achieved, achieving more efficient neural architecture search and performance improvement.
Patent Information
- Application Number
- CN202410988767.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-23
- Publication Date
- 2025-04-08
- Estimated Expiration
- 2044-07-23
AI Technical Summary
When the existing technology deals with complex optimization problems, the harmonic search algorithm has problems such as slow convergence speed, easy to fall into local optimization and insufficient solution accuracy. The neural architecture design of traditional deep learning models relies on the prior knowledge and experience of researchers, which makes it difficult for the model performance to meet practicality requirements.
Through the cosine optimization operator and Levy flight mechanism, and the parameter adaptive adjustment strategy are combined, the harmonic search algorithm is optimized to obtain an improved harmonic search algorithm. As a search strategy for neural architecture search, this algorithm combines the lightweight neural convolutional network ShuffleNetV2 and single-path mean sampling method to search for deep learning models and optimize the hyperparameters to build a dual-optimized deep learning model.
The convergence speed and solution accuracy of the harmony search algorithm are improved, the probability of falling into local optimality is reduced, and the local search ability and global search ability of the algorithm are balanced, thereby improving the efficiency of neural architecture search and neural network performance.
Smart Images

Figure CN118917388B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of deep learning and neural network architecture search technology, and in particular to an application method based on a harmony search algorithm in deep learning model optimization. Background Art
[0002] In real life and production, there are many challenging optimization problems in the fields of economy, science and engineering. The optimization problem is the process of selecting the best option from a set of available alternatives. As the complexity of optimization problems continues to increase, traditional optimization algorithms can no longer find the optimal solution to the optimization problem within a reasonable time. In order to solve complex optimization problems, intelligent optimization algorithms such as genetic algorithms, particle swarm optimization algorithms and harmonic search algorithms have been proposed and successfully applied to solve complex optimization problems in different fields. The standard harmonic search algorithm has achieved good optimization results in function optimization, structural design and parameter optimization. However, when dealing with complex problems, it still has problems such as slow convergence, easy to fall into local optimality, and insufficient solution accuracy.
[0003] With the rapid development of artificial intelligence technology, deep learning technology has been widely used in various fields of human life and production. Various deep learning models based on deep neural networks have played an irreplaceable role in helping humans complete challenging tasks. Currently, the widely used deep learning models include convolutional neural networks (CNN), recurrent neural networks (RNN), and generative adversarial networks. CNN is a feedforward neural network that can extract data features through convolution operations. Because it can automatically extract features without human supervision, it is widely used in image classification, target detection and positioning. RNN and its variants have the advantages of parameter sharing and full use of context information, and have been successfully applied to natural language processing fields such as knowledge extraction, machine translation and language modeling. However, the neural architecture design method of traditional deep learning models based on CNN and RNN is heavily dependent on the researchers' prior knowledge and experience. Not only is the model design cost very high, but the obtained model performance is difficult to meet good practical requirements. In order to reduce the cost of neural architecture design, in recent years, scholars have proposed neural architecture search (NAS) methods and hyperparameter optimization methods based on automated learning; the basic principle of NAS is to select a neural architecture from the architecture search space through a search strategy, evaluate it using a performance evaluation strategy, and repeat the search and evaluation process until the optimal network architecture is found; the essence of hyperparameter optimization is to hand over the parameter adjustment operations of traditional deep learning models that are manually completed to machines, that is, to call relevant algorithms so that the machine can automatically adjust the parameters to obtain the optimal hyperparameter combination. Compared with artificially designed neural networks, neural architectures designed using NAS and hyperparameter optimization methods not only have significant advantages in processing various tasks, but also have obvious advantages in model size and time cost consumption. For deep learning models built for different tasks, different search spaces, search strategies, and performance evaluation strategies may be used when generating neural architectures through NAS, which will result in very different performance of the final neural architecture; for this reason, research on NAS optimization methods and hyperparameter optimization methods has become a hot topic in the field of deep learning in recent years. Therefore, it is urgent to propose an application method based on the harmony search algorithm in deep learning model optimization, to solve the technical problem of how to optimize neural architecture search and hyperparameters based on the improved harmony search algorithm, and to improve the efficiency of neural architecture search and neural network performance in deep learning network models. Summary of the invention
[0004] The main purpose of this invention is to propose an application method based on the harmony search algorithm in deep learning model optimization, aiming to solve the technical problem of how to optimize neural architecture search and hyperparameters based on the improved harmony search algorithm, and improve the efficiency of neural architecture search and neural network performance in deep learning network models.
[0005] To achieve the above object, the present invention provides an application method based on a harmony search algorithm in deep learning model optimization, wherein the application method based on a harmony search algorithm in deep learning model optimization comprises the following steps:
[0006] S1. By using the sine-cosine optimization operator and the Levy flight mechanism and integrating the parameter adaptive adjustment strategy, the harmony search algorithm is optimized once to obtain the first harmony search algorithm;
[0007] S2, performing secondary optimization on the first harmony search algorithm to obtain a second harmony search algorithm;
[0008] S3. Use the second harmony search algorithm as the search strategy for neural architecture search and build a neural architecture search framework based on the second harmony search algorithm.
[0009] S4. Build a deep learning model, perform neural architecture search optimization on the deep learning model based on the second harmony search algorithm, and perform hyperparameter optimization on the deep learning model based on the first harmony search algorithm to obtain a dual-optimized deep learning model.
[0010] In one of the preferred solutions, step S1 is specifically:
[0011] S11, define the optimization problem, and initialize the parameters and harmony memory library;
[0012] S12. Generate a random number r 1 , if the random number r 1 ≥HMCR, according to X i,j = L + (UL) × rand, randomly select a harmony vector from the search domain outside the harmony memory as X new ; If the random number r 1 <HMCR, then when generating a random number r 2 , if r 2 <PAR, then all the harmony vectors in the harmony memory library are fine-tuned through the sine-cosine optimization operator, and the best one is selected as X new ; Among them, HMCR is the probability of harmony memory library value, X i,j is a randomly selected harmony vector, L is the lower boundary of the search domain, U is the upper boundary of the search domain, rand is a random number between (0,1), and PAR is the probability of fine-tuning the harmony variable;
[0013] S13, update the harmony memory library, and set the harmony vector X new The fitness value is better than the worst harmony vector X of the initial harmony memory library worst If the fitness value is , the replacement is performed; otherwise, the fine-tuning bandwidth is updated according to the Levy flight mechanism, and the search domain is updated through the parameter adaptive adjustment strategy, and the process returns to step S12;
[0014] S14, determine whether the maximum number of iterations has been reached, if so, output the global optimal solution to obtain the first harmony search algorithm after optimization; otherwise, update HMCR and PAR through the parameter adaptive adjustment strategy, and return to step S12.
[0015] In one of the preferred solutions, step S2 is specifically:
[0016] S21, setting the number of iterations, and adaptively adjusting the HMCR and PAR of the first harmony search algorithm according to the number of iterations; wherein HMCR is the probability of taking values from the harmony memory library, and PAR is the probability of fine-tuning the harmony variables;
[0017] S22. The bandwidth is fine-tuned by a second update through the Levy flight mechanism to obtain a second harmony search algorithm.
[0018] In one of the preferred solutions, step S3 is specifically:
[0019] S31. Constructing a hypernetwork search space through a lightweight neural convolutional network ShuffleNetV2;
[0020] S32, using a single path mean sampling method to perform subnet training on the super network search space, determine the network hyperparameters, and train the subnet to search for the optimal network structure;
[0021] S33. Use the second harmony search algorithm as the search strategy for the neural architecture search to search and verify the subnet, and determine whether the iteration termination condition is met. If so, output the optimal neural architecture search framework, otherwise, repeat steps S32-S33.
[0022] In one preferred solution, the step S33 uses the second harmony search algorithm as the search strategy of the neural architecture search to search and verify the subnet, specifically:
[0023] Initializing the harmony memory bank of the second harmony search algorithm using a subnet architecture;
[0024] The harmony memory is updated according to the accuracy value of the current subnet architecture, and the adaptive adjustment strategy of the fusion parameters is used to update HMCR, PAR and BW; HMCR is the probability of taking values in the harmony memory, PAR is the probability of fine-tuning the harmony variables, and BW is the fine-tuning bandwidth;
[0025] The optimized subnet architecture is compared with the initial subnet architecture, and the subnet architecture with the best accuracy is selected to update to the harmony memory library.
[0026] One of the preferred solutions, the fusion parameter adaptive adjustment strategy updates HMCR, PAR and BW, specifically:
[0027] The HMCR is:
[0028]
[0029] The PAR is:
[0030]
[0031] The BW is:
[0032]
[0033] Among them, t is the current iteration number, T max is the maximum number of iterations, is the current individual position, α is a constant coefficient, which is 0.001, and s is the Levy flight random step.
[0034] One of the preferred solutions, step S4 performs neural architecture search optimization on the deep learning model based on the second harmony search algorithm, specifically:
[0035] S411. Construct a search space of BiLSTM; wherein BiLSTM is a bidirectional long short-term memory network;
[0036] S412, determine the hyperparameters of the deep learning model, and train the subnet to search for the optimal network architecture;
[0037] S413, using the second harmony search algorithm to perform optimal architecture search and verification; specifically:
[0038] Initialize the harmony memory library composed of different network structures, update the population according to the accuracy of the current neural architecture, generate new offspring individuals in the improvisation stage, obtain the optimized network architecture, and then compare the optimized network architecture with the initial network architecture to select the network architecture with the best performance;
[0039] S414: Determine whether the iteration termination condition is met. If so, output the historical optimal network architecture combination. Otherwise, execute steps S412-S414.
[0040] In one of the preferred solutions, the hyperparameters include learning rate, number of hidden units, number of layers and maximum sequence length.
[0041] One of the preferred solutions, step S4 performs hyperparameter optimization on the deep learning model based on the first harmony search algorithm, specifically:
[0042] S421, determining a performance evaluation index of the deep learning model, and using the performance evaluation index as a fitness function value of the first harmony search algorithm, and initializing parameters;
[0043] The performance evaluation indicators include precision P, recall R and F 1 value;
[0044] S422, initializing a harmony memory of a first harmony search algorithm, and randomly generating N harmonies; wherein N is the size of the harmony memory;
[0045] S423, generating a random number r', if the random number r'≥HMCR, randomly selecting a harmony vector from the search domain outside the harmony memory library; if the random number r'<HMCR, generating a random number r", if the random number r"<PAR, fine-tuning all the harmony vectors in the harmony memory library through the sine-cosine optimization operator, and selecting the optimal harmony vector therefrom, wherein HMCR is the probability of taking values in the harmony memory library, and PAR is the probability of fine-tuning the harmony variable;
[0046] S424, updating the harmony memory library, and replacing the worst harmony vector in the harmony memory library with the newly generated harmony vector by comparing the fitness function value;
[0047] S425: Determine whether the iteration termination condition is met. If so, output the double-optimized deep learning model. Otherwise, repeat steps S423-S425.
[0048] One of the preferred solutions, after step S4, further includes:
[0049] Perform performance tests on the dual-optimized deep learning model; specifically:
[0050] Constructing a data set, and dividing the data set into a training set, a test set, and a validation set in proportion;
[0051] Each model is trained through the training set, each model is tested through the test set, and each model is verified through the validation set.
[0052] The deep learning model after dual optimization was compared with the initial deep learning model, the deep learning model that only performed neural architecture search, and the deep learning model that only performed hyperparameter optimization.
[0053] In the above technical solution of the present invention, the application method based on the harmony search algorithm in the optimization of deep learning models includes the following steps: optimizing the harmony search algorithm once through the sine-cosine optimization operator and the Levy flight mechanism, and integrating the parameter adaptive adjustment strategy to obtain the first harmony search algorithm; optimizing the first harmony search algorithm twice to obtain the second harmony search algorithm; using the second harmony search algorithm as the search strategy for neural architecture search, and constructing a neural architecture search framework based on the second harmony search algorithm; constructing a deep learning model, optimizing the neural architecture search of the deep learning model based on the second harmony search algorithm, and optimizing the hyperparameters of the deep learning model based on the first harmony search algorithm to obtain a double-optimized deep learning model. The present invention solves the technical problem of how to optimize the neural architecture search and hyperparameters based on the improved harmony search algorithm, and improve the efficiency of the neural architecture search and the performance of the neural network in the deep learning network model.
[0054] In the present invention, the harmony vector in the improvisation stage is fine-tuned by combining the sine-cosine optimization operator and the fine-tuning broadband, which improves the convergence speed and solution accuracy of the algorithm; and the Levy flight mechanism is used to update the fine-tuning broadband, which reduces the probability of the algorithm falling into the local optimum. By adaptively and dynamically adjusting the parameters during the iteration process, the local search ability and the global search ability of the algorithm are balanced.
[0055] In the present invention, during the secondary optimization process of the first harmony search algorithm, the HMCR and PAR in the first harmony search algorithm are adaptively adjusted according to the number of iterations. In the early stage of iteration, the HMCR is set to a smaller value, so that the algorithm can search from the harmony memory library composed of the super network search space with a greater probability; at the same time, the PAR is set to a larger value, which ensures that the algorithm can effectively fine-tune the composition of the subnet neural architecture with a greater probability. Thereafter, the HMCR increases with the increase in the number of iterations, ensuring the diversity of the harmony memory library and enriching the neural architecture combination. At the same time, the PAR decreases with the increase in the number of iterations, so that the combination state of the neural architecture is adjusted from a larger probability to a smaller probability, ensuring that while improving the calculation speed of the algorithm, the global search ability and the local search ability of the algorithm are well balanced, thereby obtaining a better convergence effect.
[0056] In the present invention, the fine-tuning bandwidth is updated twice through the Levy flight mechanism, and the step size of the fine-tuning is controlled by means of BW, thereby jumping out of the local optimum and improving the accuracy of the solution.
[0057] In the present invention, a lightweight neural convolutional network ShuffleNetV2 is used to construct a neural architecture search space, and a single-path uniform sampling method is used to perform subnet training on the super network search space. Based on this, a neural architecture search framework based on the second harmony search algorithm is constructed, thereby obtaining a highly accurate neural architecture in a relatively short time.
[0058] In the present invention, the neural architecture search optimization of BiLSTM in the deep learning model is performed based on the second harmony search algorithm, which ensures that the model can fully and effectively capture contextual information, and the first harmony search algorithm is used to optimize the hyperparameters in the deep learning model to ensure the stability and accuracy of model training, thereby constructing a dual-optimized deep learning model. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. It is obvious that the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the structures shown in these drawings without paying creative work.
[0060] Figure 1 A schematic diagram of an application method of a harmony search algorithm in deep learning model optimization according to an embodiment of the present invention;
[0061] Figure 2 (a) is a structural unit diagram of ShuffleNetV2 with a step size of 1 according to an embodiment of the present invention;
[0062] Figure 2 (b) is a structural unit diagram of ShuffleNetV2 with a step size of 2 according to an embodiment of the present invention;
[0063] Figure 3 is a schematic diagram of step S3 of an embodiment of the present invention;
[0064] Figure 4 (a) is a distribution diagram of the Top-1 acc values on CIFAR-10 with a batch size of 64 in an embodiment of the present invention;
[0065] Figure 4 (b) is a distribution diagram of Top-1 acc values on CIFAR-10 with a batch size of 96 in an embodiment of the present invention;
[0066] Figure 5 This is a distribution diagram of Top-1 acc values on FashionMNIST with a batch size of 64 in an embodiment of the present invention;
[0067] Figure 6This is a distribution diagram of Top-1 acc values on FashionMNIST with a batch size of 96 in an embodiment of the present invention;
[0068] Figure 7 This is a distribution diagram of the Top-1 acc values of individuals in a population on CIFAR-10 with a batch size of 64 in an embodiment of the present invention;
[0069] Figure 8 This is a distribution diagram of the Top-1 acc values of individuals in a population on CIFAR-10 with a batch size of 96 in an embodiment of the present invention;
[0070] Fig. 9 This is a distribution diagram of the Top-1 acc values of individuals in a population on FashionMNIST with a batch size of 64 in an embodiment of the present invention;
[0071] Fig.10 This is a distribution diagram of the Top-1 acc values of individuals in a population on FashionMNIST with a batch size of 96 in an embodiment of the present invention;
[0072] Fig.11 A schematic diagram of a process of performing neural architecture search optimization on a deep learning model based on a second harmony search algorithm according to an embodiment of the present invention;
[0073] Fig.12 This is a comparative experimental diagram of four models in the embodiment of the present invention;
[0074] Fig.13 It is a precision rate P convergence curve diagram of four models in the embodiment of the present invention;
[0075] Fig.14 It is a recall rate R convergence curve diagram of the four models in the embodiment of the present invention;
[0076] Fig.15 It is a graph showing the convergence curve of F1 values of four models according to the embodiment of the present invention.
[0077] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with the implementation methods and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0078] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention. In addition, the technical solutions between the various embodiments of the present invention can be combined with each other, but they must be based on the ability of ordinary technicians in this field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such a combination of technical solutions does not exist and is not within the scope of protection required by the present invention.
[0079] See also Figure 1-Figure 15 According to one aspect of the present invention, the present invention provides an application method based on harmony search algorithm in deep learning model optimization, comprising the following steps:
[0080] S1. By using the sine-cosine optimization operator and the Levy flight mechanism and integrating the parameter adaptive adjustment strategy, the harmony search algorithm is optimized once to obtain the first harmony search algorithm;
[0081] S2, performing secondary optimization on the first harmony search algorithm to obtain a second harmony search algorithm;
[0082] S3. Use the second harmony search algorithm as the search strategy for neural architecture search and build a neural architecture search framework based on the second harmony search algorithm.
[0083] S4. Build a deep learning model, perform neural architecture search optimization on the deep learning model based on the second harmony search algorithm, and perform hyperparameter optimization on the deep learning model based on the first harmony search algorithm to obtain a dual-optimized deep learning model.
[0084] Specifically, in this embodiment, the step S1 is specifically:
[0085] S11. Define the optimization problem and initialize the parameters and harmony memory library; the initialization parameters include HMS, HMCR, PAR, BW, T max , U and L; where HMS is the size of the harmony memory bank, HMCR is the probability of taking values in the harmony memory bank, PAR is the probability of fine-tuning the harmony variables, BW is the step size when fine-tuning the harmony variables, T max is the maximum number of iterations, U is the upper boundary of the search domain, and L is the lower boundary of the search domain;
[0086] S12. Improvisation: Generate random number r 1 , if the random number r 1 ≥HMCR, according to X i,j= L + (UL) × rand, randomly select a harmony vector from the search domain outside the harmony memory as X new ; If the random number r 1 <HMCR, then when generating a random number r 2 , if r 2 <PAR, then all the harmony vectors in the harmony memory library are fine-tuned through the sine-cosine optimization operator, and the best one is selected as X new ; Among them, X i,j is a randomly selected harmony vector, rand is a random number between (0,1);
[0087] S13, update the harmony memory library, and set the harmony vector X new The fitness value is better than the worst harmony vector X of the initial harmony memory library worst If the fitness value is , the replacement is performed; otherwise, the fine-tuning bandwidth is updated according to the Levy flight mechanism, and the search domain is updated through the parameter adaptive adjustment strategy, and the process returns to step S12;
[0088] S14, determine whether the maximum number of iterations has been reached, if so, output the global optimal solution to obtain the first harmony search algorithm after optimization; otherwise, update HMCR and PAR through the parameter adaptive adjustment strategy, and return to step S12.
[0089] Specifically, in this embodiment, in the improvisation stage, the existing harmony search algorithm only uses the information of a certain individual in the process of performing variable fine-tuning operation on a selected harmony individual to generate a new harmony individual, while ignoring the influence of the unselected individuals on the newly generated harmony; in order to fully utilize the information of other harmony individuals to generate new harmony individuals and improve the local search capability of all harmony variables in the harmony library, the generation of new harmony in the variable fine-tuning stage is improved, and the optimization problem is solved by the sine and cosine optimization operator; first, a candidate solution population composed of individuals is generated in the search domain, the optimal individual is determined by calculating the fitness value of the individual, and the positions of all individuals are updated, specifically:
[0090]
[0091] in, For the current individual, For new individuals, is the current optimal individual, r 2 、r 3 are random numbers from a uniform distribution in the intervals (0,2π) and (0,2), r 4 is a random number in the interval (0,1). 4 When r is less than 0.5, the sine function is used to generate new individuals. 4When >0.5, the cosine function is used to generate new individuals, and the positions of individuals are finally updated in the oscillation adjustment of the sine and cosine functions; r 1 Determines the local search and global search capabilities of the algorithm. 1 sin(r 2 )<1 or |r 1 cos(r 2 )<1, it is beneficial for the next generation of individuals to approach the optimal individual range, thereby improving the local search ability of the algorithm; |r 1 sin(r 2 )|≥1 or r 1 cos(r 2 )|≥1, the algorithm focuses on searching the entire search domain, which enhances the algorithm's global search capability. 1 As the number of iterations changes dynamically, it is as follows:
[0092]
[0093] Wherein, a is a constant greater than 1, and its empirical value is usually 2. The individual update method in the sine-cosine optimization operator is introduced into the harmony vector fine-tuning operation in the improvisation stage of the harmony search algorithm to fine-tune the harmony vector, specifically:
[0094]
[0095] In order to speed up the convergence of the algorithm, the random number r 3 Set to a random number in the interval (0,1) that follows a uniform distribution.
[0096] Specifically, in this embodiment, the present invention adopts the flight characteristics of alternating long and short distances such as Levy flight, which plays an important role in balancing the local exploration and global search capabilities of the optimization algorithm: random walks with smaller steps are conducive to the algorithm to perform local exploration, while occasional jumps with larger steps are conducive to the algorithm to jump out of the local optimum and improve the global search capability; the random step size of Levy flight is:
[0097]
[0098] Among them, s is the flight random step length, μ and v are parameters that obey the normal distribution, σ v =1,σ μ for:
[0099]
[0100] Wherein, Γ(x) is a gamma function, β∈(0,2), and in the present invention, β=1.5;
[0101] By introducing the sine-cosine optimization operator to generate new harmony in the variable fine-tuning stage of the harmony search algorithm, it is beneficial to improve the local search ability of the algorithm. However, the requirements for local search ability and global search ability are different before and after the algorithm iteration. BW is used to balance the local search ability and global search ability of the algorithm, thereby reducing the possibility of the algorithm falling into the local optimum; the Levy flight mechanism is used to update the parameter BW, specifically: during the iteration process, the optimal individual and the random individual are adjusted according to the Levy flight step s, and then the BW is updated;
[0102]
[0103] in, is the optimal individual, is the current random individual, α is a constant coefficient, which is 0.001;
[0104] In this way, when s changes slightly, the direction of change of the step size can be kept close to the optimal individual as much as possible, which is beneficial to improving the solution accuracy of the algorithm; when s changes greatly, the probability of the algorithm falling into the local optimum is reduced, which is beneficial to improving the global search ability of the algorithm.
[0105] Specifically, in the present embodiment, in the first harmony search algorithm, a smaller HMCR and a smaller search domain are conducive to improving the local search capability of the algorithm; a larger HMCR and a larger search domain are conducive to increasing the diversity of the harmony library; a larger PAR is conducive to improving the solution accuracy of the algorithm, while a smaller PAR is conducive to maintaining the stability of the algorithm; it can be seen that in the early stage of algorithm iteration, the focus is on local exploration, and it is advisable to set HMCR to a smaller value and PAR to a larger value. In order to increase the diversity of the population search space, the search range should be larger; in the later stage of algorithm iteration, appropriately increasing HMCR is conducive to enhancing the global search capability of the algorithm, and appropriately reducing PAR can maintain better algorithm stability, which is conducive to making the harmony in HM gradually approach the optimal harmony; therefore, it is necessary to firstly adaptively adjust HMCR and PAR;
[0106] Adaptively adjust HMCR, specifically:
[0107]
[0108] Adaptively adjust PAR, specifically:
[0109]
[0110] Secondly, the search domain is adjusted linearly and dynamically, specifically:
[0111] Initialize the upper and lower bounds of the search domain, and perform linear dynamic updates on the search domain during the algorithm iteration process; specifically:
[0112]
[0113] X maxbound,j =max(HM(:,j))
[0114] X minbound,j =min(HM(:,j))
[0115]
[0116] in, is the upper boundary of the j-th dimension search domain, X Lnew,j is the lower boundary of the j-th dimension search domain, X maxbound,j is the maximum boundary value of the j-th dimension search domain, max(HM(:,j)) is the maximum value of the j-th dimension harmony in the harmony memory library, and X minbound,j is the minimum boundary value of the j-th dimension search domain, and min(HM(:,j)) is the minimum value of the j-th dimension harmony in the harmony memory bank.
[0117] Specifically, in this embodiment, the present invention optimizes the harmony search algorithm once by using the sine-cosine optimization operator and the Levy flight mechanism, and integrates the parameter adaptive adjustment strategy to obtain the first harmony search algorithm, namely AHS-SC-LF. First, in the improvisation stage, the convergence performance of the algorithm is improved by introducing the sine-cosine optimization operator into the fine-tuning operation of the harmony vector; secondly, the Levy flight mechanism is used to update the BW to reduce the probability of the algorithm falling into the local optimum; then, the convergence speed of the algorithm is improved by adaptively adjusting the two parameters HMCR and PAR and dynamically linearly adjusting the search domain.
[0118] Specifically, in this embodiment, step S2 is specifically:
[0119] S21. Set the number of iterations, and adaptively adjust the HMCR and PAR of the first harmony search algorithm according to the number of iterations; in order to enable the neural architecture search to obtain the target neural architecture in a shorter time, it is necessary to adaptively adjust the HMCR and PAR in the first harmony search algorithm according to the number of iterations. When performing the neural architecture search, in order to fully search all neural architectures in the super network search space, in the early stage of the algorithm iteration, set the HMCR to a smaller value so that the algorithm can search from the harmony memory library composed of the super network search space with a greater probability; at the same time, set the PAR to a larger value to ensure that the algorithm can effectively fine-tune the composition of the subnet neural architecture with a greater probability; thereafter, the HMCR can be increased with the increase in the number of iterations to ensure the diversity of the harmony memory library and enrich the neural architecture combination of the neural architecture search; at the same time, the value of PAR can be reduced with the increase in the number of iterations, so that the combination state of the neural architecture changes from a larger probability adjustment to a smaller probability adjustment, so as to ensure that while improving the calculation speed of the algorithm, the global search ability and local search ability of the algorithm are well balanced, thereby obtaining better convergence results;
[0120] The HMCR is:
[0121]
[0122] The PAR is:
[0123]
[0124] S22, the bandwidth is fine-tuned by the Levy flight mechanism for a second time to obtain the second harmony search algorithm; in order to improve the solution accuracy, when searching the neural architecture, it is necessary to fine-tune the selected subnet neural architecture, and the parameter BW can be used to control the step size of the fine-tuning; in the standard harmony search algorithm, BW is fine-tuned according to the set initial value, which may cause the algorithm to be unable to jump out of the local optimum; therefore, when fine-tuning the subnet neural architecture, the Levy flight mechanism can be used to help the algorithm jump out of the local optimum; the specific implementation method is, during the algorithm iteration process, the following formula is used to implement the update of BW to control the fine-tuning operation on the selected subnet neural architecture; in this way, when the Levy flight random step size takes a smaller value, it can be ensured that the direction of the step size change is near the current optimal neural architecture, which is beneficial to improve the solution accuracy of the algorithm; the BW is:
[0125]
[0126] Specifically, in this embodiment, the traditional CNN usually involves a large number of parameters and computational complexity, and when running or deployed on a device with relatively limited resources, problems such as exceeding memory and being unable to run may occur. In order to reduce the number of model parameters and reduce computational complexity without affecting model performance, a lightweight CNN neural network was born; this type of CNN reduces the number of model parameters and reduces time consumption by continuously improving the network structure. The present invention uses a lightweight ShuffleNetV2 network to construct a super network search space for NAS; the ShuffleNet network includes two models, ShuffleNetV1 and ShuffleNetV2. The ShuffleNetV1 model uses methods such as point convolution, group convolution, and channel shuffling, which significantly reduces the amount of calculation and basically maintains the accuracy of the model; ShuffleNetV2 is an improvement on ShuffleNetV1, and its network unit structure can be found in Figure 2 , the ShuffleNetV2 network maintains a large number of channels of the same width in CNN by introducing a channel splitting operator in the block, while ensuring that there is no dense convolution and too much grouping; at the beginning of each block, the channel of the input feature map is divided into two branches; one branch is used to maintain direct connection, and the other branch contains three convolutions with the same number of channels; at the end of each block, the outputs of the two branches are spliced; this processing method can minimize network fragmentation; different from ShuffleNetV1, the 1x1 convolution in the ShuffleNetV2 block does not use grouped convolution, because the channel splitting operation at the beginning has already achieved grouping; ShuffleNet In V2, the convolution block not only has the same number of input and output channels, but also uses channel transformation operations to ensure that the information of the two branches interacts. After the channels are shuffled, the output of a ShuffleNetV2 structural unit is the input of the next structural unit. For blocks that need to be spatially downsampled, the convolution unit does not contain a channel segmentation algorithm, and the output channels of the block are doubled. The final ShuffleNetV2 model is composed of these stacked convolution blocks. The ShuffleNetV2 network selects multiple neural structures to form a selection block, and multiple neural structures in the selection block are realized through weight sharing. The overall architecture components of the ShuffleNetV2 network based on the selection block are shown in Table 1.
[0127] Table 1 is the composition table of the super network architecture
[0128]
[0129] In the table, CMP refers to maximum convolution pooling. The structures of Stage2, Stage3, and Stage4 are composed of different selection blocks. CB represents different selection blocks. When constructing the neural architecture search framework in this paper, the number of CBs is set to 20. Each selection block has 4 candidates. The convolution kernel size and the number of depth convolutions of each candidate are different. GAP stands for global average pooling. The selection block composed of multiple architecture selections is usually used to construct a random architecture. When training, the traditional NAS framework trains the subnetwork architecture corresponding to each path in the supernet, which leads to a high coupling of the weight parameters in the supernet. In order to decouple the weights, the supernet is randomly discarded. A subnet in the network architecture can effectively reduce the inheritance problem of weights during training. By comparing different path discarding strategies, a hyperparameter free training method in which each architecture is a path is proposed. Since the selection blocks that constitute the supernet have no identification branches, a random path must be retained when using this method. By evaluating and verifying this random path by randomly selecting a subnet, the efficiency of the algorithm can be effectively improved. The present invention replaces the random selection of subnets with the use of the second harmony search algorithm for selection. First, the four selection blocks are combined and arranged, and one of the blocks is selected each time. Then, the path is obtained by sampling all the selection blocks. Therefore, the search space size of the NAS-NHS constructed by the present invention is 4 20 , where NHS is the second harmony search algorithm and NAS is the neural architecture search.
[0130] Specifically, in this embodiment, see Figure 3 , the step S3 is specifically:
[0131] S31. Construct a hypernetwork search space through a lightweight neural convolutional network ShuffleNetV2. Specifically, various selection blocks are combined and arranged to form different blocks, and different blocks are stacked together to form a hypernetwork search space.
[0132] S32, using a single path mean sampling method to perform subnet training on the super network search space, determine the network hyperparameters, and train the subnet to search for the optimal network structure; determine the blocks that need spatial downsampling in the super network search space, and train those blocks composed of various selected blocks;
[0133] S33, using the second harmony search algorithm as the search strategy of the neural architecture search to search and verify the subnet, and judging whether the iteration termination condition is met, if so, outputting the optimal neural architecture search framework, otherwise, repeating steps S32-S33; the use of the second harmony search algorithm as the search strategy of the neural architecture search to search and verify the subnet is specifically as follows:
[0134] Initializing the harmony memory bank of the second harmony search algorithm using a subnet architecture;
[0135] The harmony memory is updated according to the accuracy value of the current subnet architecture, and the adaptive adjustment strategy of the fusion parameters is used to update HMCR, PAR and BW;
[0136] The optimized subnet architecture is compared with the initial subnet architecture, and the subnet architecture with the best accuracy is selected to update to the harmony memory library.
[0137] Specifically, in this embodiment, after step S3, it also includes: a performance test of the NAS-NHS algorithm, wherein NAS-NHS is a second harmony search algorithm for neural architecture search; a comparative test experiment is conducted on the NAS-NHS framework, the NAS-RS framework using a random search strategy, the NAS-GA framework using a GA search strategy, and the NAS-HS framework using a standard HS search strategy in terms of the obtained neural network accuracy and the computational time cost; the experiment is conducted on two data sets, CIFAR-10 and FashionMNIST, wherein the FashionMNIST data set consists of 10 types of clothing images such as clothes and shoes, with a total of 70,000 single-channel gray images, of which 60,000 are training images and 10,000 are test images, and the image size is 28×28; each category of images consists of 5,000 training images and 1,000 test images, respectively; wherein GA is a genetic algorithm;
[0138] The common hyperparameter settings for the architecture search and training phases are shown in Tables 2 and 3;
[0139] Table 2 Hyperparameter settings
[0140]
[0141]
[0142] Table 3 Parameter settings of the three algorithms
[0143]
[0144] The parameter settings of the three algorithms, GA, HS, and NHS, used in the NAS-NHS framework, NAS-GA framework, and NAS-HS framework are shown in Table 7;
[0145] The results of comparative experiments on the CIFAR-10 dataset and the FashionMNIST dataset are shown in Tables 4 and 5. In the table, Top-1acc represents the accuracy of the neural network obtained by the algorithm, and the computing time cost is measured in GPU-days. Specifically, GPU-days is calculated by multiplying the number of deployed GPU cards by the execution time of the algorithm.
[0146] Table 4 shows the comparison data on the CIFAR-10 dataset
[0147]
[0148] Table 5 shows the comparison data on the FashionMNIST dataset.
[0149]
[0150] As can be seen from Tables 4 and 5, on the CIFAR-10 dataset, the Top-1acc of NAS-NHS at different Batch_sizes is higher than that of the other three frameworks. When Batch_size is 96, the Top-1acc of all frameworks is higher than that of Batch_size 64. Although the number of neural network parameters obtained by the NAS-NHS framework is higher than that of the NAS-GA framework, its search time cost is greatly reduced, which is more in line with actual needs. On the FashionMNIST dataset, compared with the other three frameworks, the number of parameters of the neural network structure obtained by the NAS-NHS framework is smaller and the computational time cost is lower. On the CIFAR-10 dataset, the Top-1acc of the network architecture searched by NAS-NHS is 3.89%, 0.86% and 0.71% higher than that of NAS-RS, NAS-GA and NAS-HS respectively. On the FashionMNIST dataset, the search cost of NAS-NHS to obtain the optimal network architecture is 1.03 GPU-days and 0.08 GPU-days less than that of NAS-RS and NAS-GA respectively.
[0151] On the CIFAR-10 and FashionMNIST datasets, the Top-1acc distribution of the neural architectures obtained by NAS of the four frameworks at each epoch in the search phase is shown in Figure 2. Figure 4 It can be seen that on the CIFAR-10 dataset, the number of neural architectures Top-1acc searched by NAS-NHS that reach more than 90% is much higher than that of the other three frameworks; Figure 5-Figure 6 It can be seen that on the FashionMNIST dataset, the Top-1 acc value of the neural architecture searched by NAS-NHS exceeds 99% very often, which is significantly better than the other three search strategies; the Top-1 acc value change curves for 50 population individuals on the CIFAR-10 dataset and 15 population individuals on the FashionMNIST dataset are shown in Figure 2. Figure 7-Figure 8In the initial search phase, the Top-1acc value of the network architecture searched by NAS-NHS is not as good as that of NAS-GA and NAS-HS. As the number of iterations increases, the accuracy of the final network architecture obtained by NAS-NHS gradually reaches the highest, and the larger the batch_size, the higher the Top-1acc value; throughout the search phase, the accuracy of the network architecture searched by NAS-NHS is almost always the highest among the four frameworks;
[0152] In order to further verify the effectiveness of the NAS-NHS framework, NAS-NHS is compared with five other frameworks, namely, Network inNetwork, Highway Network, All-CNN, MetaQNN using reinforcement learning strategy, and Genetic CNN using evolution strategy, on the CIFAR-10 dataset. The experimental results are shown in Table 6.
[0153] Table 6 shows the comparison data of the six frameworks on the CIFAR-10 dataset
[0154]
[0155] According to Table 6, the Top-1acc of the neural architecture obtained by NAS-NHS is 2.08%, 1.03% and 0.52% higher than the traditionally designed Network, HighwayNetwork and All-CNN respectively, 0.19% higher than MetaQNN using reinforcement learning strategy, and 0.37% higher than Genetic CNN using evolution strategy. The performance of the neural architecture searched by NAS-NHS is the best; the time cost of NAS-NHS search is lower than MetaQNH using reinforcement learning strategy and Gentic CNN using evolution strategy.
[0156] In this embodiment, BiLSTM, as the core structure that affects the overall performance of the BERT-BiLSTM-CRF model, is a network that can effectively model the input sequence. It can not only capture the dependencies between words in the sequence, but also take into account the contextual information before and after, and can better understand the semantics and contextual information of words in the input sequence. In the BERT-BiLSTM-CRF model, the hyperparameters of BiLSTM include the number of hidden units, the number of layers, the Dropout rate, and the shared parameters between the loop layers. The impact of the number of hidden units and the number of layers on the model performance is mainly reflected in the model's representation ability, feature extraction ability, gradient propagation and disappearance, and computing time cost. Changes in the number of hidden units and the number of layers will affect the structure of BiLSTM in the model. Adding hidden units will increase the number of layers. The number of hidden units and layers can enable the model to better learn the complex features of the input data, thereby improving the model's representation ability. However, too many hidden units and layers may cause the model to overfit, thereby reducing the model's generalization ability. At the same time, more hidden units and layers also mean that more parameters need to be trained, which will increase the computational complexity of the model to a certain extent, and may also cause the problem of gradient vanishing or gradient exploding, ultimately affecting the training stability of the model. Therefore, in combination with the characteristics of different data sets, selecting a BiLSTM substructure with an appropriate number of hidden units can ensure the best balance of model performance. In order to automatically obtain the BiLSTM substructure with the best performance, it is necessary to perform neural architecture search and optimization processing on BiLSTM. Among them, BERT-BiLSTM-CRF is a deep learning model; see Fig.11 , the step S4 performs neural architecture search optimization on the deep learning model based on the second harmony search algorithm, specifically:
[0157] S411, constructing a search space of BiLSTM; wherein BiLSTM is a bidirectional long short-term memory network; the difference between each selection block in the search space is that the number of units and the number of layers of the hidden layer are set differently;
[0158] S412, determine the hyperparameters of the deep learning model, train the subnet to search for the optimal network architecture; during the training process, a set of values of the number of hidden units and the number of layers will be randomly selected each time to evaluate the accuracy of the model;
[0159] S413, using the second harmony search algorithm to perform optimal architecture search and verification; specifically:
[0160] Initialize the harmony memory library composed of different network structures, update the population according to the accuracy of the current neural architecture, generate new offspring individuals in the improvisation stage, obtain the optimized network architecture, and then compare the optimized network architecture with the initial network architecture to select the network architecture with the best performance;
[0161] S414: Determine whether the iteration termination condition is met. If so, output the historical optimal network architecture combination. Otherwise, execute steps S412-S414.
[0162] Specifically, in this embodiment, the hyperparameters include learning rate, number of hidden units, number of layers and maximum sequence length.
[0163] Specifically, in this embodiment, when designing a deep learning model for a specific application task, in order to achieve the optimal effect of model training, the hyperparameters of the model need to be adjusted; the hyperparameters that have an important impact on the training performance of the BERT-BiLSTM-CRF model include the learning rate, the number of hidden units, the number of layers, the maximum sequence length and other hyperparameters, among which the learning rate is used to control the step size of each parameter update of the model; the size of the learning rate will affect the convergence speed of the model, a smaller learning rate makes the parameter update amplitude smaller, resulting in a slower convergence speed of the model, while a larger learning rate will make the parameters move a longer distance each time they are updated, thereby accelerating the convergence speed of the model; at the same time, the size of the learning rate will also affect the stability of the training A too large learning rate may cause the model to oscillate during training, resulting in failure to converge to the optimal solution, while a too small learning rate may slow down the model convergence and may also lead to falling into a local optimal solution; therefore, the choice of learning rate has a very important impact on the accuracy, performance stability and generalization ability of the model; in order to further improve the overall performance of the model, the first harmony search algorithm is used to optimize the hyperparameters of the deep learning model, and the BERT-BiLSTM-CRF-NAS-HS model is constructed based on this, that is, a deep learning model with dual optimization of neural architecture search optimization and hyperparameter optimization is constructed; the step S4 performs hyperparameter optimization on the deep learning model based on the first harmony search algorithm, specifically:
[0164] S421, determining a performance evaluation index of the deep learning model, and using the performance evaluation index as a fitness function value of the first harmony search algorithm, and initializing parameters;
[0165] The performance evaluation indicators include precision P, recall R and F1 value;
[0166] The precision rate P indicates the proportion of samples predicted as positive to samples that are actually positive. It reflects the accuracy of the model in predicting positive samples and checks whether there are too many misjudgments. The precision rate is
[0167]
[0168] The recall rate R represents the proportion of samples that are actually positive, which are successfully predicted by the model as positive. The value reflects the degree of coverage of the model for positive categories and checks whether there are too many missed judgments. The recall rate is:
[0169]
[0170] Among them, TP represents the number of positive samples correctly predicted as positive samples, FP represents the number of negative samples predicted as positive samples, and FN represents the number of positive samples predicted as negative samples;
[0171] The F1 value of the model is the harmonic mean of the precision and recall, which comprehensively reflects the accuracy and coverage of the model. The coverage is:
[0172]
[0173] S422, initializing the harmony memory library of the first harmony search algorithm, and randomly generating N harmonies;
[0174] S423, generating a random number r', if the random number r'≥HMCR, randomly selecting a harmony vector from the search domain outside the harmony memory library; if the random number r'<HMCR, generating a random number r", if the random number r"<PAR, fine-tuning all the harmony vectors in the harmony memory library by using the sine-cosine optimization operator, and selecting the optimal harmony vector therefrom;
[0175] S424, updating the harmony memory library, and replacing the worst harmony vector in the harmony memory library with the newly generated harmony vector by comparing the fitness function value;
[0176] S425: Determine whether the iteration termination condition is met. If so, output the double-optimized deep learning model. Otherwise, repeat steps S423-S425.
[0177] Specifically, in this embodiment, after step S4, the following steps are further included:
[0178] Perform performance tests on the dual-optimized deep learning model; specifically:
[0179] Constructing a data set, and dividing the data set into a training set, a test set, and a validation set in proportion;
[0180] Each model is trained through the training set, each model is tested through the test set, and each model is verified through the validation set.
[0181] The double-optimized deep learning model was compared with the initial deep learning model, the deep learning model that only performed neural architecture search, and the deep learning model that only performed hyperparameter optimization.
[0182] The performance test of the present invention uses the original data in the Miao medicine named entity recognition data set to conduct a comparative test experiment on the recognition performance of the model. According to the Miao medicine knowledge-related content recorded in the books, the original data of 8 categories including Miao medicine name, main function, etc. are selected as the basis to produce the Miao medicine named entity recognition data set; after the original data is processed by BIO annotation, special symbols, spaces and line breaks are removed, and the final Miao medicine named entity recognition data set contains 139321 characters, 26270 entities, and 4581 sentences. During the experiment, the data set was divided into training set, test set and verification set in a ratio of 8:1:1; the hyperparameter settings of the model training and verification stages are shown in Table 7;
[0183] Table 7 Hyperparameter settings
[0184]
[0185] The double-optimized BERT-BiLSTM-CRF-NAS-HS model and the original BERT-BiLSTM-CRF model, the BERT-BiLSTM-CRF-NAS framework with only NAS optimization, and the BERT-BiLSTM-CRF-HS with only AHS-SC-LF hyperparameter optimization were compared on the Miao medicine named entity recognition dataset. The experimental results are shown in the figure. Fig.12 As shown in the figure, it can be seen that compared with the original BERT-BiLSTM-CRF model, although the BERT-BiLSTM-CRF-NAS model has a slightly lower precision than the BERT-BiLSTM-CRF model, it has advantages over the BERT-BiLSTM-CRF model in terms of recall rate and F1 value; compared with the original BERT-BiLSTM-CRF model, the BERT-BiLSTM-CRF-HS model has a significant improvement in precision, recall rate and F1 value over the BERT-BiLSTM-CRF model; -The accuracy, recall and F1 value of the CRF model are 92.52%, 93.43% and 92.97% respectively, while the accuracy, recall and F1 value of the BERT-BiLSTM-CRF-NAS-HS model are 95.45%, 96.39% and 95.92% respectively; it can be seen that the BERT-BiLSTM-CRF-NAS-HS model, which uses NAS-NHS to optimize the BiLSTM architecture and AHS-SC-LF to optimize the learning rate, has significant advantages over the other three models in terms of accuracy, recall and F1 value;
[0186] In order to further illustrate the recognition effect of the BERT-BiLSTM-CRF-NAS-HS model on the Miao medicine named entity recognition dataset, Table 8 shows the comparison results of the recognition of entities of various categories before and after the optimization of the BERT-BiLSTM-CRF model;
[0187] Table 8 Comparative data on the recognition effects of named entities of different categories of Miao medicine
[0188]
[0189]
[0190] As can be seen from Table 8, compared with the BERT-BiLSTM-CRF model, the F1 values of Miao, Disaster and Doses entity categories with more than 3000 entities on the BERT-BiLSTM-CRF-NAS-HS model increased by 2.11%, 2% and 2.34% respectively. However, for the Pro entity category with less than 3000 entities, the F1 value of the BERT-BiLSTM-CRF-NAS-HS model increased by 16.4% compared with the BERT-BiLSTM-CRF model. This shows that BERT-BiLSTM-CRF-NAS-HS has a better recognition effect on Miao medicine named entities with a small number of entities.
[0191] In order to verify the convergence performance of the BERT-BiLSTM-CRF-NAS-HS model, Figure 13-Figure 15 The change curves of precision P, recall R and F1 value of the four models are given respectively when the algorithm is iterated for 20 times; Figure 13-Figure 15 It can be seen that: in the early stage of iteration, the precision P, recall R and F1 value of the BERT-BiLSTM-CRF-NAS-HS model and the BERT-BiLSTM-CRF-NAS framework are higher than those of the BERT-BiLSTM-CRF model and the BERT-BiLSTM-CRF-HS model. This shows that after using NAS to optimize the BiLSTM network architecture, a network model with better recognition performance can be obtained more quickly. In the later stage of algorithm iteration, the convergence accuracy of the BERT-BiLSTM-CRF-NAS-HS model is higher than that of the other three models. This shows that the convergence performance of the model after NAS optimization and hyperparameter optimization using the improved HS algorithm has been significantly improved.
[0192] Specifically, in this embodiment, the HS algorithm is a meta-heuristic intelligent optimization algorithm that simulates the process of musicians repeatedly adjusting the tones of various instruments by relying on their own memory when a band performs, and finally reaches a beautiful harmony state. The principle is simple, easy to implement, and can be used to solve complex optimization problems in different fields; however, the standard HS algorithm has the disadvantages of slow convergence speed, low optimization accuracy, and poor global search ability; based on the analysis of the improvement strategy of the HS algorithm principle and its variant algorithm, the present invention aims to overcome the above-mentioned disadvantages, firstly proposes a parameter dynamic adjustment adaptive HS algorithm combining a sine-cosine optimization operator and a Levy flight mechanism, namely, a first harmony search algorithm, and verifies the performance of the improved algorithm through a function optimization test experiment; then, in combination with the characteristics of NAS, by adjusting the first harmony search algorithm, a second harmony search algorithm for solving the neural network architecture search optimization problem is proposed, and it is used as the search strategy of the NAS framework, and then by selecting the shuffleNetV2 lightweight CNN network to construct a super network search space, and using the single-path uniform sampling method to train the subnet of the search space, a second harmony search algorithm is constructed accordingly. The NAS-NHS framework based on the NHS algorithm is verified through performance comparison tests between the NAS-NHS framework and the traditional manually designed NAS framework and the NAS framework using reinforcement learning strategy and evolutionary strategy. It is verified that the NAS-NHS framework can indeed automatically obtain a neural network architecture with high accuracy, low time cost and low computing resource consumption, thus proving the priority of the improved HS algorithm as a NAS search strategy. Finally, the optimized first harmony search algorithm and second harmony search algorithm are further applied to deep learning model optimization. First, the mainstream sequence labeling model based on the BERT-BiLSTM-CRF structure is selected as the object to be optimized, and the BiLSTM in the model is selected to construct the search space. Different numbers of hidden layer units and layers are used as candidates for the neural architecture. The proposed NAS-NHS algorithm is used to search and optimize the candidates to obtain the optimal neural architecture. Then, AHS-SC-LF is used to optimize the learning rate hyperparameters of the BERT-BiLSTM-CRF model, and then a BERT-BiLSTM-CRF-NAS-HS model with dual optimization effects is constructed. Finally, the BERT-BiLSTM-CRF-NAS-HS model was applied to Miao medicine named entity recognition. With the help of a self-made Miao medicine named entity recognition dataset, a comparative experiment was carried out with other BERT-BiLSTM-CRF models. It was verified that the BERT-BiLSTM-CRF-NAS-HS model can indeed efficiently recognize Miao medicine named entities, thus proving the feasibility and effectiveness of the improved HS algorithm for NAS optimization and hyperparameter optimization of deep learning models.
[0193] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. All equivalent structural changes made using the contents of the present invention's specification and drawings, or directly / indirectly applied in other related technical fields, are included in the patent protection scope of the present invention.
Claims
1. A method for optimizing and verifying a deep learning model in Miao medicine named entity recognition, characterized in that: The following steps are involved: S1. By using the sine-cosine optimization operator and the Levy flight mechanism and integrating the parameter adaptive adjustment strategy, the harmony search algorithm is optimized once to obtain the first harmony search algorithm; S2, performing secondary optimization on the first harmony search algorithm to obtain a second harmony search algorithm; S3. Use the second harmony search algorithm as the search strategy for neural architecture search and build a neural architecture search framework based on the second harmony search algorithm; specifically: S31. Construct a hypernetwork search space through a lightweight neural convolutional network ShuffleNetV2. Specifically, various selection blocks are combined and arranged to form different blocks, and different blocks are stacked together to form a hypernetwork search space. S32, using a single path mean sampling method to perform subnet training on the super network search space, determine the network hyperparameters, and train the subnet to search for the optimal network structure; determine the blocks that need spatial downsampling in the super network search space, and train those blocks composed of various selected blocks; S33, using the second harmony search algorithm as the search strategy of the neural architecture search to search and verify the subnet, and determine whether the iteration termination condition is met. If so, output the optimal neural architecture search framework, otherwise, repeat steps S32-S33; After step S3, the method further includes: performing a performance test on the neural architecture search framework: specifically, using the CIFAR-10 dataset and the FashionMNIST dataset, wherein the FashionMNIST dataset consists of 10 types of clothing images, including clothes and shoes, with a total of 70,000 single-channel gray images, including 60,000 training images and 10,000 test images, and performing a comparative test experiment on the neural architecture search framework with the NAS framework using a random search strategy, the NAS-GA framework using a GA search strategy, and the NAS-HS framework using a practical standard HS search strategy, to detect the neural network accuracy and computational time cost of the neural architecture search framework; S4. Build a deep learning model, perform neural architecture search optimization on the deep learning model based on the second harmony search algorithm, and perform hyperparameter optimization on the deep learning model based on the first harmony search algorithm to obtain a dual-optimized deep learning model; the dual-optimized deep learning model is a BERT-BiLSTM-CRF-NAS-HS model; The step S4 performs neural architecture search optimization on the deep learning model based on the second harmony search algorithm, specifically: S411, constructing a search space of BiLSTM; wherein BiLSTM is a bidirectional long short-term memory network; the difference between each selection block in the search space is that the number of units and the number of layers of the hidden layer are set differently; the number of units and the number of layers of the hidden layer affect the representation ability, feature extraction ability, gradient propagation and disappearance, and calculation time cost of the model; S412, determine the hyperparameters of the deep learning model, train the subnet to search for the optimal network architecture; during the training process, a set of values of the number of hidden units and the number of layers will be randomly selected each time to evaluate the accuracy of the model; S413, using the second harmony search algorithm to perform optimal architecture search and verification; S414, determine whether the iteration termination condition is met, if so, output the historical optimal network architecture combination, otherwise, execute steps S412-S414; After step S4, the method further includes: using a Miao medicine named entity recognition dataset to perform a performance test on the double-optimized deep learning model; specifically: Construct a Miao medicine named entity recognition dataset, and divide the Miao medicine named entity recognition dataset into a training set, a test set, and a validation set in proportion; specifically: the Miao medicine named entity recognition dataset is based on original data including 8 categories of Miao medicine names and main functions, and the original data is processed by BIO annotation, special symbols, spaces, and line breaks are removed to finally obtain the Miao medicine named entity recognition dataset, including several characters, entities, and sentences. The Miao medicine named entity recognition dataset is divided into a training set, a test set, and a validation set in a ratio of 8:1:1, and the hyperparameters of the model training and validation stages are set Each model is trained through the training set, each model is tested through the test set, and each model is verified through the validation set. The deep learning model after dual optimization was compared with the initial deep learning model, the deep learning model that only performed neural architecture search, and the deep learning model that only performed hyperparameter optimization.
2. The method for optimizing and verifying a deep learning model in Miao medicine named entity recognition according to claim 1, characterized in that: The step S1 is specifically: S11, define the optimization problem, and initialize the parameters and harmony memory library; S12, generate a random number r1, if the random number r1 ≥ HMCR, according to X i,j = L + (UL) × rand, randomly select a harmony vector from the search domain outside the harmony memory as X new ; If the random number r1 < HMCR, then generate a random number r2. If r2 < PAR, fine-tune all the harmony vectors in the harmony memory library through the sine-cosine optimization operator and select the best one as X. new ; Among them, HMCR is the probability of harmony memory library value, X i,j is a randomly selected harmony vector, L is the lower boundary of the search domain, U is the upper boundary of the search domain, rand is a random number between (0,1), and PAR is the probability of fine-tuning the harmony variable; S13, update the harmony memory library, and set the harmony vector X new The fitness value is better than the worst harmony vector X of the initial harmony memory library worst If the fitness value is , the replacement is performed; otherwise, the fine-tuning bandwidth is updated according to the Levy flight mechanism, and the search domain is updated through the parameter adaptive adjustment strategy, and the process returns to step S12; S14, determine whether the maximum number of iterations has been reached, if so, output the global optimal solution to obtain the first harmony search algorithm after optimization; otherwise, update HMCR and PAR through the parameter adaptive adjustment strategy, and return to step S12.
3. A method for optimizing and verifying a deep learning model in Miao medicine named entity recognition according to any one of claims 1 to 2, characterized in that: The step S2 is specifically: S21, setting the number of iterations, and adaptively adjusting the HMCR and PAR of the first harmony search algorithm according to the number of iterations; wherein HMCR is the probability of taking values from the harmony memory library, and PAR is the probability of fine-tuning the harmony variables; S22. The bandwidth is fine-tuned by a second update through the Levy flight mechanism to obtain a second harmony search algorithm.
4. A method for optimizing and verifying a deep learning model in Miao medicine named entity recognition according to any one of claims 1 to 2, characterized in that: The step S33 uses the second harmony search algorithm as the search strategy of the neural architecture search to search and verify the subnet, specifically: Initializing the harmony memory bank of the second harmony search algorithm using a subnet architecture; The harmony memory is updated according to the accuracy value of the current subnet architecture, and the adaptive adjustment strategy of the fusion parameters is used to update HMCR, PAR and BW; HMCR is the probability of taking values in the harmony memory, PAR is the probability of fine-tuning the harmony variables, and BW is the fine-tuning bandwidth; The optimized subnet architecture is compared with the initial subnet architecture, and the subnet architecture with the best accuracy is selected to update to the harmony memory library.
5. The method for optimizing and verifying a deep learning model in Miao medicine named entity recognition according to claim 4, characterized in that: The fusion parameter adaptive adjustment strategy updates HMCR, PAR and BW, specifically: The HMCR is: The PAR is: The BW is: Among them, t is the current iteration number, T max is the maximum number of iterations, is the current individual position, α is a constant coefficient, which is 0.001, and s is the Levy flight random step.
6. A method for optimizing and verifying a deep learning model in Miao medicine named entity recognition according to any one of claims 1-2, characterized in that: The step S4 performs neural architecture search optimization on the deep learning model based on the second harmony search algorithm, specifically: S411. Construct a search space of BiLSTM; wherein BiLSTM is a bidirectional long short-term memory network; S412, determine the hyperparameters of the deep learning model, and train the subnet to search for the optimal network architecture; S413, using the second harmony search algorithm to perform optimal architecture search and verification; specifically: Initialize the harmony memory library composed of different network structures, update the population according to the accuracy of the current neural architecture, generate new offspring individuals in the improvisation stage, obtain the optimized network architecture, and then compare the optimized network architecture with the initial network architecture to select the network architecture with the best performance; S414: Determine whether the iteration termination condition is met. If so, output the historical optimal network architecture combination. Otherwise, execute steps S412-S414.
7. A method for optimizing and verifying a deep learning model in Miao medicine named entity recognition according to any one of claims 1-2, characterized in that: The hyperparameters include learning rate, number of hidden units, number of layers, and maximum sequence length.
8. A method for optimizing and verifying a deep learning model in Miao medicine named entity recognition according to any one of claims 1-2, characterized in that: The step S4 performs hyperparameter optimization on the deep learning model based on the first harmony search algorithm, specifically: S421, determining a performance evaluation index of the deep learning model, and using the performance evaluation index as a fitness function value of the first harmony search algorithm, and initializing parameters; The performance evaluation indicators include precision P, recall R and F1 value; S422, initializing a harmony memory of a first harmony search algorithm, and randomly generating N harmonies; wherein N is the size of the harmony memory; S423, generating a random number r', if the random number r'≥HMCR, randomly selecting a harmony vector from the search domain outside the harmony memory library; if the random number r'<HMCR, generating a random number r", if the random number r"<PAR, fine-tuning all the harmony vectors in the harmony memory library through the sine-cosine optimization operator, and selecting the optimal harmony vector therefrom, wherein HMCR is the probability of taking values in the harmony memory library, and PAR is the probability of fine-tuning the harmony variable; S424, updating the harmony memory library, and replacing the worst harmony vector in the harmony memory library with the newly generated harmony vector by comparing the fitness function value; S425: Determine whether the iteration termination condition is met. If so, output the double-optimized deep learning model. Otherwise, repeat steps S423-S425.
Citation Information
Patent Citations
A wavelet neural network short-term load prediction method based on improved harmony search optimization
CN108985523A
Model processing method and device
CN115563238A