Classification neural network training method and target classification method
Through the improved multi-objective optimization method, the problem of local optimization and insufficient diversity in neural network parameter search is solved through the improved multi-objective optimization method, and more efficient neural network training and optimization is achieved.
Patent Information
- Application Number
- CN202411965074.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-04-25
AI Technical Summary
The method based on the reduction of decision space is prone to falling into local optimality in the search process of the optimal structural parameters of neural networks, and lacks diversity, which makes it difficult to effectively improve the accuracy of neural networks and reduce the loss function value.
An improved multi-objective optimization method is proposed. By initializing the population and using existing evolutionary algorithms to search in the original solution space, combining double cluster selection and power value transformation functions for problem conversion and weight optimization, the number of evaluations is dynamically adjusted to improve the utilization efficiency of computing resources.
It significantly improves the accuracy of the neural network, reduces the loss function value, reduces the complexity of the model, and thus improves the accuracy and efficiency of classification.
Smart Images

Figure CN119886264A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a training method for a classification neural network and a target classification method, and belongs to the technical field of artificial intelligence and computer science. Background Art
[0002] Neural networks are an important model in machine learning and are widely used in fields such as image recognition and natural language processing. There are multiple optimization objectives in the neural network training process, such as minimizing the loss function, maximizing the generalization ability, and minimizing the model complexity. Complex neural network training problems can also be viewed as large-scale multi-objective optimization problems (LSMOPs). Multi-objective evolutionary algorithms (MOEAs) are an effective solution to obtain the optimal configuration of neural networks. They use population evolution to save the population of potential optimal solutions in each generation to achieve the global optimum. By using this population-to-population strategy, the Pareto optimal solution set of multi-objective optimization problems can be found.
[0003] Traditional multi-objective evolutionary algorithms (MOEAs) have difficulty in effectively utilizing the search space when solving large-scale multi-objective optimization problems, which may lead to premature convergence to the local optimum or the convergence area is too large. In recent years, MOEAs for LSMOPs have been continuously proposed, and the existing literature can be divided into three categories: methods based on decision variable grouping, methods based on decision space reduction, and methods based on novel search strategies. The methods based on decision variable grouping use a grouping mechanism to group decision variables, and then optimize the decision variables in each group independently; the methods based on decision space reduction convert the original large-scale optimization problem into a small-scale one, and then directly optimize the converted problem, which greatly reduces the difficulty of solving the problem; the novel search strategy uses novel operators or probability models to search the entire decision space, without having to deal with complex decision space operations, and maintains a simple process and balanced performance on different LSMOPs.
[0004] Among them, the multi-objective evolutionary algorithm based on decision space reduction can achieve fast convergence while using fewer computing resources and can be applied to the training optimization of neural networks. However, since the converted problem is prone to fall into local optimality in a smaller weight space, it is easy to lose high-quality solutions, which limits the search for optimal parameters of the neural network. Summary of the invention
[0005] In order to solve the problem that the method based on decision space reduction is easy to fall into local optimum and lacks diversity in the process of searching for optimal structural parameters of neural network, improve the accuracy of target classification neural network, reduce the loss function value and reduce the complexity of the model, the present invention provides a training method for classification neural network and a target classification method, and the technical scheme is as follows:
[0006] The present invention provides a training method for a classification neural network, wherein the method takes minimizing model error and model complexity as a multi-objective optimization task to obtain an optimal neural network structure and parameters, and comprises the following steps:
[0007] Step 1: Initialize the population to form the original solution space. Each individual in the population represents a specific neural network configuration.
[0008] Step 2: Use the target classification data set to train a neural network for each individual in the population, evaluate the model error through the loss function, and evaluate the model complexity using the total number of model parameters;
[0009] Step 3: With the goal of minimizing the model error and model complexity, the existing evolutionary algorithm A is used to search in the original solution space, and t1 fitness evaluations are performed, and the local optimal solution obtained from each search is saved in the population P;
[0010] Step 4: Use bicluster selection to select j reference solutions {x1,…,x j};
[0011] Step 5: Group the decision variables of the reference solution, and use the weight variables to transform the problem in each group. The transformation formula is:
[0012]
[0013] Among them, w k represents the weight value of the kth group, x i,old represents the decision variable before transformation, x i,new represents the converted decision variable, min weight represents the minimum weight value, max weight represents the maximum weight value, and p represents the hyperparameter;
[0014] For the converted problem, an original weight solution space is randomly created, and the existing evolutionary algorithm A is used to search the original weight solution space. After t2 fitness evaluations are performed, the local optimal solution obtained from each search is saved in the population W'; the resulting weight population of this low-dimensional optimization step optimizes the objective function based on the reference solution value originally selected.
[0015] For the j reference solutions {x1,…,x j} are all transformed into problems and weights are optimized to obtain a new weight population W that merges j weight populations;
[0016] Step 6: Based on the population P and the population W, an updated population P' is obtained (the weighted population W and the original problem optimization result population P are updated together. The update operation is implemented by crowding distance and non-dominated sorting, while removing duplicate individuals and retaining individuals with better quality), and steps 3 to 5 are repeated until the preset number of evaluations is used up;
[0017] Step 7: In the final optimized population, find the individual with the minimum training error, that is, the weight and bias of the optimal neural network model;
[0018] The calculation formula for fitness evaluation times t1 and t2 is:
[0019]
[0020] Among them, R represents the ratio of the current number of evaluations to the total number of evaluations; the hyperparameter k1 represents the growth rate of the function when R approaches r1, r1 represents the inflection point in the function, before the inflection point is the population exploration stage, and after the inflection point is the population development stage; the hyperparameter k2 controls the growth rate of the function when R approaches r2, r2 represents the inflection point in the function, before the inflection point is the population exploration stage, and after the inflection point is the population development stage.
[0021] Optionally, step 4 includes:
[0022] Step 41: Standardize the decision variables in the population to obtain a standardized population;
[0023] Step 42: Hierarchical clustering;
[0024] Initially, each individual in the standardized population is regarded as a cluster and a centroid, and the cluster set C = {C1, C2, ..., C n} and centroid set, calculate the distance between any two clusters, merge the two clusters with the smallest distance into a new cluster, and update the clusters and their centroids. The cycle continues until the number of clusters is reduced to the preset target;
[0025] Step 43: Partition clustering;
[0026] The centroid obtained by the hierarchical clustering process is used as the initial centroid, the distance from each individual to each centroid is calculated, and then the individual is classified into the cluster with the smallest distance; the process is repeated until all individuals are divided into corresponding clusters;
[0027] Then recalculate the centroid and use the new centroid to redistribute individuals, repeating this step until the centroid no longer changes or the preset maximum number of iterations is reached;
[0028] Finally, the individual closest to the centroid in each cluster is selected as the final reference solution.
[0029] Optionally, the existing evolutionary algorithm A adopts SMPSO algorithm.
[0030] Optionally, the step 42 adopts Ward hierarchical clustering method.
[0031] Optionally, in step 7, k1 is 10 and r1 is 0.5.
[0032] Optionally, in step 7, k2 is 12 and r2 is 0.4.
[0033] Optionally, the hyperparameter p can be set to 2.
[0034] The present invention provides a target classification method, which adopts any of the methods described above to train a classification neural network, and then uses the classification neural network to classify target data, wherein the target data includes: structured data, time series data, signal data and financial risk data.
[0035] The present invention provides an electronic device, characterized in that it includes a memory and a processor;
[0036] The memory is used to store computer programs;
[0037] The processor is configured to implement any of the methods described above when executing the computer program.
[0038] The present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the method described in any one of the above items is implemented.
[0039] The beneficial effects of the present invention are:
[0040] In view of the problem of parameter optimization of classification neural network, the present invention proposes an improved multi-objective optimization method, including the following contents:
[0041] Firstly, the existing evolutionary algorithm is used to search in the original solution space to obtain the initial optimization population. By using mature evolutionary algorithms, high-quality solutions can be quickly generated in the initial stage, providing a good starting point for subsequent optimization, significantly improving the efficiency of optimization and reducing the search time. Then, the appropriate reference solutions in the initial optimization population are selected through the double clustering method to maintain the diversity of the optimization process population. The highly diverse reference solutions can guide the optimization process to explore different areas and avoid falling into the local optimal solution. The selection of diverse reference solutions can ensure the globality and robustness of the optimization process, thereby improving the quality of the final solution.
[0042] In the problem conversion link, the present invention proposes a power value conversion function. This nonlinear conversion function can perform more flexible searches in the solution space, can better adapt to complex optimization problems and discover more potential high-quality solutions, which significantly improves the search capability of the multi-objective optimization method and the quality of the final solution.
[0043] In response to the problem of computing resource allocation, this paper proposes a mechanism for adaptively allocating the number of evaluations, which can dynamically adjust the parameters of the evaluation function according to the current optimization state to ensure that computing resources are reasonably allocated to the most promising solutions. This dynamic adjustment mechanism can significantly improve the efficiency of the optimization process, reduce unnecessary computing overhead, and thus accelerate convergence.
[0044] Experimental results show that the classification neural network parameters obtained by the above multi-objective optimization method can effectively improve the accuracy of the neural network, reduce the loss function value, reduce the complexity of the model, and further improve the accuracy and efficiency of classification compared with the existing methods. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, 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 these drawings without creative work.
[0046] Figure 1 The figure is an overall flow chart of the training method of the classification neural network of the present invention.
[0047] Figure 2 The hierarchical clustering steps in the example diagram are performed for the double clustering method described in one embodiment of the present invention.
[0048] Figure 3 The partition clustering step in the example diagram is performed by the double clustering method described in one embodiment of the present invention. DETAILED DESCRIPTION
[0049] In order to make the objectives, technical solutions and advantages of the present invention more clear, the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.
[0050] Embodiment 1:
[0051] This embodiment provides a classification neural network training method, which takes minimizing model error and model complexity as a multi-objective optimization task to obtain the optimal neural network structure and parameters, including the following steps:
[0052] Step 1: Initialize the population to form the original solution space. Each individual in the population represents a specific neural network configuration.
[0053] Step 2: Use the target classification data set to train a neural network for each individual in the population, evaluate the model error through the loss function, and evaluate the model complexity using the total number of model parameters;
[0054] Step 3: With the goal of minimizing the model error and model complexity, the existing evolutionary algorithm A is used to search in the original solution space, and t1 fitness evaluations are performed, and the local optimal solution obtained from each search is saved in the population P;
[0055] Step 4: Use bicluster selection to select j reference solutions {x1,…,x j};
[0056] Step 5: Group the decision variables of the reference solution, and use the weight variables to transform the problem in each group. The transformation formula is:
[0057]
[0058] Among them, w k represents the weight value of the kth group, x i,old represents the decision variable before transformation, x i,new represents the converted decision variable, min weight represents the minimum weight value, max weight represents the maximum weight value, and p represents the hyperparameter;
[0059] For the converted problem, an original weight solution space is randomly created, the existing evolutionary algorithm A is used to search in the original weight solution space, and t2 fitness evaluations are performed, and the local optimal solution obtained from each search is saved in the population W';
[0060] For the j reference solutions {x1,…,x j} are all transformed into problems and weights are optimized to obtain a new weight population W that merges j weight populations;
[0061] Step 6: Based on population P and population W, an updated population P is obtained, and steps 3 to 5 are repeated until the preset number of evaluations is used up;
[0062] Step 7: In the final optimized population, find the individual with the minimum training error, that is, the weight and bias of the optimal neural network model;
[0063] The calculation formula for fitness evaluation times t1 and t2 is:
[0064]
[0065] Among them, R represents the ratio of the current number of evaluations to the total number of evaluations; the hyperparameter k1 represents the growth rate of the function when R approaches r1, r1 represents the inflection point in the function, before the inflection point is the population exploration stage, and after the inflection point is the population development stage; the hyperparameter k2 controls the growth rate of the function when R approaches r2, r2 represents the inflection point in the function, before the inflection point is the population exploration stage, and after the inflection point is the population development stage.
[0066] Embodiment 2:
[0067] This embodiment provides a neural network training method for credit assessment classification, and the method described in the first embodiment is used to train the neural network.
[0068] 1. Dataset Description and Problem Description
[0069] The neural network of this embodiment is used to implement credit assessment, with the goal of obtaining a neural network structure that strikes a balance between accuracy and computational cost by minimizing model error and model complexity.
[0070] The credit assessment dataset used in this embodiment comes from the Statlog Australian dataset in the UCI machine learning library. The dataset contains 690 samples, each with 14 features and is divided into two categories (approved and rejected). The goal of the model is to predict whether a credit application will be approved. Two indicators are minimized simultaneously in neural network training: model error (calculated by the cross entropy loss function) and model complexity (measured by the number of parameters of the neural network).
[0071] 2. Training method steps
[0072] This embodiment uses model error and model complexity as multi-objective optimization tasks to optimize the structure and parameters of the neural network, and mainly includes the following steps:
[0073] Step 1: Initialize the population.
[0074] Initialize a population of 100 individual neural network architectures, each of which represents a specific network configuration, including the number of network layers, the number of nodes in each layer, and the connection method of each node. Take each individual in the initial population as a candidate solution, and build a multi-layer perceptron (MLP) neural network. The output layer is a binary classification node that outputs the probability of approval or rejection.
[0075] Step 2: Fitness calculation.
[0076] A neural network is trained for each individual in the population, using the training set in the dataset and evaluating the model error through the cross entropy loss function. The model complexity of each individual is calculated, expressed as the total number of parameters of the model (i.e., the combination of the number of network layers and the number of nodes and the number of connections). Two goals are set: f1 is to minimize the model error, and f2 is to minimize the model complexity.
[0077] Step 3: Use the existing evolutionary algorithm SMPSO for optimization, search for solutions in the original solution space, and use the fitness evaluation times of t1=1000; the search of the original space can maintain the diversity of the population.
[0078] Step 4: Select a reference solution in the current population.
[0079] The reference solution is selected using the double clustering selection method designed in this embodiment. The specific process is as follows:
[0080] Step 41: Standardize the decision variables of the input population.
[0081] For a population S = {x1, x2, ..., x n}, the decision variables of each individual are standardized as follows:
[0082]
[0083] in, represents the i-th decision variable of the j-th individual in the population, S i min and S i max are the minimum and maximum values of the i-th decision variable in the population, respectively. Perform the above operations on the decision variables of all individuals to obtain the standardized population S'.
[0084] Step 42: Hierarchical clustering.
[0085] Initially, each individual is regarded as a cluster and a centroid, and the cluster set C = {C1, C2, ..., C n} and the centroid set c={c1,c2,…,c n In the main loop of hierarchical clustering, the distance between any two clusters needs to be calculated, the two clusters with the smallest distance are merged into a new cluster, and the clusters and their centroids are updated. The loop continues until the number of clusters is reduced to the preset target. This embodiment uses the Ward method to calculate the distance between clusters, where the calculation of C l and C m The distance between them is:
[0086]
[0087] Among them, ‖cl -c m ‖ 2 is the centroid c l and c m The squared Euclidean distance between l ∣ and ∣C m ∣ are clusters C l and C m Calculate and save the distances between all clusters and find the cluster pair with the smallest distance. l and C m The distance between them is the smallest, so they are merged into a new cluster C. a , and calculate the new centroid using the following formula:
[0088]
[0089] Among them, c i a Represents cluster C a The centroid in the i-th dimension, |C a ∣ is cluster C a The number of individuals in x i j Represents cluster C a The value of the jth individual in the i-th dimension. Use this formula to calculate C a All dimensions of a The updated clusters and centroids will replace the original clusters.
[0090] As the cyclic cluster merging proceeds, the number of clusters gradually decreases until it reaches a preset number of clusters.
[0091] Step 43: Partition clustering.
[0092] Partition clustering uses the centroid of the hierarchical clustering result as the initial centroid, and then calculates the distance from each individual to the centroid. The main loop of partition clustering contains two sub-loops, which respectively implement individual clustering and calculation of new centroids. In the clustering process, the distance from the individual to the centroid of each cluster is first calculated, and then it is assigned to the cluster with the smallest distance. For the centroid c l and the current individual x j , the allocation based on the minimum distance can be completed by the following formula:
[0093]
[0094] Where p is the number of decision variables, x i j For individual x j The value of the i-th variable, is the centroid c lThe i-th variable value of . Use the above formula to calculate x j The distance to all centroids is then divided into corresponding clusters by the minimum distance.
[0095] Repeat this process until all individuals are classified into corresponding clusters. Then recalculate the centroid and use the new centroid to redistribute individuals. Repeat this step until the centroid no longer changes or reaches the preset maximum number of iterations. In this embodiment, the maximum number of iterations is set to 100.
[0096] Finally, by calculating the distance from the individual in each cluster to the centroid, the individual closest to the centroid is selected and used as the final reference solution.
[0097] Step 5: Problem transformation and new solution generation, achieving weight optimization in the inner loop.
[0098] First, use a simple grouping method to group the decision variables for each reference solution, and then use the conversion function to convert the problem based on the grouping result. The problem conversion here uses the power value conversion method to obtain the converted problem. For each converted problem, a solution (weight) population is randomly created, and then the optimization algorithm SMPSO is used to optimize the population. The result weight population of this low-dimensional optimization step optimizes the objective function based on the originally selected reference solution value. The specific steps are as follows:
[0099] Step 51: Grouping;
[0100] All decision variables are grouped, and the number of groups corresponds to the target number of the problem. Grouping can be done in a variety of ways, such as simple random grouping, sequential grouping, or differential grouping based on coupling relationships. This embodiment uses a sequential grouping method.
[0101] Step 52: Problem transformation;
[0102] In each group, a weight variable is used to replace the decision variable in the group for optimization. This process generates r weight variables and is completed based on the original problem Z, the selected reference solution and the problem transformation mechanism tf, and finally the transformed problem is obtained.
[0103] Therefore, before the transformation, the variables are divided into r groups, each group is called G1,…,G r ,g(x i )=G j indicates that variables are assigned to groups using the grouping mechanism g. Assume that w k It is the corresponding weight value used for problem transformation in the group. For given variables and weight values, new variables can be obtained by transformation using the following formula.
[0104]
[0105] In the formula, w k ∈ [0, 2]. By performing a power exponent transformation on x i,old to obtain a new transformed value. The power is obtained by normalizing the weight variable w j and then multiplying it by a hyperparameter p. The amplitude of the power exponent transformation is affected by the value of p. When p > 1, the transformation makes the smaller values of the original data even smaller and the larger values even larger, thus expanding the search space and making the search range wider; when 0 < p < 1, the transformation makes the smaller values of the original data larger and the larger values smaller, thus shrinking the search space and making the search range narrower. In this embodiment, the value of p is 2.
[0106] Step 53: Weight optimization.
[0107] Randomly create an original weight solution space for the transformed problem, use the optimization algorithm SMPSO to search in the original weight solution space, perform 800 fitness evaluations, and save the local optimal solution obtained in each search in the population W'.
[0108] Group, problem transform, and weight optimize for each of the j reference solutions {x1,..., x j} to obtain a new weight population W that combines the j weight populations.
[0109] Step 6: Use an adaptive evaluation function to achieve more reasonable computational resource allocation.
[0110] The adaptive evaluation function dynamically adjusts the computational resource allocation for each generation by monitoring the evolutionary state of the current population to improve the computational efficiency of the algorithm. This mechanism allows for flexible allocation of computational resources and preferentially evaluates potentially better solutions. This resource allocation method ensures the effective use of computational resources and accelerates the convergence process. The expression of the adaptive evaluation function is as follows:
[0111]
[0112] The stage of population evolution is judged by the number of evaluations, that is, the ratio R of the currently used number of evaluations to the total number of evaluations.
[0113] The number of evaluations t1 for the original problem optimization includes three parts: constant term, coefficient and modified sigmoid function. The constant term and coefficient values are 1000 and 500, respectively, to achieve the change of the number of evaluations for the original problem optimization from 1000 to 1500. At the same time, the parameter k1 is used to control the growth rate of the function when R approaches r1. r1 can be regarded as the inflection point in the function. Before the inflection point is the population exploration stage, and after the inflection point is the population development stage. In this embodiment, k1 is set to 10 and r1 is set to 0.5 to achieve a rapid change in the number of evaluations in the middle stage of population evolution. Similarly, the number of weight optimization evaluations t2 is 800 at the beginning, and gradually decreases to 500 as the evolution proceeds. The hyperparameter k2 can also be used to adjust the change process. In this embodiment, k2 is set to 12 and r2 is set to 0.4 to achieve a rapid change in the number of evaluations when the population evolves to 40% of the total number of evaluations.
[0114] Step 7: Environment selection completes population update.
[0115] Based on population P and population W, the updated population P' is obtained, and the generated new solutions and the original population are subjected to environmental selection. In the environmental selection process, solutions are screened according to their diversity and fitness values, and solutions with rich diversity are retained. Non-dominated sorting and crowding distance strategies are used to further screen solutions to form the next generation of populations, ensuring the Pareto optimality of the final solution set.
[0116] The method of combining non-dominated sorting and crowding distance is used to select the most suitable individuals from the population to enter the next generation. This process can ensure that the population searches in the direction of the optimal or approximately optimal solution while maintaining population diversity. First, non-dominated sorting is performed. If solution x is better than solution y in at least one objective and is not worse than y in other objectives, then x dominates y. Mathematically, it can be expressed as:
[0117]
[0118] Where M is the number of targets, f m (x) represents the mth objective value of solution x. Sorting process: All solutions are sorted according to their objective values. The solutions are divided into layers by comparing the dominance relationship of each solution with other solutions. The first layer (first front) contains all non-dominated solutions, that is, solutions that are not dominated by other solutions. After removing these solutions from the first front, the same process is performed on the remaining solutions to find the second layer of non-dominated solutions, and so on, until all solutions are assigned to a front. The solutions on each front are non-dominated, but the solutions on each front are dominated by the solutions on other fronts.
[0119] On the basis of non-dominated sorting, in order to ensure the diversity of the population, the present invention uses crowding distance. Crowding distance is calculated by measuring the density of solutions around a solution in the target space. Specifically: (1) For each target m, calculate the differences between solutions and then normalize these differences to [0,1]:
[0120]
[0121] Among them, i represents the index of the current solution, f m (i+1) and f m (i-1) represents the target value of the left and right neighbors of the current solution on the mth target. max m and f min m are the maximum and minimum values of the mth objective, respectively. Infinite values are assigned to the leftmost and rightmost solutions of the frontier, indicating that they are on the boundary and therefore have no neighbors. The crowding distance calculation is performed on the last frontier of the non-dominated sort, and if there are more solutions than the required population size, then the selection is based on the crowding distance. Solutions with greater crowding are more likely to be selected because they are sparser in the objective space and represent greater diversity.
[0122] In general, during the environmental selection process, solutions of all frontiers are selected by non-dominated sorting until the population is filled or the size limit is reached. For the last frontier, the sparsest solutions are selected according to the crowding distance to maintain the diversity of the population and thus form the next generation of population.
[0123] Step 8: Repeat the above steps 3-7 until the fitness evaluations consumed reach the preset maximum fitness evaluation times. In this embodiment, the maximum fitness evaluation times are uniformly set to 500,000.
[0124] Step 9: Get the final optimized population result, and then find the individual (solution) with the smallest training error from this population, that is, the optimal weight and bias of the neural network.
[0125] 3. Result evaluation
[0126] The present invention designs an evolutionary multi-objective optimization algorithm for neural network model training. In order to prove the training effect of the present invention, the present invention is compared with the existing evolutionary multi-objective optimization algorithm under the same conditions. Hypervolume (HV) can be used to evaluate the performance of different algorithms in neural network training for real test problems, and can well evaluate the performance of the algorithm in terms of convergence and diversity. HV targets a set of pre-set reference points distributed in the target space. and a set of PF approximate solutions S obtained by the algorithm, satisfying r * is dominated by all solutions in S. HV measures the *is the boundary, and the volume of the target space dominated by S is defined as follows:
[0127]
[0128] Where VOL(·) represents the Lebesgue measure. The larger the HV value, the better the overall performance of the algorithm.
[0129] This embodiment is tested on the PlatEMO platform, and each algorithm is independently run 30 times on the neural network training problem, and then the average value and standard deviation of its HV are calculated.
[0130] Table 1: HV results of different algorithms in processing neural network training
[0131]
[0132] It can be observed from Table 1 that the present invention has relatively better effects in different neural network training models.
[0133] The more hidden layers n-Hidden a neural network has, the more complex the neural network model is, and the larger the corresponding number of decision variables D is. Table 1 shows the HV values of the present invention and five competitive algorithms under different neural network model parameters. Each algorithm runs 30 times independently on each instance to calculate the average value and standard deviation, where the standard deviation is in brackets, and the bold data is the result with better performance. It can be seen from the table that the present invention has the best effect.
[0134] Embodiment three:
[0135] This embodiment provides a neural network training method for UR3 robot operation task classification, and the neural network is trained using the method described in Embodiment 1.
[0136] The following steps are involved:
[0137] 1. Dataset Description and Problem Description
[0138] The neural network of this embodiment is used for robot operation tasks, and the goal is to obtain a neural network structure that balances accuracy and computational cost by minimizing model error and model complexity.
[0139] The credit assessment dataset used in this embodiment comes from the UR3 CobotOps dataset in the UCI machine learning library. The dataset contains 7409 samples, each with 20 features and two labels. Label 1: Robot_ProtectiveStop (robot protective stop), when the label value is FALSE, it means that the robot did not trigger the protective stop mechanism during the operation, the robot continued to perform the task, and no abnormal situation that may cause safety problems was detected; when the label value is TRUE (if it exists), it means that the robot automatically stops the operation and enters the protection mode due to the detection of potential dangerous situations (such as people entering the work area, collision risks, etc.). Label 2: grip_lost (grasp loss) When the label value is FALSE, it means that the robot did not lose the grasped object during the grasping operation and successfully maintained the grasp of the object; when the value is TRUE (if it exists), it means that during the operation, the robot lost the grasp of the object, which may be due to insufficient grasping force, object slipping, or other unexpected situations. The goal of the model is to improve the success rate of robot operations and enhance safety. The two optimization metrics for neural network models are: model error (calculated by the cross entropy loss function) and model complexity (measured by the number of parameters of the neural network).
[0140] 2. Training method steps
[0141] This embodiment uses model error and model complexity as multi-objective optimization tasks to optimize the structure and parameters of the neural network, and mainly includes the following steps:
[0142] Step 1: Initialize the population.
[0143] Initialize a population of 100 individual neural network architectures, each of which represents a specific network configuration, including the number of network layers, the number of nodes in each layer, and the connection method of each node. Take each individual in the initial population as a candidate solution, and build a multi-layer perceptron (MLP) neural network. The output layer is the prediction result of two binary classification labels, each of which indicates whether a protective stop will be triggered and whether a grasp loss will occur.
[0144] Step 2: Fitness calculation.
[0145] A neural network is trained for each individual in the population, using the training set in the dataset and evaluating the model error through the cross entropy loss function. The model complexity of each individual is calculated, expressed as the total number of parameters of the model (i.e., the combination of the number of network layers and the number of nodes and the number of connections). Two goals are set: f1 is to minimize the model error, and f2 is to minimize the model complexity.
[0146] Step 3: Use the existing evolutionary algorithm SMPSO for optimization, search for solutions in the original solution space, and use the fitness evaluation times of t1=1000; the search of the original space can maintain the diversity of the population.
[0147] Step 4: Select a reference solution in the current population.
[0148] The reference solution is selected using the double clustering selection method designed in this embodiment. The specific process is as follows:
[0149] Step 41: Standardize the decision variables of the input population.
[0150] For a population S = {x1, x2, ..., x n}, the decision variables of each individual are standardized as follows:
[0151]
[0152] in, represents the i-th decision variable of the j-th individual in the population, S i min and S i max are the minimum and maximum values of the i-th decision variable in the population, respectively. Perform the above operations on the decision variables of all individuals to obtain the standardized population S'.
[0153] Step 42: Hierarchical clustering.
[0154] Initially, each individual is regarded as a cluster and a centroid, and the cluster set C = {C1, C2, ..., C n} and the centroid set c={c1,c2,...,c n In the main loop of hierarchical clustering, the distance between any two clusters needs to be calculated, the two clusters with the smallest distance are merged into a new cluster, and the clusters and their centroids are updated. The loop continues until the number of clusters is reduced to the preset target. This embodiment uses the Ward method to calculate the distance between clusters, where the calculation of C l and C m The distance between them is:
[0155]
[0156] Among them, ‖c l -c m ‖ 2 is the centroid c l and c m The squared Euclidean distance between l ∣ and ∣C m ∣ are clusters C l and Cm Calculate and save the distances between all clusters and find the cluster pair with the smallest distance. l and C m The distance between them is the smallest, so they are merged into a new cluster C. a , and calculate the new centroid using the following formula:
[0157]
[0158] Among them, c i a Represents cluster C a The centroid in the i-th dimension, |C a ∣ is cluster C a The number of individuals in x i j Represents cluster C a The value of the jth individual in the i-th dimension. Use this formula to calculate C a All dimensions of a The updated clusters and centroids will replace the original clusters.
[0159] As the cyclic cluster merging proceeds, the number of clusters gradually decreases until it reaches a preset number of clusters.
[0160] Step 43: Partition clustering.
[0161] Partition clustering uses the centroid of the hierarchical clustering result as the initial centroid, and then calculates the distance from each individual to the centroid. The main loop of partition clustering contains two sub-loops, which respectively implement individual clustering and calculation of new centroids. In the clustering process, the distance from the individual to the centroid of each cluster is first calculated, and then it is assigned to the cluster with the smallest distance. For the centroid c l and the current individual x j , the allocation based on the minimum distance can be completed by the following formula:
[0162]
[0163] Where p is the number of decision variables, x i j For individual x j The value of the i-th variable, is the centroid c l The i-th variable value of . Use the above formula to calculate x j The distance to all centroids is then divided into corresponding clusters by the minimum distance.
[0164] Repeat this process until all individuals are classified into corresponding clusters. Then recalculate the centroid and use the new centroid to redistribute individuals. Repeat this step until the centroid no longer changes or reaches the preset maximum number of iterations. In this embodiment, the maximum number of iterations is set to 100.
[0165] Finally, by calculating the distance from the individual in each cluster to the centroid, the individual closest to the centroid is selected and used as the final reference solution.
[0166] Step 5: Problem transformation and new solution generation, achieving weight optimization in the inner loop.
[0167] First, use a simple grouping method to group the decision variables for each reference solution, and then use the conversion function to convert the problem based on the grouping result. The problem conversion here uses the power value conversion method to obtain the converted problem. For each converted problem, a solution (weight) population is randomly created, and then the optimization algorithm SMPSO is used to optimize the population. The result weight population of this low-dimensional optimization step optimizes the objective function based on the originally selected reference solution value. The specific steps are as follows:
[0168] Step 51: Grouping;
[0169] All decision variables are grouped, and the number of groups is equal to the target number of the problem plus 1. Grouping can be done in a variety of ways, such as simple random grouping, sequential grouping, or differential grouping based on coupling relationships. This embodiment uses a sequential grouping method.
[0170] Step 52: Problem transformation;
[0171] In each group, a weight variable is used to replace the decision variable in the group for optimization. This process generates r weight variables and is completed based on the original problem Z, the selected reference solution and the problem transformation mechanism tf, and finally the transformed problem is obtained.
[0172] Therefore, before the transformation, the variables are divided into r groups, each group is called G1,…,G r ,g(x i )=G j indicates that variables are assigned to groups using the grouping mechanism g. Assume that w k It is the corresponding weight value used for problem transformation in the group. For given variables and weight values, new variables can be obtained by transformation using the following formula.
[0173]
[0174] w in the formula k ∈[0,2], by i,oldUse a power exponent transformation to obtain a new transformed value. The power exponent is the weight variable w j After standardization and then multiplied by a hyperparameter p, the amplitude of the power exponent transformation is affected by the value of p. When p > 1, the transformation makes the smaller values of the original data become even smaller and the larger values become even larger, thus expanding the search space and making the search range wider; when 0 < p < 1, the transformation makes the smaller values of the original data become larger and the larger values become smaller, thus shrinking the search space and making the search range narrower. In this embodiment, the value of p is 2.
[0175] Step 53: Weight optimization.
[0176] Randomly create an original weight solution space for the transformed problem, use the optimization algorithm SMPSO to search in the original weight solution space, use 800 fitness evaluations, and save the local optimal solution obtained in each search in the population W'.
[0177] Group, problem transform, and weight optimize for each of the j reference solutions {x1,…,x j} to obtain a new weight population W that combines the j weight populations.
[0178] Step 6: Use an adaptive evaluation function to achieve more reasonable computational resource allocation.
[0179] The adaptive evaluation function dynamically adjusts the computational resource allocation for each generation by monitoring the evolutionary state of the current population to improve the computational efficiency of the algorithm. This mechanism allows for flexible allocation of computational resources and preferentially evaluates potentially better solutions. This resource allocation method ensures the effective utilization of computational resources and accelerates the convergence process. The expression of the adaptive evaluation function is as follows:
[0180]
[0181]
[0182] The stage of population evolution is judged by the number of evaluations, that is, the ratio R of the currently used number of evaluations to the total number of evaluations.
[0183] The number of evaluations t1 for the original problem optimization includes three parts: constant term, coefficient and modified sigmoid function. The constant term and coefficient values are 1000 and 500, respectively, to achieve the change of the number of evaluations for the original problem optimization from 1000 to 1500. At the same time, the parameter k1 is used to control the growth rate of the function when R approaches r1. r1 can be regarded as the inflection point in the function. Before the inflection point is the population exploration stage, and after the inflection point is the population development stage. In this embodiment, k1 is set to 10 and r1 is set to 0.5 to achieve a rapid change in the number of evaluations in the middle stage of population evolution. Similarly, the number of weight optimization evaluations t2 is 800 at the beginning, and gradually decreases to 500 as the evolution proceeds. The hyperparameter k2 can also be used to adjust the change process. In this embodiment, k2 is set to 12 and r2 is set to 0.4 to achieve a rapid change in the number of evaluations when the population evolves to 40% of the total number of evaluations.
[0184] Step 7: Environment selection completes population update.
[0185] Based on population P and population W, an updated population P' is obtained through environmental selection. The generated new solutions and the original population are subjected to environmental selection. In the environmental selection process, solutions are screened according to their diversity and fitness values, and solutions with rich diversity are retained. Non-dominated sorting and crowding distance strategies are used to further screen solutions to form the next generation population, ensuring the Pareto optimality of the final solution set.
[0186] The method of combining non-dominated sorting and crowding distance is used to select the most suitable individuals from the population to enter the next generation. This process can ensure that the population searches in the direction of the optimal or approximately optimal solution while maintaining population diversity. First, non-dominated sorting is performed. If solution x is better than solution y in at least one objective and is not worse than y in other objectives, then x dominates y. Mathematically, it can be expressed as:
[0187]
[0188] Where M is the number of targets, f m (x) represents the mth objective value of solution x. Sorting process: All solutions are sorted according to their objective values. The solutions are divided into layers by comparing the dominance relationship of each solution with other solutions. The first layer (first front) contains all non-dominated solutions, that is, solutions that are not dominated by other solutions. After removing these solutions from the first front, the same process is performed on the remaining solutions to find the second layer of non-dominated solutions, and so on, until all solutions are assigned to a front. The solutions on each front are non-dominated, but the solutions on each front are dominated by the solutions on other fronts.
[0189] On the basis of non-dominated sorting, in order to ensure the diversity of the population, the present invention uses crowding distance. Crowding distance is calculated by measuring the density of solutions around a solution in the target space. Specifically: (1) For each target m, calculate the differences between solutions and then normalize these differences to [0,1]:
[0190]
[0191] Among them, i represents the index of the current solution, f m (i+1) and f m (i-1) represents the target value of the left and right neighbors of the current solution on the mth target. max m and f min m are the maximum and minimum values of the mth objective, respectively. Infinite values are assigned to the leftmost and rightmost solutions of the frontier, indicating that they are on the boundary and therefore have no neighbors. The crowding distance calculation is performed on the last frontier of the non-dominated sort, and if there are more solutions than the required population size, then the selection is based on the crowding distance. Solutions with greater crowding are more likely to be selected because they are sparser in the objective space and represent greater diversity.
[0192] In general, during the environmental selection process, solutions of all frontiers are selected by non-dominated sorting until the population is filled or the size limit is reached. For the last frontier, the sparsest solutions are selected according to the crowding distance to maintain the diversity of the population and thus form the next generation of population.
[0193] Step 8: Repeat the above steps 3-7 until the fitness evaluations consumed reach the preset maximum fitness evaluation times. In this embodiment, the maximum fitness evaluation times are uniformly set to 500,000.
[0194] Step 9: Find the individual with the minimum training error in the final optimized population, that is, the weight and bias of the optimal neural network model. Save the model and use it directly to complete the classification of UR3 CobotOps data.
[0195] Some steps in the embodiments of the present invention may be implemented using software, and the corresponding software program may be stored in a readable storage medium, such as a CD or a hard disk.
[0196] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A training method for a classification neural network, characterized in that: The method takes minimizing model error and model complexity as a multi-objective optimization task to obtain the optimal neural network structure and parameters, and includes the following steps: Step 1: Initialize the population to form the original solution space. Each individual in the population represents a specific neural network configuration. Step 2: Use the target classification data set to train a neural network for each individual in the population, evaluate the model error through the loss function, and evaluate the model complexity using the total number of model parameters; Step 3: With the goal of minimizing the model error and model complexity, the existing evolutionary algorithm A is used to search in the original solution space, and t1 fitness evaluations are performed, and the local optimal solution obtained from each search is saved in the population P; Step 4: Use bicluster selection to select j reference solutions {x1,…,x j }; Step 5: Group the decision variables of the reference solution, and use the weight variables to transform the problem in each group. The transformation formula is: Among them, w k represents the weight value of the kth group, x i,old represents the decision variable before transformation, x i,new represents the transformed decision variable, minweight represents the minimum weight value, maxweight represents the maximum weight value, and p represents the hyperparameter; For the converted problem, an original weight solution space is randomly created, the existing evolutionary algorithm A is used to search in the original weight solution space, and t2 fitness evaluations are performed, and the local optimal solution obtained from each search is saved in the population W'; For the j reference solutions {x1,…,x j } are grouped, problem transformed and weight optimized to obtain a new weight population W that merges j weight populations; Step 6: Based on the population P and the weighted population W, an updated population P' is obtained, and steps 3 to 5 are repeated until the preset number of evaluations is used up; Step 7: In the final optimized population, find the individual with the minimum training error, that is, the weight and bias of the optimal neural network model; The calculation formula for fitness evaluation times t1 and t2 is: Among them, R represents the ratio of the current number of evaluations to the total number of evaluations; the hyperparameter k1 represents the growth rate of the function when R approaches r1, r1 represents the inflection point in the function, before the inflection point is the population exploration stage, and after the inflection point is the population development stage; the hyperparameter k2 controls the growth rate of the function when R approaches r2, r2 represents the inflection point in the function, before the inflection point is the population exploration stage, and after the inflection point is the population development stage.
2. The method according to claim 1, characterized in that The step 4 comprises: Step 41: Standardize the decision variables in the population to obtain a standardized population; Step 42: Hierarchical clustering; Initially, each individual in the standardized population is regarded as a cluster and a centroid, and the cluster set C = {C1, C2, ..., C n } and centroid set, calculate the distance between any two clusters, merge the two clusters with the smallest distance into a new cluster, and update the clusters and their centroids. The cycle continues until the number of clusters is reduced to the preset target; Step 43: partition clustering; The centroid obtained by the hierarchical clustering process is used as the initial centroid, the distance from each individual to each centroid is calculated, and then the individual is classified into the cluster with the smallest distance; the process is repeated until all individuals are divided into corresponding clusters; Then recalculate the centroid and use the new centroid to redistribute individuals, repeating this step until the centroid no longer changes or the preset maximum number of iterations is reached; Finally, the individual closest to the centroid in each cluster is selected as the final reference solution.
3. The method according to claim 1, characterized in that The existing evolutionary algorithm A adopts the SMPSO algorithm.
4. The method according to claim 2, characterized in that: The step 42 adopts the Ward hierarchical clustering method.
5. The method according to claim 1, characterized in that In step 7, k1 is 10 and r1 is 0.
5.
6. The method according to claim 1, characterized in that In step 7, k2 is 12 and r2 is 0.
4.
7. The method according to claim 1, characterized in that The value of the hyperparameter p is 2.
8. A target classification method, wherein the method adopts the method according to any one of claims 1 to 7 to train a classification neural network, and then uses the classification neural network to classify target data, wherein the target data includes: Structured data, time series data, signal data, and financial risk data.
9. An electronic device, characterized in that: including memory and processor; The memory is used to store computer programs; The processor is configured to implement the method according to any one of claims 1 to 8 when executing the computer program.
10. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.
Citation Information
Cited By
Intelligent analysis method based on high-throughput phenotype data
CN120299520A
Disaster reduction rescue early warning method and system based on artificial intelligence
CN120894902A