Diabetes risk prediction model parameter optimization and prediction method and related device
By combining reinforcement learning particle swarm optimization algorithm and genetic algorithm, the problem of local optimal solution in parameter tuning of diabetes risk prediction model is solved, and more efficient and accurate parameter optimization is achieved, improving prediction performance.
Patent Information
- Application Number
- CN202510782750.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-12
- Publication Date
- 2025-07-11
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing diabetes risk prediction model is prone to falling into local optimal solutions during parameter tuning, and the influence of the initial parameters leads to poor tuning of model parameters, making it difficult to accurately optimize model parameters from a global perspective.
A method combining particle swarm optimization algorithm based on reinforcement learning and genetic algorithm is adopted to randomly generate initial populations, particle updates and individual updates are performed until the genetic convergence conditions are met, thereby determining the final model parameter combination.
The efficiency and accuracy of model parameter optimization are improved, local optimal solutions are avoided, global search capabilities are enhanced, and the accuracy of diabetes risk prediction is improved.
Smart Images

Figure CN120299734A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular, to a method for optimizing parameters of a diabetes risk prediction model, a prediction method, and related devices. Background Art
[0002] In the process of parameter tuning for existing diabetes risk prediction models: hyperparameter tuning is performed using a grid search algorithm or a random search algorithm, and then the initial model parameters are randomly set, and the training set is used to tune the initial model parameters.
[0003] However, both the grid search algorithm and the random search algorithm are essentially blind searches and are prone to falling into local optimal solutions, resulting in generally average hyperparameter tuning effects; moreover, the method of tuning model parameters using the training set is easily affected by the initial model parameters, resulting in possibly average model parameter tuning effects.
[0004] Since the tuning effects of the hyperparameters and model parameters of the diabetes risk prediction model directly affect the prediction results of the diabetes risk prediction model for diabetes risk, there is an urgent need for a method to accurately optimize the parameters of the diabetes risk prediction model from a global perspective. Summary of the Invention
[0005] In view of the above problems, the present application provides a method for optimizing parameters of a diabetes risk prediction model, a prediction method, and related devices, so as to achieve the purpose of accurately optimizing the parameters of the diabetes risk prediction model from a global perspective and then accurately predicting diabetes risk based on the optimized parameters. The specific solutions are as follows:
[0006] The first aspect of the present application provides a method for optimizing parameters of a diabetes risk prediction model, including:
[0007] Randomly generate an initial population within a preset parameter range, where each individual in the initial population represents a set of parameter combinations of the diabetes risk prediction model;
[0008] Use the initial population as an initial particle swarm, and perform at least one particle update on the initial particle swarm using a particle swarm optimization algorithm based on reinforcement learning to obtain an updated particle swarm corresponding to the initial particle swarm, where the reinforcement learning process in the particle swarm optimization algorithm based on reinforcement learning is used to guide the direction and step size of particle movement;
[0009] Form a first population from at least some particles in the updated particle swarm, and use a preset first training set to perform model training on each individual in the first population respectively to obtain a trained individual corresponding to each individual in the first population, and form a second population from the trained individuals;
[0010] In the case where the preset genetic convergence condition is not satisfied, the genetic algorithm based on reinforcement learning is used to perform an individual update on the second population once to obtain the updated population corresponding to the second population, wherein the reinforcement learning process in the genetic algorithm based on reinforcement learning is used to guide the crossover and mutation of the second population;
[0011] Taking the updated population as the initial particle swarm, return to perform at least one particle update on the initial particle swarm by using the particle swarm optimization algorithm based on reinforcement learning until the genetic convergence condition is satisfied, and then determine the final parameter combination of the diabetes risk prediction model from the second population.
[0012] In a possible implementation, the performing at least one particle update on the initial particle swarm by using the particle swarm optimization algorithm based on reinforcement learning to obtain the updated particle swarm corresponding to the initial particle swarm includes:
[0013] Using a preset second training set to perform model training on each particle of the initial particle swarm respectively to obtain the trained particles corresponding to each particle of the initial particle swarm respectively, and forming a first particle swarm with the trained particles;
[0014] Using a preset second validation set and the diabetes risk prediction model, calculating the second fitness values corresponding to all the trained particles of the first particle swarm respectively;
[0015] Judging whether the preset particle convergence condition is satisfied;
[0016] If not, preset an initial velocity for each trained particle of the first particle swarm respectively, and use the second fitness value corresponding to each trained particle of the first particle swarm as the initial position to obtain a first state, wherein the initial velocity is composed of an initial step size and an initial direction;
[0017] Determine a first action according to the information of the preset update learning factor;
[0018] Determine a first reward according to the optimization degree of the second fitness value;
[0019] Performing reinforcement learning on the velocities of the particles moving in the first particle swarm according to the first state, the first action and the first reward to obtain the optimized velocities corresponding to all the trained particles in the first particle swarm respectively, wherein the optimized velocity is composed of an optimized direction and an optimized step size;
[0020] Performing one particle update on all the trained particles in the first particle swarm according to the optimized velocities corresponding to all the trained particles in the first particle swarm respectively to obtain a second particle swarm;
[0021] Use the second particle swarm as the initial particle swarm, return to perform model training on each particle of the initial particle swarm using a preset second training set respectively, until when the particle convergence condition is satisfied, determine the first particle swarm as the updated particle swarm corresponding to the initial particle swarm.
[0022] In a possible implementation, the step of performing one individual update on the second population using a genetic algorithm based on reinforcement learning to obtain the updated population corresponding to the second population includes:
[0023] Determine the second state according to the first fitness values respectively corresponding to all the trained individuals in the second population, determine the second action according to the information of the preset update crossover rate, and determine the second reward according to the optimization degree of the first fitness value, where the first fitness values respectively corresponding to all the trained individuals in the second population are values calculated using a preset first validation set and the diabetes risk prediction model;
[0024] Perform reinforcement learning on the genetic parameters of the trained individuals in the second population according to the second state, the second action, and the second reward to obtain the optimized genetic parameters respectively corresponding to all the trained individuals in the second population, where the optimized genetic parameters include the optimized crossover rate and / or the optimized mutation rate;
[0025] Perform one individual update on all the trained individuals in the second population according to the optimized genetic parameters respectively corresponding to all the trained individuals in the second population to obtain the updated population corresponding to the second population.
[0026] In a possible implementation, the fitness function corresponding to the first fitness value and the fitness function corresponding to the second fitness value are the same;
[0027] The fitness function is a weighted summation function of the mean squared error and the regularization term.
[0028] In a possible implementation, the step of forming the first population by at least part of the particles in the updated particle swarm includes:
[0029] Form the second population by the particles in the updated particle swarm whose second fitness value meets the fitness value requirement;
[0030] The step of determining the final parameter combination of the diabetes risk prediction model from the second population includes:
[0031] Determine the individual with the highest first fitness value in the second population as the final parameter combination of the diabetes risk prediction model.
[0032] The second aspect of the present application provides a diabetes risk prediction method, including:
[0033] Obtain target user data, where the target user data refers to characteristic data that can characterize the risk degree of a user suffering from diabetes;
[0034] Input the target user data into a diabetes risk prediction model to obtain diabetes risk prediction information corresponding to the target user data, where the parameter combination in the diabetes risk prediction model is the final parameter combination determined in the first aspect above or the final parameter combination determined in any implementation manner of the first aspect.
[0035] The third aspect of the present application provides a parameter optimization device for a diabetes risk prediction model, including:
[0036] An initial population generation module, configured to randomly generate an initial population within a preset parameter range, and each individual in the initial population represents a set of parameter combinations of a diabetes risk prediction model;
[0037] A particle swarm update module, configured to use the initial population as an initial particle swarm, and perform at least one particle update on the initial particle swarm by using a particle swarm optimization algorithm based on reinforcement learning to obtain an updated particle swarm corresponding to the initial particle swarm, where the reinforcement learning process in the particle swarm optimization algorithm based on reinforcement learning is used to guide the direction and step size of particle movement;
[0038] A population training module, configured to form a first population from at least some particles in the updated particle swarm, and perform model training on each individual in the first population respectively by using a preset first training set to obtain a trained individual corresponding to each individual in the first population, and form a second population from the trained individuals;
[0039] A population update module, configured to, when a preset genetic convergence condition is not satisfied, perform one individual update on the second population by using a genetic algorithm based on reinforcement learning to obtain an updated population corresponding to the second population, where the reinforcement learning process in the genetic algorithm based on reinforcement learning is used to guide the crossover and mutation of the second population;
[0040] A parameter combination determination module, configured to use the updated population as the initial particle swarm, and return to perform at least one particle update on the initial particle swarm by using the particle swarm optimization algorithm based on reinforcement learning until the genetic convergence condition is satisfied, and determine the final parameter combination of the diabetes risk prediction model from the second population.
[0041] The fourth aspect of the present application provides a diabetes risk prediction device, including:
[0042] A data acquisition module for acquiring target user data, where the target user data refers to characteristic data that can characterize the risk degree of a user suffering from diabetes;
[0043] A diabetes prediction module for inputting the target user data into a diabetes risk prediction model to obtain diabetes risk prediction information corresponding to the target user data, where the parameter combination in the diabetes risk prediction model is the final parameter combination determined in the first aspect above or the final parameter combination determined in any implementation manner of the first aspect.
[0044] The fifth aspect of the present application provides a computer program product, including computer-readable instructions, which, when running on an electronic device, enable the electronic device to implement the parameter optimization method of the diabetes risk prediction model in the first aspect above or any implementation manner of the first aspect, or the diabetes risk prediction method in the second aspect above.
[0045] The sixth aspect of the present application provides an electronic device, including at least one processor and a memory connected to the processor, where:
[0046] The memory is used to store a computer program;
[0047] The processor is used to execute the computer program so that the electronic device can implement the parameter optimization method of the diabetes risk prediction model in the first aspect above or any implementation manner of the first aspect, or the diabetes risk prediction method in the second aspect above.
[0048] The seventh aspect of the present application provides a computer storage medium, where the storage medium carries one or more computer programs, and when the one or more computer programs are executed by an electronic device, they can enable the electronic device to implement the parameter optimization method of the diabetes risk prediction model in the first aspect above or any implementation manner of the first aspect, or the diabetes risk prediction method in the second aspect above.
[0049] With the above technical solution, the method for optimizing the parameters of the diabetes risk prediction model provided by this application randomly generates an initial population within a preset parameter range, uses the initial population as the initial particle swarm, and employs a particle swarm optimization algorithm based on reinforcement learning to perform at least one particle update on the initial particle swarm to obtain an updated particle swarm corresponding to the initial particle swarm. At least some of the particles in the updated particle swarm are formed into a first population, and a preset first training set is used to train each individual in the first population separately to obtain a trained individual corresponding to each individual in the first population. The trained individuals form a second population. When the preset genetic convergence condition is not satisfied, a genetic algorithm based on reinforcement learning is used to perform one individual update on the second population to obtain an updated population corresponding to the second population. The updated population is used as the initial particle swarm, and the process returns to performing at least one particle update on the initial particle swarm using the particle swarm optimization algorithm based on reinforcement learning until the genetic convergence condition is met, and then the final parameter combination of the diabetes risk prediction model is determined from the second population. Thus, this application combines the particle swarm optimization algorithm and the genetic algorithm. First, the particle swarm optimization algorithm is used to quickly explore the solution space of the parameter combination of the diabetes risk prediction model, and then the genetic algorithm is used to enhance the global search ability. Through the alternating optimization of the particle swarm optimization algorithm and the genetic algorithm, the optimal parameter combination can be searched more quickly and accurately from a global perspective and used as the final parameter combination of the diabetes risk prediction model.
[0050] Furthermore, in order to better balance the global search and local search of the genetic algorithm and the particle swarm optimization algorithm and avoid falling into local optimal solutions, this application uses reinforcement learning to guide the iterative directions of the particle swarm optimization algorithm and the genetic algorithm respectively, which can effectively avoid the ineffective search of the particle swarm optimization algorithm and the genetic algorithm, improve the parameter optimization efficiency of the optimal parameter combination, and thus improve the prediction performance of the diabetes risk prediction model. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] In combination with the accompanying drawings and with reference to the following specific embodiments, the above and other features, advantages, and aspects of the various embodiments of the present disclosure will become more apparent. Throughout the drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic, and the original elements and elements are not necessarily drawn to scale.
[0052] Figure 1 It is a schematic structural diagram of a system architecture provided by this application;
[0053] Figure 2 It is a schematic flowchart of a method for optimizing the parameters of a diabetes risk prediction model provided by this application;
[0054] Figure 3 It is a schematic flowchart of another method for optimizing the parameters of a diabetes risk prediction model provided by this application;
[0055] Figure 4 A flowchart showing a method for predicting diabetes risk provided by this application;
[0056] Figure 5 A structural diagram of an apparatus for optimizing parameters of a diabetes risk prediction model provided by this application;
[0057] Figure 6 A structural diagram of a diabetes risk prediction apparatus provided by this application;
[0058] Figure 7 A structural diagram of an electronic device provided by this application. Detailed implementation manners
[0059] The embodiments of this application will be described below with reference to the accompanying drawings in the embodiments of this application. The terms used in the embodiments part of this application are only used to explain the specific embodiments of this application, rather than to limit this application.
[0060] The embodiments of this application will be described below with reference to the accompanying drawings. Those skilled in the art know that with the development of technology and the emergence of new scenarios, the technical solutions provided by the embodiments of this application are equally applicable to similar technical problems.
[0061] The terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and do not have to be used to describe a specific order or sequence. It should be understood that such terms can be interchanged under appropriate circumstances, which is only a way of distinguishing when describing objects with the same attributes in the embodiments of this application. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusion, so that a process, method, system, product or device including a series of units does not have to be limited to those units, but may include other units not clearly listed or inherent to these processes, methods, products or devices.
[0062] This application provides a method for optimizing parameters of a diabetes risk prediction model and a method for predicting diabetes risk, which can be applicable to scenarios where diabetes risk prediction is required. For example, when conducting health check-ups on users in institutions such as physical examination centers and hospitals, this application can be used for diabetes risk prediction. The method for optimizing parameters of the diabetes risk prediction model and the method for predicting diabetes risk in this application can both be applied to a Figure 1 system architecture as shown. This system may include a terminal 100 and a server 200. The server 200 may include one or more servers ( Figure 1 illustrated by taking one server as an example).
[0063] The terminal 100 can be used alone to execute the parameter optimization method and the diabetes risk prediction method provided by the embodiments of the present application. In addition, the terminal 100 and the server 200 can also be used in cooperation to execute the parameter optimization method and the diabetes risk prediction method provided by the embodiments of the present application.
[0064] Next, the product form of the terminal 100 will be described. Figure 1 in the present application.
[0065] The terminal 100 in the embodiments of the present application can be a mobile phone, a tablet computer, a wearable device, a vehicle-mounted device, an augmented reality (AR) / virtual reality (VR) device, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), etc. The embodiments of the present application do not make any restrictions in this regard.
[0066] The terminal 100 may include a radio frequency unit, a memory, an input unit, a display unit, a camera (optional), an audio circuit (optional), a speaker (optional), a microphone (optional), a headphone jack (optional), a processor, an external interface, a power supply, and other components. Those skilled in the art can understand that the above components are only examples and do not constitute a limitation on the terminal or the multifunctional device. It may include more or fewer components, or combine some components, or different components.
[0067] The input unit can be used to receive input digital or character information, and generate key signal inputs related to the user settings and function controls of the portable multifunctional device. Specifically, the input unit may include a touch screen (optional) and / or other input devices. Specifically, the other input devices may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, and the like.
[0068] Among them, the input device can receive input data and so on.
[0069] The display unit can be used to display information input by the user or provided to the user, various menus of the terminal, an interactive interface, file display, and / or the playback of any multimedia file.
[0070] The memory can be used to store software codes related to the parameter optimization method of the diabetes risk prediction model and the diabetes risk prediction method. The processor can execute the steps of the parameter optimization method of the diabetes risk prediction model and the diabetes risk prediction method, and can also schedule other units (such as the above input unit and display unit) to implement corresponding functions.
[0071] The radio frequency unit (optional) can be used for receiving and sending information or signals during a call.
[0072] Among them, in the embodiments of the present application, the radio frequency unit can send data to the server 200 and receive the processing result sent by the server 200.
[0073] It should be understood that the radio frequency unit is optional and can be replaced by other communication interfaces, such as a network port.
[0074] The terminal 100 further includes a power supply (such as a battery) for powering each component.
[0075] The terminal 100 further includes an external interface, which can be a standard Micro USB interface or a multi-pin connector, and can be used to connect the terminal 100 to other devices for communication, and can also be used to connect a charger to charge the terminal 100.
[0076] The server 200 includes a bus, a processor, a communication interface, and a memory, and the processor, the memory, and the communication interface communicate with each other through the bus.
[0077] Among them, the memory can be used to store software codes related to the parameter optimization method of the diabetes risk prediction model and the diabetes risk prediction method. The processor can execute the steps of the parameter optimization method of the diabetes risk prediction model and the diabetes risk prediction method of the chip, and can also schedule other units to implement corresponding functions.
[0078] First, a parameter optimization method for a diabetes risk prediction model provided by the embodiments of the present application will be introduced in detail.
[0079] Refer to Figure 2 , Figure 2 is a flowchart of a parameter optimization method for a diabetes risk prediction model provided by the embodiments of the present application. As Figure 2 shown, a parameter optimization method for a diabetes risk prediction model provided by the embodiments of the present application may include steps S201 to S207, and the following will describe these steps in detail.
[0080] Step S201: Randomly generate an initial population within a preset parameter range, and use the initial population as the initial particle swarm.
[0081] To achieve the risk prediction of diabetes, in this embodiment, a diabetes risk prediction model is pre-constructed. To globally search for the optimal parameter combination of the diabetes risk prediction model, the powerful global search ability of the Genetic Algorithm (GA) can be utilized.
[0082] Based on this, in this embodiment, the parameter ranges of each parameter in the parameter combination can be preset in advance, and then an initial population is randomly generated within this parameter range. Here, the initial population includes multiple individuals, and each individual represents a set of parameter combinations of the diabetes risk prediction model.
[0083] Optionally, the parameter combination in this embodiment can be a combination of model parameters, such as a combination of network structure parameters of the diabetes risk prediction model; optionally, the parameter combination can also be a combination of hyperparameters, such as a combination of hyperparameters like learning rate, maximum depth of the tree, and weight parameters in the fitness function.
[0084] Considering that although the crossover and mutation operations of the genetic algorithm can explore a wider solution space, they may not be able to effectively explore the region near the local optimal solution. To overcome the deficiency of the genetic algorithm in local search ability, in this embodiment, the Particle Swarm Optimization (PSO) algorithm is added during the global search of the genetic algorithm. With the help of the local search ability of the particle swarm optimization algorithm, a more comprehensive search is carried out within the solution space.
[0085] Therefore, in this embodiment, each individual in the initial population can be regarded as a particle, and an initial particle swarm composed of all particles is obtained.
[0086] Step S202: Use the particle swarm optimization algorithm based on reinforcement learning to perform at least one particle update on the initial particle swarm to obtain an updated particle swarm corresponding to the initial particle swarm.
[0087] In this embodiment, the solution space of the parameter combination of the diabetes risk prediction model can be quickly explored through the particle swarm optimization algorithm. To avoid the particle swarm optimization algorithm falling into the local optimal solution during the exploration process and to accelerate the exploration speed of the particle swarm optimization algorithm, when the particle swarm optimization algorithm is exploring, the direction and step size of particle movement can be guided through reinforcement learning.
[0088] Considering that it may not be possible to directly explore the optimal solution in the local space through one particle update, therefore, in this embodiment, the initial particle swarm can be updated one or more times by combining reinforcement learning with the particle swarm optimization algorithm to obtain an updated particle swarm corresponding to the initial particle swarm.
[0089] Step S203: Form a first population by using at least some of the particles in the updated particle swarm, and perform model training on each individual in the first population separately by using a preset first training set to obtain a trained individual corresponding to each individual in the first population, and form a second population with the trained individuals.
[0090] In this embodiment, a better part or all of the particles in the updated particle swarm can be used to form the first population.
[0091] As introduced above, each individual in the first population has undergone at least one particle update. Since the particle update process is a parameter tuning method that combines pure reinforcement learning and particle swarm optimization algorithms and is not combined with the real data of the diabetes risk prediction scenario, there may be a situation where the accuracy of the individuals in the first population for diabetes risk prediction is relatively low.
[0092] Based on this, this embodiment can collect the real data of the diabetes risk prediction scenario as the preset first training set, and then use each individual in the first population as the initial parameter combination of the diabetes risk prediction model, and perform model training by using the first training set to obtain the trained parameter combination as the trained individual. Since the trained individual is the parameter combination after being trained by the first training set, the trained individual is more suitable for the diabetes risk prediction scenario.
[0093] Optionally, the first training set can be the training user data labeled with whether having diabetes or not, or the training user data labeled with the risk coefficient of having diabetes.
[0094] Of course, the first training set can also be others, as long as it is suitable for the constructed diabetes risk prediction model, and the present application does not make specific limitations.
[0095] Step S204: Determine whether the preset genetic convergence condition is satisfied. If not, execute step S205; if so, execute step S207.
[0096] In a possible implementation, a preset first validation set and the diabetes risk prediction model can be used to calculate the first fitness value corresponding to each trained individual in the second population, and then determine whether the preset genetic convergence condition is satisfied according to the first fitness value corresponding to each trained individual in the second population.
[0097] For example, if the first fitness values corresponding to all the trained individuals in the second population are greater than or equal to the preset first fitness threshold, it is determined that the genetic convergence condition is satisfied; for another example, if the first fitness values corresponding to more than the target number of trained individuals in the second population are greater than or equal to the first fitness threshold, it is determined that the genetic convergence condition is satisfied.
[0098] It should be noted that the above examples are only for understanding and should not be used to limit this application.
[0099] In another possible implementation, the number of genetic iterations can also be recorded. When the number of genetic iterations is greater than or equal to a preset genetic iteration threshold, it is determined that the genetic convergence condition is met; otherwise, it is determined that the genetic convergence condition is not met.
[0100] In this embodiment, the above two implementation methods can also be combined to determine whether the preset genetic convergence condition is met. Of course, in addition to this, there can be other implementation methods for determining whether the preset genetic convergence condition is met, which will not be listed one by one in this application.
[0101] Step S205: Use a genetic algorithm based on reinforcement learning to perform one individual update on the second population to obtain an updated population corresponding to the second population.
[0102] In this embodiment, if the genetic convergence condition is not met, it means that the individuals in the second population are not yet a globally optimal parameter combination. Then, a reinforcement learning combined with a genetic algorithm can be used to perform one individual update on the second population to obtain an updated population corresponding to the second population.
[0103] Here, reinforcement learning is used to guide the crossover and mutation of the second population, so that the second population can perform inheritance, crossover, and mutation in a more optimal direction to obtain a globally more optimal parameter combination, that is, the updated population.
[0104] Step S206: Use the updated population as the initial particle swarm and return to step S202.
[0105] Through the particle swarm optimization algorithm based on reinforcement learning, local optimal solutions can be found in the vicinity of each individual in the randomly generated initial population. Through the genetic algorithm based on reinforcement learning, starting from the local optimal solutions, the global optimal solution can be further searched. However, it can be understood that one global optimization may not be sufficient to find the optimal solution from a global perspective. For this reason, in this embodiment, the updated population can be used as the initial particle swarm, and then return to step S202 to continue the local and global parameter search until the genetic convergence condition is met, indicating that the individuals in the second population are already a globally optimal parameter combination, then the following step S207 can be executed.
[0106] It should be noted that if it is determined whether the genetic convergence condition is met based on the number of genetic iterations in the previous text, then when returning to step S202 in this embodiment, the number of genetic iterations needs to be incremented by 1.
[0107] Step S207: Determine the final parameter combination of the diabetes risk prediction model from the second population.
[0108] In this embodiment, the optimal individual in the second population can be determined as the final parameter combination of the diabetes risk prediction model.
[0109] For the parameter optimization method of the diabetes risk prediction model provided in this application, an initial population is randomly generated within a preset parameter range, and the initial population is used as the initial particle swarm. The initial particle swarm is updated at least once using a particle swarm optimization algorithm based on reinforcement learning to obtain an updated particle swarm corresponding to the initial particle swarm. At least some of the particles in the updated particle swarm are formed into a first population, and each individual in the first population is separately trained using a preset first training set to obtain a trained individual corresponding to each individual in the first population. The trained individuals form a second population. When the preset genetic convergence condition is not met, a genetic algorithm based on reinforcement learning is used to update the individuals in the second population once to obtain an updated population corresponding to the second population. The updated population is used as the initial particle swarm, and the process of using the particle swarm optimization algorithm based on reinforcement learning to update the initial particle swarm at least once is returned until the genetic convergence condition is met. At this time, the final parameter combination of the diabetes risk prediction model is determined from the second population. It can be seen that this application combines the particle swarm optimization algorithm and the genetic algorithm. First, the particle swarm optimization algorithm is used to quickly explore the solution space of the parameter combination of the diabetes risk prediction model, and then the genetic algorithm is used to enhance the global search ability. Under the alternating optimization of the particle swarm optimization algorithm and the genetic algorithm, the optimal parameter combination can be searched more quickly and accurately from a global perspective and used as the final parameter combination of the diabetes risk prediction model.
[0110] Furthermore, in order to better balance the global search and local search of the genetic algorithm and the particle swarm optimization algorithm and avoid falling into local optimal solutions, this application uses reinforcement learning to guide the iterative directions of the particle swarm optimization algorithm and the genetic algorithm respectively, which can effectively avoid the ineffective search of the particle swarm optimization algorithm and the genetic algorithm, improve the parameter optimization efficiency of the optimal parameter combination, and further improve the prediction performance of the diabetes risk prediction model.
[0111] In some embodiments of this application, the process of the previous step S202, "using a particle swarm optimization algorithm based on reinforcement learning to update the initial particle swarm at least once to obtain an updated particle swarm corresponding to the initial particle swarm", is introduced.
[0112] Optionally, the process of "using a particle swarm optimization algorithm based on reinforcement learning to update the initial particle swarm at least once to obtain an updated particle swarm corresponding to the initial particle swarm" may include:
[0113] Each particle in the initial particle swarm is separately trained using a preset second training set to obtain a trained particle corresponding to each particle in the initial particle swarm, and the trained particles form a first particle swarm;
[0114] Using a preset second validation set and a diabetes risk prediction model, calculate the second fitness values corresponding to all the trained particles in the first particle swarm respectively;
[0115] Determine whether the preset particle convergence condition is satisfied;
[0116] If not, preset an initial velocity for each of the trained particles in the first particle swarm, and use the second fitness value corresponding to each of the trained particles in the first particle swarm as the initial position to obtain a first state, where the initial velocity consists of an initial step size and an initial direction;
[0117] Determine a first action according to the information of the preset updated learning factor;
[0118] Determine a first reward according to the optimization degree of the second fitness value;
[0119] Perform reinforcement learning on the velocities of the particles moving in the first particle swarm according to the first state, the first action, and the first reward to obtain the optimized velocities corresponding to all the trained particles in the first particle swarm respectively, where the optimized velocity consists of an optimized direction and an optimized step size;
[0120] Perform a particle update on all the trained particles in the first particle swarm according to the optimized velocities corresponding to all the trained particles in the first particle swarm respectively to obtain a second particle swarm;
[0121] Use the second particle swarm as the initial particle swarm, and return to perform model training on each particle of the initial particle swarm respectively using the preset second training set until the particle convergence condition is satisfied, and then determine the first particle swarm as the updated particle swarm corresponding to the initial particle swarm.
[0122] The above process will be explained in detail below.
[0123] To ensure that the initial particle swarm and the particle swarm after particle update are more applicable to the diabetes risk prediction scenario, in this embodiment, the model training can be first performed on each particle of the initial particle swarm respectively using the preset second training set to obtain the trained particles corresponding to each particle of the initial particle swarm respectively, and the first particle swarm is composed of the trained particles.
[0124] Here, the second training set and the first training set mentioned above can be the same training set or different training sets. However, even if the second training set and the first training set are different training sets, their data types still need to be the same, that is, if the first training set is the training user data labeled with whether having diabetes label, then the second training set is also the training user data labeled with whether having diabetes label, and if the first training set is the training user data labeled with the risk coefficient label of having diabetes, then the second training set is also the training user data labeled with the risk coefficient label of having diabetes.
[0125] The process of "using a preset second training set to separately train each particle of the initial particle swarm to obtain a trained particle corresponding to each particle of the initial particle swarm" is specifically as follows: Each particle in the initial particle swarm is used as an initial parameter combination of the diabetes risk prediction model, and the second training set is used for model training to obtain a trained parameter combination, which is used as the trained particle.
[0126] After forming the first particle swarm with all the trained particles, in this embodiment, a preset second validation set and the diabetes risk prediction model can be used to calculate the second fitness values corresponding to all the trained particles in the first particle swarm.
[0127] Here, the second validation set and the first validation set can be the same validation set or different validation sets. Both the first validation set and the second validation set are of the same data type as the first training set.
[0128] In this embodiment, the fitness function corresponding to the first fitness value and the fitness function corresponding to the second fitness value can be the same or different.
[0129] When the fitness function corresponding to the first fitness value and the fitness function corresponding to the second fitness value are the same, the fitness function can be a weighted sum function of the mean squared error and the regularization term, that is, the calculation formula of the fitness function is as follows:
[0130] Formula (1);
[0131] Wherein, represents the first fitness value or the second fitness value, represents the mean squared error, represents the weight coefficient of the mean squared error (a hyperparameter), and represents the regularization term, and represents the weight coefficient of the regularization term (a hyperparameter).
[0132] In this embodiment, setting the fitness function corresponding to the first fitness value and the fitness function corresponding to the second fitness value to be the same can, when tuning hyperparameters, find the distribution relationship between the weights of the regularization term and the mean squared error to the greatest extent, so as to more accurately quantify the first fitness value and the second fitness value. At the same time, in this embodiment, introducing both the regularization term and into the fitness function and dynamically allocating weights can optimize the iterative process of the particle swarm optimization algorithm and the genetic algorithm more, and thus improve the global accuracy of parameter adjustment.
[0133] Further, after calculating the second fitness values corresponding to all the trained particles in the first particle swarm, this embodiment can determine whether the preset particle convergence condition is satisfied.
[0134] Optionally, it can be determined whether the preset particle convergence condition is satisfied according to the second fitness values corresponding to all the trained particles in the first particle swarm and / or the particle iteration times. This process is similar to step S204 described above. For details, please refer to the above introduction and will not be elaborated here.
[0135] If the particle convergence condition is not satisfied, it indicates that the first particle swarm may not be the local optimal solution in the vicinity of the initial particle swarm. Then, reinforcement learning can be used to guide the movement direction and movement step size of the first particle swarm so that the first particle swarm can be updated once.
[0136] Specifically, define the state space of reinforcement learning as the current state of the particle, define the action space as the updated learning factor, and define the reward space, that is, define the above-mentioned first state, first action, and first reward. On this basis, reinforcement learning can be performed to obtain the optimized velocities corresponding to all the trained particles in the first particle swarm, that is, the optimized direction and optimized step size. Furthermore, the first particle swarm can be updated based on the optimized velocities to obtain the second particle swarm.
[0137] Optionally, the information of the preset updated learning factor can be: increasing the learning factor or decreasing the learning factor. For example, in each stage of reinforcement learning, the action of "increasing the learning factor" or "decreasing the learning factor" can be selected according to the reward, and the first action can be randomly selected as "increasing the learning factor" or "decreasing the learning factor".
[0138] Optionally, after the reinforcement learning selects an action, for each of the learning factors c1 and c2, it can be updated within the preset learning factor range [cmin, cmax] as follows: , where represents the updated learning factor, represents the learning factor before update (a hyperparameter, with the initial value being the preset value), represents addition or subtraction, represents the learning factor update step size, cmin represents the minimum value within the learning factor range, and cmax represents the maximum value within the learning factor range.
[0139] Optionally, the process of "determining the first reward according to the optimization degree of the second fitness value" can include: if the second fitness value increases by more than the preset threshold before and after the state change, then the first reward is , if the second fitness value decreases before and after the state change, then the first reward is , if the second fitness values before and after the state change are otherwise, the first reward is 0, which is a preset value.
[0140] Through the above reward setting, the example can move in the direction of optimizing the second fitness value, and then an optimized speed that can make the model effect better can be obtained.
[0141] It should be noted that the above process of determining the first reward is only an example and does not limit this application.
[0142] To avoid that the optimal solution in the local area is not found in the above example optimization process, in this embodiment, the second particle swarm can be used as the initial particle swarm, and the model training is respectively carried out on each particle of the initial particle swarm by using the preset second training set until the particle convergence condition is satisfied. At this time, it means that the first particle swarm is probably the local optimal solution in the area near the initial particle swarm. Then, the first particle swarm can be determined as the updated particle swarm corresponding to the initial particle swarm.
[0143] It can be understood that in particle swarm optimization, the velocity update rule determines the moving direction and step size of the particle. In this embodiment, the velocity update rule is dynamically adjusted through reinforcement learning, which can better balance global search and local search. Moreover, by adopting the particle swarm optimization algorithm based on reinforcement learning, the group experience among particle swarms can be fully utilized to accelerate local search, so that the local optimal solution in the local area can be found more quickly and accurately, making up for the disadvantage of the slow convergence of the genetic algorithm.
[0144] In some other embodiments of this application, the process of the previous step S205 "using the genetic algorithm based on reinforcement learning to perform an individual update on the second population to obtain the updated population corresponding to the second population" is introduced in detail.
[0145] Optionally, the process of "using the genetic algorithm based on reinforcement learning to perform an individual update on the second population to obtain the updated population corresponding to the second population" may include:
[0146] Determine the second state according to the first fitness values respectively corresponding to all the trained individuals in the second population, determine the second action according to the information of the preset update crossover rate, and determine the second reward according to the optimization degree of the first fitness value. Among them, the first fitness values respectively corresponding to all the trained individuals in the second population are the values calculated by using the preset first validation set and the diabetes risk prediction model;
[0147] Perform reinforcement learning on the genetic parameters of the trained individuals in the second population according to the second state, the second action and the second reward to obtain the optimized genetic parameters respectively corresponding to all the trained individuals in the second population. Among them, the optimized genetic parameters include the optimized crossover rate and / or the optimized mutation rate;
[0148] Perform an individual update on all the trained individuals in the second population according to the optimized genetic parameters respectively corresponding to all the trained individuals in the second population, to obtain the updated population corresponding to the second population.
[0149] The following is a detailed explanation.
[0150] In this embodiment, the state space of the reinforcement learning can be defined as the average fitness or the individual highest fitness of the second population (certainly, the state space can also be defined as others), the action space is defined as increasing or decreasing the crossover rate, and / or increasing or decreasing the mutation rate, and the reward space is defined, that is, the above-mentioned second state, second action and second reward are defined. On this basis, the reinforcement learning is performed, and thus the optimized genetic parameters respectively corresponding to all the trained individuals in the second population can be obtained, that is, the optimized crossover rate and / or the optimized mutation rate. Furthermore, based on the optimized genetic parameters, the second population is updated (that is, genetic, crossover and mutation operations are performed on the second population), to obtain the updated population corresponding to the second population.
[0151] Optionally, taking the crossover rate as an example, after the action is selected in the reinforcement learning, the following update can be performed on the crossover rate within the preset crossover rate range [crmin, crmax]: , where represents the updated crossover rate, represents the crossover rate before update (a hyperparameter, the initial value is a preset value), represents plus or minus, represents the crossover rate update step size, crmin represents the minimum value within the crossover rate range, and crmax represents the maximum value within the crossover rate range.
[0152] The process of "determining the second reward according to the optimization degree of the first fitness value" is the same as the process of "determining the first reward according to the optimization degree of the second fitness value" described above. For details, reference can be made to the introduction above and will not be elaborated here.
[0153] It can be understood that in the genetic algorithm, the crossover rate and the mutation rate are two key parameters, which determine the diversity and search efficiency of the population. In this embodiment, these parameters are dynamically adjusted through reinforcement learning, which can better balance the global search and the local search, and avoid premature convergence and low search efficiency.
[0154] In this embodiment, the genetic algorithm and the particle swarm optimization algorithm are mixed, which can not only maintain the population diversity, but also quickly approach the optimal solution, realizing the efficient optimization of the parameter adjustment process of the diabetes risk prediction model.
[0155] In a possible implementation, the process of the above step S203 "forming a first population from at least some of the particles in the updated particle swarm" may include: forming a second population from the particles in the updated particle swarm whose second fitness value meets the fitness value requirement. For example, forming a second population from several particles in the updated particle swarm with the top-ranked second fitness values, or forming a second population from the particles in the updated particle swarm whose second fitness value is greater than the second fitness threshold.
[0156] Optionally, the process of step S207 "determining the final parameter combination of the diabetes risk prediction model from the second population" may include: determining the individual with the highest first fitness value in the second population as the final parameter combination of the diabetes risk prediction model.
[0157] To make those skilled in the art better understand the present application, the above embodiments are summarized and introduced below.
[0158] See Figure 3 , which is a flowchart showing another method for optimizing the parameters of the diabetes risk prediction model provided by the embodiment of the present application.
[0159] Step S301: Randomly generate an initial population within a preset parameter range, and use the initial population as the initial particle swarm.
[0160] Step S302: Use a preset second training set to train each particle in the initial particle swarm separately, obtain the trained particles corresponding to each particle in the initial particle swarm, and form a first particle swarm from the trained particles.
[0161] Step S303: Use a preset second validation set and the diabetes risk prediction model to calculate the second fitness values corresponding to all the trained particles in the first particle swarm respectively.
[0162] Specifically, in this embodiment, the mean square error and regularization term of the diabetes risk prediction model with the trained particle as the parameter combination can be calculated under the second validation set, and then the second fitness value corresponding to the trained particle can be calculated using the previous fitness function (see formula (1) for details).
[0163] Step S304: Determine whether the preset particle convergence condition is met. If not, execute step S305; if so, execute step S307.
[0164] Step S305: Obtain the optimized velocities corresponding to all the trained particles in the first particle swarm through reinforcement learning.
[0165] Specifically, an initial velocity is preset for each trained particle in the first particle swarm, and the second fitness value corresponding to each trained particle in the first particle swarm is used as the initial position to obtain the first state. The first action is determined according to the preset information for updating the learning factor, the first reward is determined according to the optimization degree of the second fitness value, and reinforcement learning is performed on the velocities of the particles moving in the first particle swarm based on the first state, the first action, and the first reward to obtain the optimized velocities corresponding to all the trained particles in the first particle swarm respectively.
[0166] Step S306: Update the particles according to the optimized velocities to obtain a second particle swarm, use the second particle swarm as the initial particle swarm, and return to step S302.
[0167] Specifically, according to the optimized velocities corresponding to all the trained particles in the first particle swarm respectively, perform a particle update on all the trained particles in the first particle swarm to obtain a second particle swarm.
[0168] Step S307: Determine the updated particle swarm corresponding to the initial particle swarm as the first particle swarm, and form a first population by at least some of the particles in the updated particle swarm.
[0169] Step S308: Use the preset first training set to perform model training on each individual in the first population respectively to obtain the trained individuals corresponding to each individual in the first population respectively, and form a second population by the trained individuals.
[0170] Step S309: Use the preset first validation set and the diabetes risk prediction model to calculate the first fitness values corresponding to all the trained individuals in the second population respectively.
[0171] The implementation process of this step is similar to step S303 in the previous text. For details, please refer to the previous introduction and will not be elaborated here.
[0172] Step S310: Determine whether the preset genetic convergence condition is satisfied. If not, execute step S311; if so, execute step S313.
[0173] Step S311: Obtain the optimized genetic parameters corresponding to all the trained individuals in the second population through reinforcement learning.
[0174] Specifically, determine the second state according to the first fitness values corresponding to all the trained individuals in the second population respectively, determine the second action according to the preset information for updating the crossover rate, determine the second reward according to the optimization degree of the first fitness value, and perform reinforcement learning on the genetic parameters of the trained individuals in the second population based on the second state, the second action, and the second reward to obtain the optimized genetic parameters corresponding to all the trained individuals in the second population respectively.
[0175] Step S312: Update individuals according to the optimized genetic parameters to obtain the updated population corresponding to the second population. Use the updated population as the initial particle swarm, and return to step S302.
[0176] Specifically, perform individual update on all the trained individuals in the second population according to the optimized genetic parameters corresponding to each of the trained individuals in the second population to obtain the updated population corresponding to the second population.
[0177] Step S313: Determine the final parameter combination of the diabetes risk prediction model from the second population.
[0178] The specific implementation processes of the steps in this embodiment can be referred to the foregoing introduction and will not be elaborated here.
[0179] In this embodiment, the genetic algorithm and the particle swarm optimization algorithm are combined, and the particle swarm optimization algorithm is incorporated into the process of the genetic algorithm, so that the results of the particle swarm optimization algorithm and the genetic algorithm affect each other, and automatic parameter tuning can be performed more accurately. At the same time, reinforcement learning is introduced to guide the iterative directions of the genetic algorithm and the particle swarm optimization algorithm, which can avoid falling into local optimal solutions and avoid the ineffective search of the genetic algorithm and the particle swarm optimization algorithm, realizing the efficient optimization of the model parameter adjustment process.
[0180] To verify the prediction effect of the diabetes risk prediction model provided in the embodiment of the present application, taking the diabetes risk prediction model as the XGboost model (the full English name is eXtreme Gradient Boosting. The XGboost model is an efficient ensemble learning algorithm based on gradient boosting decision trees. Its core lies in constructing a powerful ensemble model by combining multiple weak learners, and has advantages such as high efficiency, flexibility, and strong scalability, and performs well in various tasks such as classification, regression, and ranking) as an example, a hyperparameter tuning experiment was carried out using the diabetes risk prediction dataset (this dataset can be the same as or different from the first training set, the second training set, the first validation set, and the second validation set mentioned above), and the results are as follows:
[0181] When the diabetes risk prediction model uses the default parameters (i.e., without tuning the parameters), the MSE is 0.628, the running time of the model for hyperparameter optimization is 5 seconds, and the optimized hyperparameter list is [0.1, 100, 3, 1, 0, 1, 1]; when the diabetes risk prediction model uses the grid search method for hyperparameter optimization, the MSE is 0.622, the running time of the model for hyperparameter optimization is 1273 seconds, and the optimized hyperparameter list is [0.2, 100, 5, 5, 0, 1, 1]; when the diabetes risk prediction model uses the random walk method for hyperparameter tuning, the MSE is 0.612, the running time of the model for hyperparameter optimization is 194 seconds, and the optimized hyperparameter list is [0.04, 290, 4, 0.6, 0.99, 0.58, 0.71]; when the diabetes risk prediction model uses the method of this application for hyperparameter tuning, the MSE is 0.606, the running time of the model for hyperparameter optimization is 152, and the optimized hyperparameter list is [0.11, 221, 3, 10, 0.35, 0.84, 0.76], where the seven hyperparameters in the optimized hyperparameter list are in turn: learning rate (learning_rate), number of trees (n_estimators), maximum depth of the tree (max_depth), subsampling ratio (subsample), and the three weight coefficients in formula (1). , and .
[0182] It should be noted that the above seven hyperparameters are only examples and cannot be used as the limitation of the hyperparameters in this application.
[0183] From the above data, it can be seen that the method of this application has the smallest MSE among them, and the least time-consuming among all parameter optimization methods except the default parameters, and the MSE is the smallest. Thus, it can be proved that the method of this application has a good prediction effect.
[0184] The embodiment of this application also provides a diabetes risk prediction method. Refer to Figure 4 shown in the flowchart of the diabetes risk prediction method provided by the embodiment of this application. The diabetes risk prediction method may include:
[0185] Step S401, obtain target user data.
[0186] Here, the target user data refers to the characteristic data that can characterize the risk degree of the user suffering from diabetes. For example, the user's genetic data, family disease history data, basic data (such as age, gender, weight, etc.), lifestyle data (such as eating habits, exercise status), physiological index data (such as blood pressure level, blood sugar level), and so on.
[0187] Step S402: Input the target user data into the diabetes risk prediction model to obtain the diabetes risk prediction information corresponding to the target user data.
[0188] The parameter combination in the diabetes risk prediction model in this step can be the final parameter combination determined in any of the foregoing embodiments.
[0189] Optionally, the diabetes risk prediction information can be: information indicating whether diabetes is suffered, and / or, the risk coefficient of suffering from diabetes, where the risk coefficient represents the probability that the user will suffer from diabetes within a set future duration.
[0190] Of course, the diabetes risk prediction model can also be other models, which are not specifically limited in this application.
[0191] In summary, this application provides a diabetes risk prediction method. A diabetes risk prediction model that uses a parameter optimization method based on the diabetes risk prediction model to optimize model parameters and hyperparameters is used for prediction. Since both the model parameters and hyperparameters are the global optimal solutions in the solution space, the prediction accuracy of this application is higher.
[0192] The above introduces a parameter optimization method for a diabetes risk prediction model provided by an embodiment of this application. The following will introduce an apparatus for executing the above parameter optimization method for the diabetes risk prediction model.
[0193] Please refer to Figure 5 , Figure 5 which is a schematic structural diagram of a parameter optimization apparatus for a diabetes risk prediction model provided by an embodiment of this application. As Figure 5 shown, the parameter optimization apparatus for the diabetes risk prediction model may include:
[0194] An initial population generation module 501, configured to randomly generate an initial population within a preset parameter range, and each individual of the initial population represents a set of parameter combinations of the diabetes risk prediction model;
[0195] A particle swarm update module 502, configured to use the initial population as an initial particle swarm, and perform at least one particle update on the initial particle swarm by using a particle swarm optimization algorithm based on reinforcement learning to obtain an updated particle swarm corresponding to the initial particle swarm, where the reinforcement learning process in the particle swarm optimization algorithm based on reinforcement learning is used to guide the direction and step size of particle movement;
[0196] A population training module 503, configured to form a first population from at least some particles in the updated particle swarm, and perform model training on each individual of the first population by using a preset first training set to obtain a trained individual corresponding to each individual of the first population, and form a second population from the trained individuals;
[0197] The population update module 504 is used to, when the preset genetic convergence condition is not satisfied, perform an individual update on the second population using a genetic algorithm based on reinforcement learning to obtain an updated population corresponding to the second population. In the genetic algorithm based on reinforcement learning, the reinforcement learning process is used to guide the crossover and mutation of the second population.
[0198] The parameter combination determination module 505 is used to take the updated population as the initial particle swarm, and return to perform at least one particle update on the initial particle swarm using a particle swarm optimization algorithm based on reinforcement learning until the genetic convergence condition is satisfied, and then determine the final parameter combination of the diabetes risk prediction model from the second population.
[0199] In a possible implementation, when the above particle swarm update module performs at least one particle update on the initial particle swarm using a particle swarm optimization algorithm based on reinforcement learning to obtain an updated particle swarm corresponding to the initial particle swarm, it can specifically be used for:
[0200] Use a preset second training set to perform model training on each particle of the initial particle swarm respectively to obtain a trained particle corresponding to each particle of the initial particle swarm, and the trained particles form the first particle swarm.
[0201] Use a preset second validation set and the diabetes risk prediction model to calculate the second fitness values corresponding to all the trained particles of the first particle swarm respectively.
[0202] Judge whether the preset particle convergence condition is satisfied.
[0203] If not, preset an initial velocity for each trained particle of the first particle swarm respectively, and use the second fitness value corresponding to each trained particle of the first particle swarm as the initial position to obtain the first state, where the initial velocity is composed of an initial step size and an initial direction.
[0204] Determine the first action according to the information of the preset update learning factor.
[0205] Determine the first reward according to the optimization degree of the second fitness value.
[0206] Perform reinforcement learning on the velocities of the particles moving in the first particle swarm according to the first state, the first action, and the first reward to obtain the optimized velocities corresponding to all the trained particles in the first particle swarm respectively, where the optimized velocity is composed of an optimized direction and an optimized step size.
[0207] Perform a particle update on all the trained particles in the first particle swarm once according to the optimized velocities corresponding to all the trained particles in the first particle swarm respectively to obtain the second particle swarm.
[0208] Use the second particle swarm as the initial particle swarm, and return the model training for each particle of the initial particle swarm separately using a preset second training set. When the particle convergence condition is met, determine the updated particle swarm corresponding to the initial particle swarm as the first particle swarm.
[0209] In a possible implementation, when the above population update module performs an individual update on the second population using a genetic algorithm based on reinforcement learning to obtain the updated population corresponding to the second population, it can specifically be used for:
[0210] Determine the second state according to the first fitness values respectively corresponding to all the trained individuals in the second population, determine the second action according to the information of the preset update crossover rate, and determine the second reward according to the optimization degree of the first fitness value, where the first fitness values respectively corresponding to all the trained individuals in the second population are values calculated using a preset first validation set and a diabetes risk prediction model;
[0211] Perform reinforcement learning on the genetic parameters of the trained individuals in the second population according to the second state, the second action, and the second reward to obtain the optimized genetic parameters respectively corresponding to all the trained individuals in the second population, where the optimized genetic parameters include an optimized crossover rate and / or an optimized mutation rate;
[0212] Perform an individual update on all the trained individuals in the second population according to the optimized genetic parameters respectively corresponding to all the trained individuals in the second population to obtain the updated population corresponding to the second population.
[0213] In a possible implementation, the fitness function corresponding to the above first fitness value and the fitness function corresponding to the second fitness value are the same, and the fitness function is a weighted sum function of the mean squared error and the regularization term.
[0214] In a possible implementation, when the above population training module forms the first population by using at least some particles in the updated particle swarm, it can specifically be used for: forming the second population with the particles in the updated particle swarm whose second fitness value meets the fitness value requirement.
[0215] In a possible implementation, when the above parameter combination determination module determines the final parameter combination of the diabetes risk prediction model from the second population, it can specifically be used for: determining the individual with the highest first fitness value in the second population as the final parameter combination of the diabetes risk prediction model.
[0216] Each module in the above-mentioned parameter optimization device for the diabetes risk prediction model can be implemented in whole or in part by software, hardware, or a combination thereof. Each of the above modules can be embedded in the processor of a computer device in hardware form or be independent of it, or can be stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each of the above modules.
[0217] The above also introduced a diabetes risk prediction method provided by an embodiment of the present application. Next, a device for executing the above diabetes risk prediction method will be introduced.
[0218] Please refer to Figure 6 , Figure 6 which is a schematic structural diagram of a diabetes risk prediction device provided by an embodiment of the present application. As Figure 6 shown, the diabetes risk prediction device may include:
[0219] A data acquisition module 601, configured to acquire target user data, where the target user data refers to characteristic data that can characterize the risk degree of a user suffering from diabetes;
[0220] A diabetes prediction module 602, configured to input the target user data into a diabetes risk prediction model to obtain diabetes risk prediction information corresponding to the target user data.
[0221] Each module in the above-mentioned diabetes risk prediction device can be implemented in whole or in part by software, hardware, or a combination thereof. Each of the above modules can be embedded in the processor of a computer device in hardware form or be independent of it, or can be stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each of the above modules.
[0222] An embodiment of the present application also provides an electronic device, which may include at least one processor and a memory connected to the processor, where:
[0223] The memory is used to store a computer program;
[0224] The processor is used to execute the computer program so that the electronic device can implement any one of the parameter optimization methods for the diabetes risk prediction model provided by an embodiment of the present application, or implement any one of the diabetes risk prediction methods provided by an embodiment of the present application.
[0225] Refer to Figure 7 shown, which shows a schematic structural diagram of an electronic device suitable for implementing the electronic device in an embodiment of the present application. The electronic device in an embodiment of the present application may include, but is not limited to, fixed terminals such as mobile phones, laptop computers, PDAs (Personal Digital Assistants), PADs (Tablet Computers), desktop computers, and the like. Figure 7The electronic device shown is merely an example and should not impose any limitations on the functions and usage scope of the embodiments of the present application.
[0226] As Figure 7 shown, the electronic device may include a processing device (such as a central processing unit, a graphics processing unit, etc.) 701, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 702 or the program loaded from the storage device 708 into the random access memory (RAM) 703. When the electronic device is powered on, various programs and data required for the operation of the electronic device are also stored in the RAM 703. The processing device 701, the ROM 702, and the RAM 703 are connected to each other through a bus 704. The input / output (I / O) interface 705 is also connected to the bus 704.
[0227] Generally, the following devices may be connected to the I / O interface 705: an input device 706 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 707 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 708 including, for example, a memory card, a hard disk, etc.; and a communication device 709. The communication device 709 can allow the electronic device to communicate with other devices wirelessly or wiredly to exchange data. Although Figure 7 an electronic device with various devices is shown, it should be understood that it is not required to implement or have all the shown devices. More or fewer devices may be implemented or had alternatively.
[0228] In the embodiments of the present application, there is also provided a computer program product including computer-readable instructions. When the computer-readable instructions run on an electronic device, the electronic device is enabled to implement any one of the parameter optimization methods of the diabetes risk prediction model provided by the embodiments of the present application, or to implement any one of the diabetes risk prediction methods provided by the embodiments of the present application.
[0229] In the embodiments of the present application, there is also provided a computer-readable storage medium. The storage medium carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can be enabled to implement any one of the parameter optimization methods of the diabetes risk prediction model provided by the embodiments of the present application, or to implement any one of the diabetes risk prediction methods provided by the embodiments of the present application.
[0230] In addition, it should be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. In addition, in the attached drawings of the device embodiments provided in this application, the connection relationships between modules indicate that they have communication connections, which can be specifically implemented as one or more communication buses or signal lines.
[0231] Through the description of the above embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by dedicated hardware including application-specific integrated circuits, dedicated CPUs, dedicated memories, dedicated components, etc. Generally, functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structures for implementing the same function can also be various, such as analog circuits, digital circuits or dedicated circuits. However, in more cases, software program implementation is a better implementation method for this application. Based on such an understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a readable storage medium, such as a floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk or optical disc of a computer, and includes several instructions to enable a computer device (which can be a personal computer, training device, or network device, etc.) to execute the methods described in various embodiments of this application.
[0232] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product.
[0233] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions described in the embodiments of the present application are generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, training device, or data center to another website, computer, training device, or data center by wire (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wirelessly (such as infrared, wireless, microwave, etc.). The computer-readable storage medium may be any available medium that can be stored by a computer or a data storage device such as a training device or a data center that includes one or more integrated available media. The available medium may be a magnetic medium (such as a floppy disk, a hard disk, a magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid state disk (SSD)), etc.
Claims
1. A method for optimizing parameters of a diabetes risk prediction model, characterized in that, Including: Randomly generate an initial population within a preset parameter range, where each individual in the initial population represents a set of parameter combinations of a diabetes risk prediction model; Use the initial population as an initial particle swarm, and adopt a particle swarm optimization algorithm based on reinforcement learning to perform at least one particle update on the initial particle swarm to obtain an updated particle swarm corresponding to the initial particle swarm. Among them, the reinforcement learning process in the particle swarm optimization algorithm based on reinforcement learning is used to guide the direction and step size of particle movement; Form a first population from at least some of the particles in the updated particle swarm, and use a preset first training set to perform model training on each individual in the first population respectively to obtain a trained individual corresponding to each individual in the first population, and form a second population from the trained individuals; When the preset genetic convergence condition is not satisfied, use a genetic algorithm based on reinforcement learning to perform one individual update on the second population to obtain an updated population corresponding to the second population. Among them, the reinforcement learning process in the genetic algorithm based on reinforcement learning is used to guide the crossover and mutation of the second population; Use the updated population as the initial particle swarm, and return to perform at least one particle update on the initial particle swarm using the particle swarm optimization algorithm based on reinforcement learning until the genetic convergence condition is satisfied, and determine the final parameter combination of the diabetes risk prediction model from the second population.
2. The parameter optimization method of the diabetes risk prediction model according to claim 1, wherein The step of performing at least one particle update on the initial particle swarm using the particle swarm optimization algorithm based on reinforcement learning to obtain an updated particle swarm corresponding to the initial particle swarm includes: Use a preset second training set to perform model training on each particle in the initial particle swarm respectively to obtain a trained particle corresponding to each particle in the initial particle swarm, and form a first particle swarm from the trained particles; Use a preset second validation set and the diabetes risk prediction model to calculate second fitness values corresponding to all the trained particles in the first particle swarm; Judge whether the preset particle convergence condition is satisfied; If not, preset an initial velocity for each trained particle in the first particle swarm, and use the second fitness value corresponding to each trained particle in the first particle swarm as the initial position to obtain a first state, where the initial velocity is composed of an initial step size and an initial direction; Determine a first action according to the information of the preset update learning factor; Determine a first reward according to the optimization degree of the second fitness value; Perform reinforcement learning on the velocities of the particles in the first particle swarm according to the first state, the first action, and the first reward to obtain optimized velocities corresponding to all the trained particles in the first particle swarm, where the optimized velocity is composed of an optimized direction and an optimized step size; Perform one particle update on all the trained particles in the first particle swarm according to the optimized velocities corresponding to all the trained particles in the first particle swarm to obtain a second particle swarm; Take the second particle swarm as the initial particle swarm, and return to perform model training on each particle of the initial particle swarm using a preset second training set respectively. When the particle convergence condition is satisfied, determine the first particle swarm as the updated particle swarm corresponding to the initial particle swarm.
3. The method for optimizing the parameters of the diabetes risk prediction model according to claim 2, wherein, The step of performing one individual update on the second population using a genetic algorithm based on reinforcement learning to obtain the updated population corresponding to the second population includes: Determine the second state according to the first fitness values respectively corresponding to all the trained individuals in the second population, determine the second action according to the information of the preset update crossover rate, and determine the second reward according to the optimization degree of the first fitness value, where the first fitness values respectively corresponding to all the trained individuals in the second population are values calculated using a preset first validation set and the diabetes risk prediction model; Perform reinforcement learning on the genetic parameters of the trained individuals in the second population according to the second state, the second action, and the second reward to obtain the optimized genetic parameters respectively corresponding to all the trained individuals in the second population, where the optimized genetic parameters include an optimized crossover rate and / or an optimized mutation rate; Perform one individual update on all the trained individuals in the second population according to the optimized genetic parameters respectively corresponding to all the trained individuals in the second population to obtain the updated population corresponding to the second population.
4. The parameter optimization method for the diabetes risk prediction model according to claim 3, wherein The fitness function corresponding to the first fitness value is the same as the fitness function corresponding to the second fitness value; The fitness function is a weighted sum function of the mean squared error and the regularization term.
5. The method for optimizing the parameters of the diabetes risk prediction model according to claim 3 or 4, characterized in that, The step of forming a first population from at least some of the particles in the updated particle swarm includes: Form a second population from the particles in the updated particle swarm whose second fitness value meets the fitness value requirement; The step of determining the final parameter combination of the diabetes risk prediction model from the second population includes: Determine the individual with the highest first fitness value in the second population as the final parameter combination of the diabetes risk prediction model.
6. A method for predicting diabetes risk, characterized in that, including: Obtain target user data, where the target user data refers to characteristic data that can characterize the risk degree of a user suffering from diabetes; Input the target user data into the diabetes risk prediction model to obtain diabetes risk prediction information corresponding to the target user data, and the parameter combination in the diabetes risk prediction model is the final parameter combination determined by the parameter optimization method of the diabetes risk prediction model according to any one of claims 1 to 5.
7. An apparatus for optimizing parameters of a diabetes risk prediction model, characterized in that, including: An initial population generation module, configured to randomly generate an initial population within a preset parameter range, where each individual in the initial population represents a set of parameter combinations of the diabetes risk prediction model; A particle swarm update module, configured to take the initial population as the initial particle swarm, and perform at least one particle update on the initial particle swarm using a particle swarm optimization algorithm based on reinforcement learning to obtain the updated particle swarm corresponding to the initial particle swarm, where the reinforcement learning process in the particle swarm optimization algorithm based on reinforcement learning is used to guide the direction and step size of particle movement; A population training module, configured to form a first population from at least some of the particles in the updated particle swarm, and use a preset first training set to separately perform model training on each individual in the first population, obtaining a trained individual corresponding to each individual in the first population, and forming a second population from the trained individuals; A population update module, configured to, when a preset genetic convergence condition is not satisfied, perform one individual update on the second population by using a genetic algorithm based on reinforcement learning, obtaining an updated population corresponding to the second population, wherein the reinforcement learning process in the genetic algorithm based on reinforcement learning is used to guide the crossover and mutation of the second population; A parameter combination determination module, configured to use the updated population as the initial particle swarm, and return to perform at least one particle update on the initial particle swarm by using the particle swarm optimization algorithm based on reinforcement learning until the genetic convergence condition is satisfied, and then determine the final parameter combination of the diabetes risk prediction model from the second population.
8. A diabetes risk prediction device, characterized in that, Comprising: A data acquisition module, configured to acquire target user data, where the target user data refers to feature data that can characterize the risk degree of a user having diabetes; A diabetes prediction module, configured to input the target user data into a diabetes risk prediction model, obtaining diabetes risk prediction information corresponding to the target user data, and the parameter combination in the diabetes risk prediction model is the final parameter combination determined by the parameter optimization method of the diabetes risk prediction model according to any one of claims 1 to 5.
9. An electronic device, characterized in that, Comprising at least one processor and a memory connected to the processor, wherein: The memory is used for storing computer programs; The processor is used for executing the computer programs, so that the electronic device can implement the parameter optimization method of the diabetes risk prediction model according to any one of claims 1 to 5, or the diabetes risk prediction method according to claim 6.
10. A computer storage medium, characterized in that, The storage medium carries one or more computer programs, and when the one or more computer programs are executed by an electronic device, the electronic device can implement the parameter optimization method of the diabetes risk prediction model according to any one of claims 1 to 5, or the diabetes risk prediction method according to claim 6.