A model parameter adjustment method and system
By iteratively adjusting the model parameters by multiple slave nodes and calculating the target parameters from the master node, the problem of neglecting the influence between parameters in the prior art is solved, the accuracy and efficiency of model parameter adjustment is improved, and the parameter adjustment period is shortened.
Patent Information
- Application Number
- CN202011356338.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-26
- Publication Date
- 2025-01-17
- Estimated Expiration
- 2040-11-26
AI Technical Summary
The existing model parameter adjustment method ignores the mutual influence between parameters, resulting in low adjustment accuracy and efficiency, requiring frequent adjustment parameters, resulting in long parameter adjustment cycles.
Through multiple slave nodes based on the first neural network model and the training sample set of parameters and training, the model parameters are iteratively adjusted, and the master node calculates the target parameters to realize multi-threaded parameter adjustment, considering the mutual influence between parameters, Optimize the parameter adjustment process.
It effectively improves the accuracy and efficiency of model parameter adjustment, shortens the parameter adjustment period, avoids the problem of frequent parameter adjustment, and ensures the accuracy of parameter adjustment results.
Smart Images

Figure CN113762456B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a model parameter adjustment method and system. Background Art
[0002] In the process of building a machine learning model, adjusting the model parameters is an essential process.
[0003] At present, the main way to adjust model parameters is to select a few parameters from all model parameters for adjustment, and then adjust other parameters after the selected parameters are adjusted. For example, to adjust the parameters of the xgboost model, first adjust the max_depth and min_child_weight parameters included in the xgboost model, and then adjust the gamma parameters included in the xgboost model after the max_depth and min_child_weight parameters are adjusted.
[0004] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art:
[0005] The existing model parameter adjustment method ignores the mutual influence between parameters. For example, when two parameters have been adjusted, when adjusting the third parameter, the two adjusted parameters are no longer optimal due to the influence of the third parameter, and the first two parameters need to be readjusted, resulting in low model parameter adjustment accuracy and efficiency. Summary of the invention
[0006] In view of this, an embodiment of the present invention provides a model parameter adjustment method and system, which can effectively improve the model parameter adjustment accuracy and adjustment efficiency.
[0007] To achieve the above object, according to one aspect of an embodiment of the present invention, a model parameter adjustment method is provided, comprising:
[0008] A plurality of slave nodes obtain a plurality of parameters of the model to be adjusted, wherein each of the slave nodes is provided with a first neural network model, the model to be adjusted, and a training sample set required for the model to be adjusted;
[0009] The slave node iteratively adjusts the multiple parameters of the model to be adjusted based on the first neural network model, the multiple parameters of the model to be adjusted, the model to be adjusted and the training sample set required by the model to be adjusted;
[0010] The master node calculates multiple target parameters of the model to be adjusted based on the results of iterative adjustment of the multiple slave nodes.
[0011] Preferably, iteratively adjusting multiple parameters of the model to be adjusted includes:
[0012] For each iteration, execute:
[0013] Inputting a plurality of current parameters of the model to be adjusted into the first neural network model to obtain a parameter variable of each of the current parameters;
[0014] The current parameter is adjusted according to the parameter variable of the current parameter.
[0015] Preferably, the model parameter adjustment method further comprises:
[0016] For each iteration adjustment, execute:
[0017] Calculate the evaluation index of the model to be adjusted by using the current parameters, the model to be adjusted, and the training sample set required by the model to be adjusted;
[0018] Calculate the loss and network gradient of the first neural network model according to the evaluation index and the current parameters;
[0019] The first neural network model is adjusted using the loss and network gradient of the first neural network model.
[0020] Preferably, the model parameter adjustment method further comprises:
[0021] The slave node sends multiple network gradients obtained by multiple iterative adjustments to the master node;
[0022] The master node updates the network gradient using the set second neural network model and the multiple network gradients of the multiple slave nodes, and sends the updated result to the multiple slave nodes;
[0023] The slave node adjusts the first neural network model according to the updated result, so as to continue to perform the step of iteratively adjusting multiple parameters of the model to be adjusted by using the adjusted first neural network model.
[0024] Preferably, the model parameter adjustment method further comprises:
[0025] Determine whether the iterative adjustment steps meet the iteration stop condition,
[0026] If yes, then calculate multiple target parameters of the model to be adjusted.
[0027] Preferably, the iteration stop condition includes:
[0028] The number of executions of the step of iteratively adjusting the multiple parameters of the model to be adjusted reaches a preset iteration threshold;
[0029] or,
[0030] The obtained parameter variable of each of the current parameters is within the set variation range.
[0031] Preferably, the evaluation indicators include:
[0032] Any of precision, accuracy, and recall.
[0033] In a second aspect, an embodiment of the present invention provides a model parameter adjustment system, comprising: a plurality of slave nodes and a master node, wherein:
[0034] Each of the slave nodes is used to obtain multiple parameters of the model to be adjusted, wherein each of the slave nodes is provided with a first neural network model, the model to be adjusted, and a training sample set required for the model to be adjusted; based on the first neural network model, the multiple parameters of the model to be adjusted, the model to be adjusted, and the training sample set required for the model to be adjusted, iteratively adjust the multiple parameters of the model to be adjusted;
[0035] The master node is used to calculate multiple target parameters of the model to be adjusted based on the results of iterative adjustment of multiple slave nodes.
[0036] Preferably, the slave node is used to execute, for each iteration process, the following steps: inputting multiple current parameters of the model to be adjusted into the first neural network model to obtain parameter variables of each current parameter; and adjusting the current parameter according to the parameter variables of the current parameter.
[0037] An embodiment of the above invention has the following advantages or beneficial effects: since multiple slave nodes iteratively adjust multiple parameters of the model to be adjusted based on the first neural network model, multiple parameters of the model to be adjusted, the model to be adjusted and the training sample set required for the model to be adjusted, it is possible to simultaneously adjust multiple parameters through multiple slave nodes, and calculate multiple target parameters of the model to be adjusted according to the results of the iterative adjustment through the master node, and realize multi-threaded parameter adjustment through multiple slave nodes, which can effectively avoid the lengthy parameter adjustment process and shorten the parameter adjustment cycle of the model to be adjusted.
[0038] In addition, since multiple parameters can be adjusted simultaneously during the node parameter adjustment process, the mutual influence between parameters can be considered to ensure the accuracy of the parameter adjustment results.
[0039] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with specific implementation examples. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0041] Figure 1 is a schematic diagram of the main process of the method for adjusting model parameters according to an embodiment of the present invention;
[0042] Figure 2 It is a schematic diagram of the main process of iteratively adjusting multiple parameters of the model to be adjusted from the node according to an embodiment of the present invention;
[0043] Figure 3 is a schematic diagram of a main process of iterative adjustment from a node according to an embodiment of the present invention;
[0044] Figure 4 is a schematic diagram of the main process of updating the first neural network model of the slave node according to an embodiment of the present invention;
[0045] Figure 5 is a schematic diagram of main devices of a model parameter adjustment system according to an embodiment of the present invention;
[0046] Figure 6 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;
[0047] Figure 7 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0048] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0049] At present, various models have been applied in different scenarios. For example, machine learning models for obtaining user portraits, supervised learning models for predicting sales, etc. The following takes the construction of user portrait model as an example to explain the model construction process in detail.
[0050] For e-commerce platforms, user portraits are the key to e-commerce marketing activities, personalized recommendations, basic data services, etc. For example, the sinking market that many e-commerce companies are talking about now is a battleground. Only by obtaining accurate user portrait labels can we compete for the best quality and most accurate user groups in the shortest time and at the lowest cost, and then carry out various marketing promotion activities to promote customer acquisition and retention. Therefore, it is very important to build an accurate user portrait model.
[0051] In the user portrait modeling of e-commerce customer marketing, the process is roughly composed of three modules: data analysis, model generation (here refers to machine learning modeling), and model prediction (data application). The modeling process is very important. Modeling includes model selection and parameter adjustment. Model selection can be selected based on data distribution and data composition, and parameter adjustment is an indispensable process for each machine learning model. This solution proposes an optimization solution for parameter adjustment in the machine learning modeling process.
[0052] Figure 1 is a model parameter adjustment method according to an embodiment of the present invention. Figure 1 As shown, the model parameter adjustment method may include the following steps:
[0053] Step S101: multiple slave nodes obtain multiple parameters of the model to be adjusted, wherein each slave node is provided with a first neural network model, the model to be adjusted, and a training sample set required for the model to be adjusted;
[0054] In this step, the multiple parameters obtained from the node may be multiple initial parameters input from the outside, or may be multiple parameters obtained through loop iteration.
[0055] Step S102: the slave node iteratively adjusts multiple parameters of the model to be adjusted based on the first neural network model, multiple parameters of the model to be adjusted, the model to be adjusted, and a training sample set required by the model to be adjusted;
[0056] The model to be adjusted can be any model that can be supervised or semi-supervised trained using samples. The training sample set can be obtained using an existing method for obtaining a training sample set. For example, for a model that obtains a user portrait, its training sample set can be manually labeled user portrait sample data, etc.
[0057] Step S103: The master node calculates multiple target parameters of the model to be adjusted based on the results of iterative adjustment of multiple slave nodes.
[0058] Among them, the association relationship between the multiple slave nodes and the master node is: each of the multiple slave nodes obtains the adjustment value of each parameter through the first neural network model, and uses the parameter adjustment value to adjust the parameter, applies the adjusted parameter to the model to be adjusted, and uses the training sample set to evaluate the adjusted parameter, and re-adjusts the parameter according to the evaluation result. Accordingly, the master node can manage multiple slave nodes, and the master node can adjust the first neural network model for each slave node. At the same time, the master node can also integrate the parameters obtained by each slave node to obtain the final parameter.
[0059] Among them, the first neural network model mainly includes eval_net, next_net (the network structure is exactly the same as eval_net, and eval_net is taken as an example below) and replay_buffer.
[0060] Generally speaking, in order to fix the target network parameters obtained by the final training in reinforcement learning, two networks are usually established: eval_net and next_net, that is, eval_net and next_net are two neural networks in reinforcement learning. The parameters of these two neural networks, eval_net and next_net, are the same. Among them, eval_net is a learnable network, which is used to learn the latest input data in real time and update the network parameters in real time. After a period of time, the learned parameters will be copied to the next_net network; next_net is a neural network used to save the historical version parameters of eval_net. That is, next_net is a historical version of eval_net, which has a set of parameters from eval_net a long time ago, and this set of parameters is fixed for a period of time, and then replaced by the new parameters of eval_net.
[0061] replay_buffer is a cache network used to store the current multiple parameter values, multiple parameter adjustment values, rewards and penalties, and next parameter values, so as to be provided to the next_net network later.
[0062] Specifically, eval_net is a 4-layer neural network (input layer, two hidden networks and output layer). Among them, the size of the input layer is equal to the number of parameters of the model to be adjusted. The input layer is connected to two layers of 64-bit hidden layer networks (it is worth noting that the size of the hidden layer can be estimated according to the complexity. Usually, the size does not exceed 10 bits of input and output, and the size of the hidden layer can be dozens). Finally, the size of the output layer is equal to the number of parameters of the model to be adjusted. The output result is the parameter adjustment value. Among them, the output layer uses the tanh function, mapped to the range of [-1,1], and then divided into 3 categories according to the corresponding distance of the output tanh value, which are the distance to -1, 0, and 1, and finally reduced to these three values. The reason for using tanh is that in the next round of iteration, it can be checked whether to add 1 or subtract 1 to a certain parameter according to the evaluation index. If it is 0, stop. That is, iteratively adjusting multiple parameters of the model to be adjusted can be specifically outputting the adjustment values of multiple parameters of the model to be adjusted through the eval_net 4-layer neural network. For example, the multiple parameters are (a, b, c, d, e, f, g, h). Accordingly, the eval_net 4-layer neural network output is (0, 1, 0, -1, 0, 1, -1, 0), which (0, 1, 0, -1, 0, 1, -1, 0) is the adjustment value of (a, b, c, d, e, f, g, h). Accordingly, the adjusted parameters are (a+0, b+1, c+0, d-1, e+0, f+1, g-1, h+0).
[0063] replay_buffer is used to store the network of four elements: the current multiple parameter values, the adjustment values of multiple parameters, the rewards and penalties, and the next parameter value. The network width is equal to the sum of these four elements, and the length is set to between 300-500 based on the evaluation results. It is used to store network memory.
[0064] Among them, the relationship between eval_net—next_net—replay_buffer is: in the initial training, multiple parameter values of the model to be adjusted are randomly input through the eval_net network to obtain the output parameter adjustment value (0, 1, 0, -1, 0, 1, -1, 0). In the subsequent training, the eval_net network parameters are assigned to the next_net network through gradient update, and then the memory values stored in the replay_buffer are input into the next_net for training.
[0065] Among them, the next_net network can be calculated according to the calculation formula (1) to obtain the training result of the next_net network.
[0066] reward+gamma×np.max(q_next,axis=1) (1)
[0067] Among them, q_next: represents the output result of next_net; np.max(q_next,axis=1) represents the maximum value in the row direction; gamma represents the hyperparameter, indicating the degree of greediness, and reward represents the reward obtained (the reward can be obtained by inputting the current parameter value into the machine learning model and using the training sample set to obtain the evaluation index, such as any one of the precision, accuracy and recall rate).
[0068] In each iteration, the loss of training samples and output results will guide the update of the next round of network output, so that the reward can be maximized as much as possible.
[0069] Since multiple slave nodes iteratively adjust multiple parameters of the model to be adjusted based on the first neural network model, multiple parameters of the model to be adjusted, the model to be adjusted and the training sample set required for the model to be adjusted, it is possible to simultaneously adjust multiple parameters through multiple slave nodes, and the master node calculates multiple target parameters of the model to be adjusted according to the results of the iterative adjustment, and multi-threaded parameter adjustment is achieved through multiple slave nodes, which can effectively avoid the lengthy parameter adjustment process and shorten the parameter adjustment cycle of the model to be adjusted.
[0070] In addition, since multiple parameters can be adjusted simultaneously during the node parameter adjustment process, the mutual influence between parameters can be considered to ensure the accuracy of the parameter adjustment results.
[0071] In the embodiment of the present invention, Figure 2 As shown, iteratively adjusting multiple parameters of the model to be adjusted from the node may include the following steps:
[0072] For each iteration process, step S201 and step S202 are executed:
[0073] Step S201: input multiple current parameters of the model to be adjusted into the first neural network model to obtain parameter variables of each current parameter;
[0074] Step S202: adjusting the current parameter according to the parameter variable of the current parameter.
[0075] For example, if the current parameters are (1, 1, 2, 2, 2, 1), after step S201, the parameter variable (0, 1, 0, -1, 1, 0) is obtained. According to the parameter variable, the current parameter is adjusted as follows: (1+0, 1+1, 2+0, 2+(-1), 2+1, 1+0)=(1, 0, 2, 1, 1, 3, 1), i.e., the result after adjustment is: (1, 0, 2, 1, 1, 3, 1). That is, the parameter variable of the parameter is obtained through the neural network model through the above process, and manual intervention is reduced as much as possible.
[0076] In the embodiment of the present invention, Figure 3As shown, each time the slave node is iterated, steps S301 to S303 may be further performed:
[0077] Step S301: Calculate the evaluation index of the model to be adjusted using the current parameters, the model to be adjusted, and the training sample set required by the model to be adjusted;
[0078] The evaluation index of the model to be adjusted can be Q target -Q current (s, a), the difference between the output result of the model to be adjusted and the true value. The evaluation index can also be any one of precision, accuracy and recall. The difference between the output result of the model to be adjusted and the true value is used as an example for explanation. In addition, precision, accuracy and recall can be obtained using existing technologies.
[0079] Step S302: Calculate the loss and network gradient of the first neural network model according to the evaluation index and the current parameters;
[0080] Step S303: using the loss and network gradient of the first neural network model to adjust the first neural network model.
[0081] In the above step S302, the storage information of replay_buffer is sampled using an offline strategy, and the following calculation formulas (2) and (3) are used to calculate the loss and gradient of the first neural network model in the slave node respectively:
[0082]
[0083]
[0084] Among them, Loss represents the loss value of a neural network model; R is equal to the reward in the calculation formula (1); r represents the discount factor; Q target Characterizes the target result output by the model to be adjusted; Q current (s, a) represents the result output by the model to be adjusted under (parameters obtained in the current iteration cycle, adjustment values of parameters obtained in the current iteration cycle); Represents the network gradient obtained from the first neural network model in the node at the i-th iteration; θ i represents the network parameters of the first neural network model in the slave node at the i-th iteration; η represents the learning rate of the gradient update; y (j) =(R+r×max(Q target )) (j) ;h (j) =(Q current (s,a)) (j); j represents the jth sample in the training sample set; m represents the total number of samples in the training sample set.
[0085] This solution adjusts the parameters of the first neural network model and the model to be adjusted based on the evaluation indicators and the current parameters, which can ensure the accuracy of the parameter adjustment.
[0086] In the embodiment of the present invention, before the above step S103, Figure 4 As shown, the following steps may be further included:
[0087] Step S401: The slave node sends multiple network gradients obtained by multiple iterations of adjustments to the master node;
[0088] Step S402: the master node updates the network gradient using the set second neural network model and the multiple network gradients of the multiple slave nodes, and sends the updated result to the multiple slave nodes;
[0089] The second neural network model is target_net. The target_net set on the master node can aggregate the data distributed on each working node and run several times to the master node, and the master node then uses these data to calculate the gradient and sends the calculated gradient to each slave node to update the first neural network model of the slave node.
[0090] Step S403: The slave node adjusts the first neural network model according to the updated result, and uses the adjusted first neural network model to continue to perform the step of iteratively adjusting multiple parameters of the model to be adjusted.
[0091] In an embodiment of the present invention, the above method may further include: determining whether the iterative adjustment step satisfies the iteration stop condition, and if so, executing the calculation of multiple target parameters of the model to be adjusted; otherwise, continuing to execute the step of iteratively adjusting multiple parameters of the model to be adjusted.
[0092] The multiple target parameters of the model to be adjusted can be obtained by combining the parameters obtained from each slave node. The target parameters can be obtained by calculating the average value of the parameters of each slave node, that is, the target parameters can be calculated by the following calculation formula (4).
[0093]
[0094] Among them, C s Represents the sth target parameter in the model to be adjusted; c ks Represents the value of the sth parameter in the model to be adjusted obtained by the kth slave node; n represents the number of slave nodes; the values of s and k are both positive integers.
[0095] The target parameters of the model to be adjusted can also be calculated by assigning weights to the parameters of each slave node according to the weights of each slave node to obtain the target parameters. The target parameters can be calculated by the following calculation formula (5).
[0096]
[0097] Among them, C s Represents the sth target parameter in the model to be adjusted; c ks represents the value of the sth parameter in the parameter-adjusting model obtained by the kth slave node; n represents the number of slave nodes; α k Represents the weight of the kth slave node; the values of s and k are both positive integers;
[0098] In an embodiment of the present invention, the iteration stop condition may include: the number of executions of the steps of iteratively adjusting multiple parameters of the model to be adjusted reaches a preset iteration threshold; or, the parameter variable of each current parameter obtained is within a set variation range.
[0099] For example, if the adjustment variable of the parameter obtained by iterative adjustment is 0, 0 is the set variation range. That is, if the adjustment variable of each parameter is 0, the iteration is stopped.
[0100] like Figure 5 As shown, an embodiment of the present invention provides a model parameter adjustment system 500, which may include: a plurality of slave nodes 501 and a master node 502, wherein:
[0101] Each slave node 501 is used to obtain multiple parameters of the model to be adjusted, wherein each slave node 501 is provided with a first neural network model, a model to be adjusted, and a training sample set required for the model to be adjusted; based on the first neural network model, multiple parameters of the model to be adjusted, the model to be adjusted, and the training sample set required for the model to be adjusted, iteratively adjust the multiple parameters of the model to be adjusted;
[0102] The master node 502 is used to calculate multiple target parameters of the model to be adjusted based on the results of iterative adjustment of multiple slave nodes 501.
[0103] In an embodiment of the present invention, from node 501, for each iteration process, the following steps are performed: inputting multiple current parameters of the model to be adjusted into the first neural network model to obtain parameter variables of each current parameter; and adjusting the current parameter according to the parameter variables of the current parameter.
[0104] In an embodiment of the present invention, slave node 501 is further used to perform, for each iterative adjustment: calculating the evaluation index of the model to be adjusted using the current parameters, the parameter adjustment model, and the training sample set required for the model to be adjusted; calculating the loss and network gradient of the first neural network model according to the evaluation index and the current parameters; and adjusting the first neural network model using the loss and network gradient of the first neural network model.
[0105] In the embodiment of the present invention, the slave node 501 is further used to send multiple network gradients obtained by multiple iterations of adjustment to the master node 502;
[0106] The master node 502 is further used to update the network gradient using the set second neural network model and the multiple network gradients of the multiple slave nodes, and send the updated result to the multiple slave nodes 501;
[0107] From node 501, it is further used to adjust the first neural network model according to the updated result, so as to use the adjusted first neural network model to continue to perform the step of iteratively adjusting multiple parameters of the model to be adjusted.
[0108] In an embodiment of the present invention, the slave node 501 is further used to determine whether the iterative adjustment step meets the iteration stop condition. If so, the result of the iteration is sent to the master node 502; otherwise, the step of iteratively adjusting multiple parameters of the model to be adjusted is continued.
[0109] In an embodiment of the present invention, the iteration stop condition may include: the number of executions of the steps of iteratively adjusting multiple parameters of the model to be adjusted reaches a preset iteration threshold; or, the parameter variable of each current parameter obtained is within a set variation range.
[0110] In the embodiment of the present invention, the evaluation index may include: any one of precision, accuracy and recall rate.
[0111] Figure 6 An exemplary system architecture 600 is shown to which the model parameter adjustment method or model parameter adjustment system according to the embodiment of the present invention can be applied.
[0112] like Figure 6 As shown, the system architecture 600 may include slave node servers 601, 602, 603, a network 604, and a master node server 605. The network 604 is used to provide a medium for a communication link between the slave node servers 601, 602, 603 and the master node server 605. The network 604 may include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.
[0113] The user can use the slave node servers 601, 602, 603 to interact with the master node server 605 through the network 604 to receive or send messages, etc. The slave node servers 601, 602, 603 can be installed with the first neural network model, the model to be adjusted, etc. (only as an example), and in addition, the slave node servers 601, 602, 603 can also store the training sample set required for training the model to be adjusted.
[0114] The slave node servers 601, 602, 603 may be local servers, virtual machines, cloud servers, etc.
[0115] The master node server 605 can be a local server, a virtual machine, or a cloud server that provides various services, such as updating the network gradient obtained from the slave node servers 601, 602, and 603, or integrating the iteration results of multiple slave node servers to calculate multiple target parameters of the model to be adjusted (for example only). The master node server 605 can analyze the received network gradient and feed back the processing result (for example, the network gradient update result - for example only) to the slave node servers 601, 602, and 603.
[0116] It should be noted that the model parameter adjustment method provided in the embodiment of the present invention is generally completed by the slave node servers 601, 602, 603 and the master node server 605. Accordingly, the model parameter adjustment is generally divided into the slave node servers 601, 602, 603 and the master node server 605.
[0117] It should be understood that Figure 6 The number of slave node servers, networks and master node servers in the embodiment is only for illustration. Any number of slave node servers, networks and master node servers may be provided according to implementation requirements.
[0118] Reference below Figure 7 , which shows a schematic diagram of the structure of a computer system 700 suitable for implementing a slave node server or a master node server of an embodiment of the present invention. Figure 7 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0119] like Figure 7As shown, the computer system 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage part 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the system 700 are also stored. The CPU 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0120] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, a mouse, etc.; an output section 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, a modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed, so that a computer program read therefrom is installed into the storage section 708 as needed.
[0121] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 709, and / or installed from the removable medium 711. When the computer program is executed by the central processing unit (CPU) 701, the above-mentioned functions defined in the system of the present invention are executed.
[0122] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0123] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0124] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by one of the devices, the device includes: multiple slave nodes obtain multiple parameters of the model to be adjusted, wherein each of the slave nodes is provided with a first neural network model, the model to be adjusted, and a training sample set required for the model to be adjusted; the slave node iteratively adjusts the multiple parameters of the model to be adjusted based on the first neural network model, the multiple parameters of the model to be adjusted, the model to be adjusted, and the training sample set required for the model to be adjusted; the master node calculates the multiple target parameters of the model to be adjusted according to the results of the iterative adjustment of the multiple slave nodes.
[0125] According to the technical solution of the embodiments of the present invention, since multiple slave nodes iteratively adjust multiple parameters of the model to be adjusted based on the first neural network model, multiple parameters of the model to be adjusted, the model to be adjusted and the training sample set required for the model to be adjusted, it is possible to simultaneously adjust multiple parameters through multiple slave nodes, and calculate multiple target parameters of the model to be adjusted according to the results of the iterative adjustment through the master node, and realize multi-threaded parameter adjustment through multiple slave nodes, which can effectively avoid the lengthy parameter adjustment process and shorten the parameter adjustment cycle of the model to be adjusted.
[0126] In addition, since multiple parameters can be adjusted simultaneously during the node parameter adjustment process, the mutual influence between parameters can be considered to ensure the accuracy of the parameter adjustment results.
[0127] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A model parameter adjustment method, characterized in that: include: A plurality of slave nodes obtain a plurality of parameters of the model to be adjusted, wherein each of the slave nodes is provided with a first neural network model, the model to be adjusted, and a training sample set required for the model to be adjusted; The slave node iteratively adjusts the multiple parameters of the model to be adjusted based on the first neural network model, the multiple parameters of the model to be adjusted, the model to be adjusted and the training sample set required by the model to be adjusted; The master node calculates a plurality of target parameters of the model to be adjusted according to the results of iterative adjustment of the plurality of slave nodes; The master node is run through the master node server, the slave node is run through the slave node server, and multi-threaded parameter adjustment is achieved through multiple slave nodes; Iteratively adjusting multiple parameters of the model to be adjusted includes: For each iteration, execute: Inputting a plurality of current parameters of the model to be adjusted into the first neural network model to obtain a parameter variable of each of the current parameters; The current parameter is adjusted according to the parameter variable of the current parameter.
2. The model parameter adjustment method according to claim 1, characterized in that: Further including: For each iteration adjustment, execute: Calculate the evaluation index of the model to be adjusted by using the current parameters, the model to be adjusted, and the training sample set required by the model to be adjusted; Calculate the loss and network gradient of the first neural network model according to the evaluation index and the current parameters; The first neural network model is adjusted using the loss and network gradient of the first neural network model.
3. The model parameter adjustment method according to claim 2, characterized in that: Further including: The slave node sends multiple network gradients obtained by multiple iterative adjustments to the master node; The master node updates the network gradient using the set second neural network model and the multiple network gradients of the multiple slave nodes, and sends the updated result to the multiple slave nodes; The slave node adjusts the first neural network model according to the updated result, so as to continue to perform the step of iteratively adjusting multiple parameters of the model to be adjusted by using the adjusted first neural network model.
4. The model parameter adjustment method according to any one of claims 1 to 3, characterized in that: Further including: Determine whether the iterative adjustment steps meet the iteration stop condition, If yes, then calculate multiple target parameters of the model to be adjusted.
5. The model parameter adjustment method according to claim 4, characterized in that: Iteration stop conditions include: The number of executions of the step of iteratively adjusting the multiple parameters of the model to be adjusted reaches a preset iteration threshold; or, The obtained parameter variable of each of the current parameters is within the set variation range.
6. The model parameter adjustment method according to claim 2, characterized in that: The evaluation indicators include: Any of the difference, precision, accuracy and recall between the output result of the model to be adjusted and the true value.
7. A model parameter adjustment system, characterized in that: include: Multiple slave nodes and master nodes, where Each of the slave nodes is used to obtain multiple parameters of the model to be adjusted, wherein each of the slave nodes is provided with a first neural network model, the model to be adjusted, and a training sample set required for the model to be adjusted; based on the first neural network model, the multiple parameters of the model to be adjusted, the model to be adjusted, and the training sample set required for the model to be adjusted, iteratively adjust the multiple parameters of the model to be adjusted; The master node is used to calculate multiple target parameters of the model to be adjusted according to the results of iterative adjustment of the multiple slave nodes; in, The master node is run through the master node server, the slave node is run through the slave node server, and multi-threaded parameter adjustment is achieved through multiple slave nodes; The slave node is used to execute, for each iteration process, the following: input multiple current parameters of the model to be adjusted into the first neural network model to obtain parameter variables of each current parameter; and adjust the current parameter according to the parameter variables of the current parameter.
8. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 6.
9. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Convolution neural network parallel processing method based on large-scale high-performance cluster
CN104463324A